I have tousands of LEDs and want show randomly the status ON (with emission) and OFF.
I dont wonna make it with the random thing on the Object info Node.
I wonna assign 2 different Material to the objects (Material for ON and OFF). How I do this ? Something with the Material Index ?
No. The random value is generated at render time, so in the NodeEditor you cannot access it.
Basically, it’s a number between 0 and 1.
Plugging the ‘random’ output to the ‘Surface’ input of the ‘Material Output’, you can see in the viewport which value comes out.
Both ‘options’ I posted above spit out some value between 0.0 and 1.0.
Each object will get randomly a number in this interval.
The problem of trying to ‘see’ what number comes out of some node is a logic problem!
Example: You have 1000 objects each with a random number… That means 1000 random numbers in a single instance. Which number do you want to see???
If you really, really want to see what number/value/color comes out from any node, then you need to use OSL, and printf the values into the console.
Note that this will flood your console with tons of numbers, as each sample will print something, and a simple render with 16px*16px at 32samples will output 8192 values…
shader peekf(float finput=0, output float foutput=0)
{
printf("the float value for this sample is %f\n", finput);
foutput = finput;
}
Also note that you need to setup the environment OSL_OPTIONS="optimize=0", or osl will simply jump over any printf call.