Switch node + attribute

Houdini Integrated Plugin

Moderator: juanjgon

Post Reply
WoutTgh
Licensed Customer
Posts: 182
Joined: Sat Jul 27, 2019 8:39 pm
Contact:

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

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
WoutTgh
Licensed Customer
Posts: 182
Joined: Sat Jul 27, 2019 8:39 pm
Contact:

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
Posts: 182
Joined: Sat Jul 27, 2019 8:39 pm
Contact:

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

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
WoutTgh
Licensed Customer
Posts: 182
Joined: Sat Jul 27, 2019 8:39 pm
Contact:

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
Posts: 182
Joined: Sat Jul 27, 2019 8:39 pm
Contact:

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

Return to “Houdini”