--------- 'Material Selector' material ----------
(From version 2021.1.6 - 12.28 and 2022.1 RC1 - 13.09)
* Avoid 'Material' modifier
The main purpose is to avoid adding a 'Material' modifier in the geometry.
The material modifier allows to select a material from a Multi-material by material ID.
But when the material ID from the modifier is animated, this forces Octane to read the full mesh every frame, as the object is considered having a geometry animation.
For better performance, you can use the 'Material Selector' material.
* How it works
The 'Material Selector' is a wrapper that uses the Octane Composite material.
It gather materials from a standard Multi-material, and set the mask for each material so only 1 is visible.
There are 2 custom osl shaders used to compare material indices.
Note that is uses material index of the multi-material, not material IDs
Material are selected by their index, from 1 to the material count.
* Additional features
- Random material
Set the Selection type to 'Random'
Use the seed parameter to generate different random distribution.
Internally using an Octane Random Color texture, this generates values that are used to select one of the material.
- Generic Octane texture.
Set the Selection type to 'Texture'
Any texture can be used to select one of the materials.
A grey scale texture, with ranging output from (0,1) will select a material in the range (1, material count)
For color textures, you can specify the color channel to use, or All to consider all the rgb channels.
Here are some samples:
MtlSelector_AnimatedIndex.max :
MtlSelector_Random.max :
MtlSelector_Texture.max :