Announcement

Collapse
No announcement yet.

Vray mesh export doesn't export materials.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Vray mesh export doesn't export materials.

    Even with the "Create Multi/Sub-Object Mtl" box checked, the proxy comes in with no material. I've tried this with various objects but still can't get the materials to work.

    This is the first time I've tried to do this in 3.4 but in previous versions it worked no problemo. If I check "Automatically create proxies", the materials are there on the object. However, if I a create a Vray Proxy then import the vrmesh file, it does not.
    Last edited by AC5L4T3R; 04-07-2016, 03:50 AM.
    CGI Artist @ Staud Studios

  • #2
    Since the initial implementation V-Ray Proxy feature it supports only geometry and it doesn't support materials.
    When Automatically Create Proxies option is enabled V-Ray applies the materials of the original geometry to the imported V-Ray Proxy objects automatically but the material is again not exported the to V-Ray Proxy file. If you would like to manually import V-Ray Proxy files you should also manually assign its material, it works this way in any V-Ray version.
    Svetlozar Draganov | Senior Manager 3D Support | contact us
    Chaos & Enscape & Cylindo are now one!

    Comment


    • #3
      I would like there to be an option to create a .mat file automatically when you create a vrmesh file, or even a DCC agnostic .vrmat would be very cool too, then we could send assets from max to maya to nuke much easier
      Maxscript made easy....
      davewortley.wordpress.com
      Follow me here:
      facebook.com/MaxMadeEasy

      If you don't MaxScript, then have a look at my blog and learn how easy and powerful it can be.

      Comment


      • #4
        Many + to this one, would be super cool to export material along with proxy. It should not be that hard to implement - export .mat along with proxy ?
        Available for remote work.
        My LinkedIn: https://www.linkedin.com/in/olegbudeanu/

        Comment


        • #5
          Here's some functions that do that:

          Code:
          fn exportVrMeshAndMat theObj =	
          (
          	theName = theObj[1].name
          	TheVrFilename = getSaveFileName filename:theName types:"Vrmesh(*.vrmesh)"
          	theVrmesh = vrayMeshExport meshfile:(TheVrFilename + ".vrmesh") autoCreateProxies:true exportMultiple:false createMultiMtl:true
          	-- theProxy = getNodebyName ("vrayProxy_" + theObj.name)
          	theVrmesh[1].material.name = ((getFilenameFile TheVrFilename) + "_proxy")
          	
          	if classof theVrmesh[1].material == multimaterial then
          	(
          		for m = 1 to theVrmesh[1].material.count do
          		(
          			theVrmesh[1].material[m].name = ((getFilenameFile TheVrFilename) + "_" + theVrmesh[1].material[m].name)
          		)
          	)
          	
          	theMats = materialLibrary theVrmesh[1].material
          	saveTempMaterialLibrary theMats (TheVrFilename + ".mat")
          )
          
          exportVrMeshAndMat (selection as array)
          
          
          
          fn importVrMeshAndMat =
          (
          	theFile = getOpenFileName caption:"Pick a vrmesh file:" types:"Vrmesh(*.vrmesh)"
          	theVrmesh = VRayProxy fileName:theFile
          	theMatlibName = (substituteString theFile ".vrmesh" ".mat")
          	print theMatlibName
          	theMats = loadTempMaterialLibrary theMatlibName
          	print theMats
          	theVrmesh.material = theMats[1]
          	theVrmesh.name = "vr_" + getFilenameFile theFile
          )
          
          importVrMeshAndMat()
          We've got an environment artist in here that's come from a far better company that uses shotgun for version control and scene update, I'm going to add a few bits to this so that the version of the vrmesh loaded into your max scene uses user defined properties as a simple record of the loaded version. We can then do another script which can check what version your scene has compared to what's in the folder the vrmesh is loaded from and then maybe do something like leave a selection of the objects that can be updated or change their wirecolour to red, then you can choose to update to the latest version or not.

          Comment


          • #6
            Sorry for reviving an old thread but could someone help to expand on the code joconnell posted above? I'm not good with scripting. I'm wondering if it's possible to allow the user to select multiple .vrmesh files in the open dialog box and apply the code to all selected files. Also, to fix error in the script if the user cancels the open dialog box. Appreciate the help. Thanks.

            Code:
            fn importVrMeshAndMat =
            (
            theFile = getOpenFileName caption:"Pick a vrmesh file:" types:"Vrmesh(*.vrmesh)"
            theVrmesh = VRayProxy fileName:theFile
            theMatlibName = (substituteString theFile ".vrmesh" ".mat")
            print theMatlibName
            theMats = loadTempMaterialLibrary theMatlibName
            print theMats
            theVrmesh.material = theMats[1]
            theVrmesh.name = "vr_" + getFilenameFile theFile
            )
            
            importVrMeshAndMat()
            Paul

            Comment


            • #7
              Horizon I'm on it
              Miroslav Ivanov
              Chaos Cosmos

              Comment


              • #8
                This is the modified version that should do the job:
                Code:
                fn importVrMeshAndMat =
                (
                   openDiag = dotNetObject "System.Windows.Forms.OpenFileDialog"
                   openDiag.Title = "Pick vrmesh file(s)"
                   openDiag.Filter = "Vrmesh(*.vrmesh)|*.vrmesh"
                   openDiag.Multiselect = true
                   clickedAction = openDiag.ShowDialog()
                   if clickedAction.Equals clickedAction.OK then
                   (
                      selectedFiles = openDiag.filenames
                      for each in selectedFiles do
                      (
                         theVrmesh = VRayProxy fileName:each
                         theMatlibName = (substituteString each ".vrmesh" ".mat")
                         print theMatlibName
                         theMats = loadTempMaterialLibrary theMatlibName
                         print theMats
                         theVrmesh.material = theMats[1]
                         theVrmesh.name = "vr_" + getFilenameFile each
                      )
                   )
                   else (print "Cancelled!")
                )
                importVrMeshAndMat()
                Miroslav Ivanov
                Chaos Cosmos

                Comment


                • #9
                  Sorry for the late reply...I'm recovering from surgery. I just wanted to say you're awesome! That works perfectly. This will really speed up my workflow. Thanks so much for your help Miroslav.
                  Paul

                  Comment


                  • #10
                    You're welcome and have a speedy recovery!
                    Miroslav Ivanov
                    Chaos Cosmos

                    Comment

                    Working...
                    X