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

Re: Diffuse Color of Instances based on ID Index

PostPosted: Mon Apr 26, 2021 2:58 am
by scooternva
Juanjo, was runtime support for the LightWave instance node ever fixed? I want to apply different Octane Texture Image textures to a set of 10 objects in my scene based on instance ID, and I'm darned if I can figure out a way to do this other than to create 10 separate copies of the object, which will take up an enormous amount of memory. The LightWave Multi Switch node doesn't seem to work with Octane materials, so I can't even fall back to that, but that's not really a solution anyway since I'd have to create 10 duplicates of my object's material--one for each Octane Texture Image--which would be REALLY ugly since the material is an Octane Composite Material.

Surely there must be an "Octane way" to instance an object and apply different specific image textures per instance...?

Thanks

Re: Diffuse Color of Instances based on ID Index

PostPosted: Mon Apr 26, 2021 7:50 am
by juanjgon
For random shading effects, you should think about using the randomcolor texture node, linked to a gradient or a mixer node.
https://docs.otoy.com/StandaloneH_STA/S ... exture.htm

Thanks,
-Juanjo

Re: Diffuse Color of Instances based on ID Index

PostPosted: Mon Apr 26, 2021 6:36 pm
by scooternva
This isn't a random shading effect. I have aircraft that each have different tail numbers, and slightly varying normals, roughness, etc. to vary the surfaces. But under the covers they're all the same object. Random shading won't work; I have t know which instance is which because each aircraft is being keyframed differently.

I'm getting the impression that this is beyond Octane's feature set and I'll have to render each aircraft object separately and composite them in post. That's going to be a PITA.

Re: Diffuse Color of Instances based on ID Index

PostPosted: Tue Apr 27, 2021 8:54 pm
by juanjgon
Hmm, nope. I'm not aware of any node to get the instance ID inside an Octane shading network. The only solution could come from the OSL side. I know that there is a function "_getinstanceid()" that can be used in OSL to get this instance ID. Perhaps you could write a simple OSL shader to get this value.

Thanks,
-Juanjo