Diffuse Color of Instances based on ID Index

Forums: Diffuse Color of Instances based on ID Index
Newtek Lightwave 3D (exporter developed by holocube, Integrated Plugin developed by juanjgon)

Moderator: juanjgon

Diffuse Color of Instances based on ID Index

Postby LichtUndSchatten » Wed Jul 17, 2019 9:56 am

LichtUndSchatten Wed Jul 17, 2019 9:56 am
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 :)
LichtUndSchatten
Licensed Customer
Licensed Customer
 
Posts: 24
Joined: Fri May 12, 2017 4:12 pm

Re: Diffuse Color of Instances based on ID Index

Postby scooternva » Tue Jul 23, 2019 7:36 pm

scooternva Tue Jul 23, 2019 7:36 pm
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).
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 218 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
scooternva
Licensed Customer
Licensed Customer
 
Posts: 88
Joined: Thu Jul 04, 2019 6:13 pm
Location: Suburban Washington DC

Re: Diffuse Color of Instances based on ID Index

Postby juanjgon » Wed Jul 24, 2019 8:11 am

juanjgon Wed Jul 24, 2019 8:11 am
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
User avatar
juanjgon
Octane Plugin Developer
Octane Plugin Developer
 
Posts: 8867
Joined: Tue Jan 19, 2010 12:01 pm
Location: Spain

Re: Diffuse Color of Instances based on ID Index

Postby baltort » Wed Aug 07, 2019 1:07 pm

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

Re: Diffuse Color of Instances based on ID Index

Postby scooternva » Mon Apr 26, 2021 2:58 am

scooternva Mon Apr 26, 2021 2:58 am
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
scooternva
Licensed Customer
Licensed Customer
 
Posts: 88
Joined: Thu Jul 04, 2019 6:13 pm
Location: Suburban Washington DC

Re: Diffuse Color of Instances based on ID Index

Postby juanjgon » Mon Apr 26, 2021 7:50 am

juanjgon Mon Apr 26, 2021 7:50 am
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
juanjgon
Octane Plugin Developer
Octane Plugin Developer
 
Posts: 8867
Joined: Tue Jan 19, 2010 12:01 pm
Location: Spain

Re: Diffuse Color of Instances based on ID Index

Postby scooternva » Mon Apr 26, 2021 6:36 pm

scooternva Mon Apr 26, 2021 6:36 pm
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
scooternva
Licensed Customer
Licensed Customer
 
Posts: 88
Joined: Thu Jul 04, 2019 6:13 pm
Location: Suburban Washington DC

Re: Diffuse Color of Instances based on ID Index

Postby juanjgon » Tue Apr 27, 2021 8:54 pm

juanjgon Tue Apr 27, 2021 8:54 pm
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
User avatar
juanjgon
Octane Plugin Developer
Octane Plugin Developer
 
Posts: 8867
Joined: Tue Jan 19, 2010 12:01 pm
Location: Spain

Return to Lightwave 3D


Who is online

Users browsing this forum: Google [Bot] and 10 guests

Thu Mar 28, 2024 10:17 pm [ UTC ]