Preparation of models for multiple render engines

Hello everyone,

I’d like to ask if somebody knows if single rhino file support materials for many renderers or sth bad can happen. Basically, I would like to have a single rhino model file but pick material for desired engine currently in use, as keeping files with the same models with only assigned different materials don’t seem wise - just losing hdd space on this as the model is the same, textures are the same - only materials differ. Any ideas of scripting this?

I’ve searched for similar functionality elsewhere and i saw that Laubwerk has such thing and preps material on the fly for the desired engine - although it is for max i guess:

Besides here also another question comes to my mind as getting info about current renderer is fairly simple i have an issue with cycles since I’m not sure how to differentiate it from the basic rhino renderer - as Cycles isn’t pickable as current render engine - only available through viewport modes. Any thoughts?

I believe that the topic doesn’t fully describe yet the scope of all my question/questions :sweat_smile:

If you tag your materials in the file with some useful strings you could switch materials along the lines of the script I posted in:

Cycles in v6 indeed isn’t per se available as render engine, by default only as viewport mode. I believe the script points to some ideas also for checking the viewport mode. Basically you ask the viewport for its RealtimeDisplayMode, and in a try-catch block you try to query for some property. If it succeeds you have a viewport using the realtime engine integration. It could be Cycles.

To check the current renderer set through Rendering panel or Render > Current Render menu:

import Rhino.Render as rr
import Rhino.PlugIns as rp

ruid = rr.Utilities.DefaultRenderPlugInId

info = rp.PlugIn.GetPlugInInfo(ruid)


Note that there is also an event that you can subscribe. It fires whenever the current renderer is changed:

Neat! However, I’m still bound partially to v5 in my everyday production pipeline so i need solution for v5 and v6 - this makes few things still not available :frowning:

As i understand rhino file keeps all materials even after resave and even if I don’t have installed the certain engine on the current machine - I’m constantly switching two pcs and as some renderers are node-locked i have some on the go some on a local machine - buying all for two pcs is quite expensive in such situation. I guess Tags can be replaced just with a wise Name scheme?

Hmm … That’s interesting however i guess after inserting a block it will only import currently assigned material so other materials from saved models will be lost i guess ? Does this mean i would have to script also special import routine?

Whatever floats your v5 boat :slight_smile: My knowledge of v5 is pretty much non-existant.

You mean other materials from the file you are inserting the block from? If you need to maintain everything and you have only one model per file to insert, the probably better to import instead. That should bring in all stuff.

:+1: Yup I remember that :slight_smile:

I guess so if the material will need to be picked on the fly - however, I’m afraid that accidental purge will break everything one day - as it will purge unused backing materials - I guess reimport with one time assignment will be easier to track (only on import) but this way it won’t be possible to use cycles materials - as it could be assigned only on fly as you mentioned, besides I guess I will have to keep basic material in order to work on v5 and v6 and it will be enough decent to feed cycles - will try :slight_smile:

I wonder if any other user tried to upgrade own workflow in a similar way. Anyone out there?