Exposing custom parameters in Material settings and Render settings


I am writing an exporter / plug-in for an external rendering engine. I have not been able to find any examples / docs about creating custom render settings or changing the way material settings work through C#.

What is the correct way of doing this? For example, my rendering engine defines different types of materials with different settings (i.e. not just Color, Bump, Alpha, etc.). How can I replace the Rhino materials with my custom material options?

Similarly, how can I add custom render parameters to the render settings dialog?


@andy, chime in when you get a chance.

Attached is a sample project for creating new material types in C#.

CS RDK Test.zip (135.3 KB)

Since I’m away from the office, @dale will have to help you find a sample for replacing the options dialog render page in C#. (Sorry Dale - I couldn’t seem to find one).

  • Andy

Awesome, thank you both! I’ll give that sample a shot and see how I get on.

Both the Rhino C++ and Rhino_DotNet SDKs have functions on their render plug-in objects that allow the developer to replace the Render page in the Options dialog box. RhinoCommon does not. It’s on the to-do list…

Ah, that’s too bad. Where can I get the C++ SDK? Is there a similar plugin template for it and does it function similarly?


Shame, it needs VS Professional, which is a tad pricey… Any idea when that functionality could be expected for RhinoCommon?

Hopefully in a future service release. You an add your own pages to the Options dialog, from RhinoCommon. You just cannot replace the Render page (yet).

Ah! That would completely suffice for now. I just need somewhere to stick a load of render settings (scene parameters + camera properties).

Any templates for THAT bit? Thanks again for your continued help!

If you’re interested, I’m putting together an exporter for Indigo Renderer (indigorenderer.com) which is an amazing spectral renderer used a lot for arch. viz + products.

See the following:


Hi Andy,

The example seems a bit too extensive and I’m a little bit confused about what is actually necessary to get a bare-bones custom material… I’ve written my own material class, as in CustomMaterial.cs but am not sure if I need the rest of the material classes (CustomMaterialViewModel, CustomMaterialWpfUserInterfaceSection.xaml, CustomMaterialUserInterfaceSection, and CustomMaterialUserInterfaceSection2). As it is, nothing new shows up in the Material Editor when launching my render plugin.

Is there any documentation perhaps that describes each of these elements in further detail?

Also, on another slightly different note, how can I embed settings within the Rhino document? Objects have custom user data, however global settings (such as for render settings) don’t seem available under RhinoDoc…

EDIT: Found this: http://wiki.mcneel.com/developer/rhinocommonsamples/userdata

See the following example:


Pay particular attention to the project’s PlugIn inherited class, as it overrides ShouldCallWriteDocument, WriteDocument, and ReadDocument required to write and read document user data.

Gotcha. Yeah, found some documentation about that shortly after posting. Thanks for getting back to me!

The UserInterfaceSection stuff is for custom UI only (using either Forms or XAML). If you use the automatic section, your field data will be shown in the UI without any further coding.

You should be able to omit those classes (and the calling code in the CustomMaterial.cs file) and get a working material.

@jesterKing may be able to cook up a more simple example for you.

I have created a very minimal custom material example:

RhinoCommonCustomMaterial.zip (7.7 KB)

Verify the RhinoCommon reference is correct as per your own installation.

When you’ve loaded the plugin into Rhino you are able to create a new material of type “CSharp Custom Material”. The new material will by default have an orangy diffuse color. You can find fields added under “Texture Summary” section for the material.

Cheers, turns out I was missing the “RenderContent.RegisterContent(this);” line which prevented anything from showing up! Much thanks to you both.

I’m glad the example was useful :slight_smile: