Page 1 of 1

Diffuse Color of Instances based on ID Index

PostPosted: Wed Jul 17, 2019 9:56 am
by LichtUndSchatten
Hello.

Is there a way to apply different RGB Colors to different ID Index ranges of Instances in Octane.
For example i want the diffuse color of ID Index Count from 0-10 to become Red and 11-20 to become blue.
I´ve found the octane random color texture in combination with octane cradient texture but as the name
says: The result is random :)
In Lightwave native i´ve got it done with an Logical node applied to input of an Gradient.
Does someone know a way to do this in Octane Material?

Thanks :)

Re: Diffuse Color of Instances based on ID Index

PostPosted: Tue Jul 23, 2019 7:36 pm
by scooternva
Congratulations, I think you've discovered a bug in OctaneRender's Texture Image Node, because this should work.

lightwave_engine_jpg.jpg
Index ID of an instance as the input to a LightWave Gradient node, which in turn feeds the Diffuse channel of a Principled BSDF node


octanerender_engine.jpg
OctaneRender Image Texture Node ignores the procedural output of a Gradient node


I've also attached the LW object and scene demonstrating this (or rather, demonstrating how this does not work).

Re: Diffuse Color of Instances based on ID Index

PostPosted: Wed Jul 24, 2019 8:11 am
by juanjgon
This can't work, sorry. Octane can't evaluate the LightWave instance info node at render time. I hope that Octane will support custom attributes for the hair/instances/particles soon.

Thanks,
-Juanjo

Re: Diffuse Color of Instances based on ID Index

PostPosted: Wed Aug 07, 2019 1:07 pm
by baltort
I've made a bit of progress with this using OSL.

The hit:instance-id attribute always seems to return 0, so isn't much use. The hit:obj-seed attribute is more promising and seems to contain something different for each instance. I'm not sure what the values actually are (they seem to be something close to 100000) but they are sequential. For example this script outputs red or green depending on whether the obj-seed is odd or even. Notice how the resulting pattern is very regular:

----
shader instanceID(
output color c = 0

)
{

int instID;
//getattribute("hit:instance-id", 0, instID); //always seems to return 0
getattribute("hit:obj-seed", 0, instID);

if((instID%2)==0)
c = color(1,0,0);
else
c = color(0,1,0);
}


instance id test 1.jpg