Rhinoscript + Vray Material Access

Versions: Rhino 7, V-Ray 5

I’m scripting the conversion of a massive library of globeplants.com species from SKP to Rhino and the last step is to apply imported V-Ray materials to Rhino layers. I just cannot find any solid documentation on V-Ray scripting within Rhinoscript and the only limited information is from the V-Ray Script Access page.

Dim vray, materials
Set vray = Rhino.GetPlugInObject(“V-Ray for Rhino”)
materials = vray.Scene.Materials

I just can’t access the Materials array to identify names, indexes and apply to Rhino layers. Would there be any documentation that would provide deeper access to classes, methods, etc.

You should be able to do that with layer.RenderMaterial property without having to go through Vray.

Not sure about the syntax in Rhinoscript, but in python getting the materials array is something like this:

RenderMats = [rm for rm in scriptcontext.doc.RenderMaterials]

All the Vray materials should be there.

Hope that helps.

Thanks for the reply; however, when I import the vrmat it does not get applied to the layer … so the Layer.RenderMaterial is not of use. The V-Ray materials don’t even get registered with the Rhino Material Table and therefore, I cannot access them and I need to work out how to read the vray.Scene.Materials array in order to apply to matching Layers.