(For example, using movable proxy on instance objects)
In this case, when hiding or deleting some of the objects, the other objects will change color.
To keep a constant random color per object, a simple OSL texture can be used to produce random color depending on the object User ID.
First, set some unique user ID to each object:
-Select all objects to use your random material
-Open the Octane object properties dialog
-Set 'start' to 0
-In the tool button '...', select 'Set selected IDs from selection order'
Then, use the RandomGreyInstance.osl as a texture, or copy the code below:
- Code: Select all
int seedI = 0 [[string label = "Seed"]],
output color c = 0)
float noiseOut = noise("cell", (float)(_getinstanceid() + seedI));
c = color(noiseOut, noiseOut, noiseOut);
That gives a random grey color for each object. see sample randomColorFromUserID.max
This can then be used as the input of a Gradient texture, to select your colors.