Diffuse Color of Instances based on ID Index

Newtek Lightwave 3D (exporter developed by holocube, Integrated Plugin developed by juanjgon)

Moderator: juanjgon

Post Reply
LichtUndSchatten
Licensed Customer
Posts: 26
Joined: Fri May 12, 2017 4:12 pm

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 :)
User avatar
scooternva
Licensed Customer
Posts: 88
Joined: Thu Jul 04, 2019 6:13 pm
Location: Suburban Washington DC
Contact:

Congratulations, I think you've discovered a bug in OctaneRender's Texture Image Node, because this should work.
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
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 Image Texture Node ignores the procedural output of a Gradient node
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).
Attachments
instanced_color_demo.zip
Zip file containing demonstration LightWave object and scene, showing how instanced color works in LightWave but not OctaneRender
(10.18 KiB) Downloaded 510 times
Octane 2020.2.3.1 | LightWave 2019.1.5 (3134) | Win10 Pro 19041.1052 | 2 x Gigabyte AORUS RTX 2080 Ti Xtreme w/NVLink | Gigabyte AORUS Xtreme X399 | AMD Ryzen 2950X | 64 GB RAM | SSDs: Samsung 970 PRO 512 GB + Seagate FireCuda 510 2 TB | blog.gammans.zone
User avatar
juanjgon
Octane Plugin Developer
Posts: 8867
Joined: Tue Jan 19, 2010 12:01 pm
Location: Spain

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
baltort
Licensed Customer
Posts: 72
Joined: Mon Jul 07, 2014 4:00 pm

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
User avatar
scooternva
Licensed Customer
Posts: 88
Joined: Thu Jul 04, 2019 6:13 pm
Location: Suburban Washington DC
Contact:

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
Octane 2020.2.3.1 | LightWave 2019.1.5 (3134) | Win10 Pro 19041.1052 | 2 x Gigabyte AORUS RTX 2080 Ti Xtreme w/NVLink | Gigabyte AORUS Xtreme X399 | AMD Ryzen 2950X | 64 GB RAM | SSDs: Samsung 970 PRO 512 GB + Seagate FireCuda 510 2 TB | blog.gammans.zone
User avatar
juanjgon
Octane Plugin Developer
Posts: 8867
Joined: Tue Jan 19, 2010 12:01 pm
Location: Spain

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
User avatar
scooternva
Licensed Customer
Posts: 88
Joined: Thu Jul 04, 2019 6:13 pm
Location: Suburban Washington DC
Contact:

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.
Octane 2020.2.3.1 | LightWave 2019.1.5 (3134) | Win10 Pro 19041.1052 | 2 x Gigabyte AORUS RTX 2080 Ti Xtreme w/NVLink | Gigabyte AORUS Xtreme X399 | AMD Ryzen 2950X | 64 GB RAM | SSDs: Samsung 970 PRO 512 GB + Seagate FireCuda 510 2 TB | blog.gammans.zone
User avatar
juanjgon
Octane Plugin Developer
Posts: 8867
Joined: Tue Jan 19, 2010 12:01 pm
Location: Spain

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
Post Reply

Return to “Lightwave 3D”