Page 1 of 1
Switch node + attribute
Posted: Wed Mar 11, 2020 4:20 am
by WoutTgh
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
Re: Switch node + attribute
Posted: Wed Mar 11, 2020 2:06 pm
by juanjgon
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
Re: Switch node + attribute
Posted: Wed Mar 11, 2020 2:21 pm
by WoutTgh
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.

Re: Switch node + attribute
Posted: Wed Mar 11, 2020 11:24 pm
by WoutTgh
So I was playing around with the osl texture node
here's what I got:
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 ?
Re: Switch node + attribute
Posted: Thu Mar 12, 2020 1:28 pm
by juanjgon
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
Re: Switch node + attribute
Posted: Thu Mar 12, 2020 3:49 pm
by WoutTgh
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.
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)
Re: Switch node + attribute
Posted: Thu Mar 12, 2020 4:18 pm
by WoutTgh
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.