RenderMaterial vs. Material, and parameter mapping


We are working on an Iray for Rhino plugin, and I am writing a material conversion routine, to help the user get nice initial materials in Iray. We have written an MDL material explicitly for mapping the Rhino material parameters, to ease this task. We do not expect anyone who wants to use Iray to continue to use the Rhino materials, as these do not expose very much of the power of MDL. Therefore I would like to write a routine to convert the Rhino materials on a one-time basis.

I see that there are two materials in the RhinoObject, RenderMaterial, and Material. Getting the Material parameters converted was easy, but I am having trouble seeing where the RenderMaterial comes into the equation. The only time I ever get the RenderMaterial (i.e. GetRenderMaterial mostly returns null), is when there is no material explicitly assigned.

What would be the best way to handle RenderMaterial, keeping in mind that we just want to convert once?

I am also having trouble mapping some of the parameters. What are the class names for the following UI parameters: gloss finish, and the colour button next to it, Textures>Color? And there is a Shiny parameter in the code that I don’t see in the UI.


I don’t quite understand why GetRenderMaterial is returning null, but if
you are just trying to convert Rhino materials to iRay materials, you’re
almost certainly not interested in custom material types that might be
derived from RenderMaterial. That means you should just call SimulateMaterial
on the RenderMaterial to get a Rhino.DocObjects.Material and call out the
parameters from there.

  • Andy

Gloss Finish = Rhino.DocObjects.Material.Shine /
Gloss color = Rhino.DocObjects.Material.SpecularColor

And the color texture is the “BitmapTexture”

Everything works now, thanks!