Switch node + attribute

Forums: Switch node + attribute
Houdini Integrated Plugin

Moderator: juanjgon

Switch node + attribute

Postby WoutTgh » Wed Mar 11, 2020 4:20 am

WoutTgh Wed Mar 11, 2020 4:20 am
HI,

is it possible inside a material network to use a custom attribute as input for the switch node ? That way you could assign different textures based on object id's . I k now I can get a custom float attribute in there, and I can use it to shade things, but I can't seem to access that value and use it as input for the, switch node, node selector, etc...

Thanks !
Wout
WoutTgh
Licensed Customer
Licensed Customer
 
Posts: 182
Joined: Sat Jul 27, 2019 8:39 pm

Re: Switch node + attribute

Postby juanjgon » Wed Mar 11, 2020 2:06 pm

juanjgon Wed Mar 11, 2020 2:06 pm
The node switcher node is not a conventional Octane shader node. It is an internal plugin tool designed to physically rewire the shader tree at the scene extraction time, so it only can have fixed parameters. I'm afraid that this node can't be configured using attributes. Perhaps you could use the material or texture mixer nodes to configure your shader.

Thanks,
-Juanjo
User avatar
juanjgon
Octane Plugin Developer
Octane Plugin Developer
 
Posts: 8867
Joined: Tue Jan 19, 2010 12:01 pm
Location: Spain

Re: Switch node + attribute

Postby WoutTgh » Wed Mar 11, 2020 2:21 pm

WoutTgh Wed Mar 11, 2020 2:21 pm
Hi Juanjo,

Hmm, if you have only two inputs then yes that would work, with a boolean 0-1 input, but for multiple textures?
Perhaps with a texture osl ? I'd have to get into the coding part there, I'm not familiar with that. :)
Last edited by WoutTgh on Wed Mar 11, 2020 11:25 pm, edited 1 time in total.
WoutTgh
Licensed Customer
Licensed Customer
 
Posts: 182
Joined: Sat Jul 27, 2019 8:39 pm

Re: Switch node + attribute

Postby WoutTgh » Wed Mar 11, 2020 11:24 pm

WoutTgh Wed Mar 11, 2020 11:24 pm
So I was playing around with the osl texture node

here's what I got:
Clipboard01.jpg



The float comes in, because I can see it shading the box,

inside the osl node it seems to always return 1 and not the float value ?
WoutTgh
Licensed Customer
Licensed Customer
 
Posts: 182
Joined: Sat Jul 27, 2019 8:39 pm

Re: Switch node + attribute

Postby juanjgon » Thu Mar 12, 2020 1:28 pm

juanjgon Thu Mar 12, 2020 1:28 pm
Have you tried this same code but declaring the index as float or color? I'm not sure if a texture output can be linked to an int input.

Thanks,
-Juanjo
User avatar
juanjgon
Octane Plugin Developer
Octane Plugin Developer
 
Posts: 8867
Joined: Tue Jan 19, 2010 12:01 pm
Location: Spain

Re: Switch node + attribute

Postby WoutTgh » Thu Mar 12, 2020 3:49 pm

WoutTgh Thu Mar 12, 2020 3:49 pm
Hello again,

so I did two tests,

in the first I'm simply passing on the value from the colour vertex attribute to the osl shader which passes it on correctly to the diffuse input.
thisworks.jpg


In the second test I'm trying to include it into an if statement, which doesn't seem to work, unless I've made a syntax mistake perhaps. ( no error warnings though)
thisdoesntwork.jpg
WoutTgh
Licensed Customer
Licensed Customer
 
Posts: 182
Joined: Sat Jul 27, 2019 8:39 pm

Re: Switch node + attribute

Postby WoutTgh » Thu Mar 12, 2020 4:18 pm

WoutTgh Thu Mar 12, 2020 4:18 pm
Simplified tests: when the output color is set to a single float value, it works,, when it is set to a color/vector with 3 components, it doesn't work.
thisworks.jpg

thisdoesntwork.jpg
WoutTgh
Licensed Customer
Licensed Customer
 
Posts: 182
Joined: Sat Jul 27, 2019 8:39 pm

Return to Houdini


Who is online

Users browsing this forum: No registered users and 17 guests

Sat Apr 27, 2024 1:36 am [ UTC ]