Could someone explain in detail what the "If Else" shader node does?
IceEmpress
Posts: 639
I've seen it described, but I still don't understand it. I also need multiple examples of how it would be used.
Comments
Feed a test into the If input, for example from a Compare brick, the value you want when the test iss true into the Value input and the value you want if the test is false into the false input. This simple network makes the surface black if it is on the right of the UV map (s greater than 0.5) and white otherwise.
Is it safe to assume the if/else brick works just like an if/else statement in coding?
Ummm...yeah.
Basiclly RSL IS coding...and ShaderMixer bricks are 'libraries' or code snippets you connect to get your final code to compile.
what does "true" and "false" mean in this context?
As an example, you have a black and white opacity map. White represents 'True' in this instance, and black represents 'False' (in actuality, any value over 0.5 is usually considered 'True', so do bear this in mind if using grey). You could use this to, for example, apply 'holes' in an object and, using the If Else brick, fill those empty holes with a metallic surface. This would allow you to place a metallic overlay onto an object using simple alpha maps.
In code, the If Else statement works like this
In the case of the shader brick, the "Value" labelled result is the one returned when the statement is true, and the "Else" result is returned when the statement is false. Hopefully that simplifies rather than overcomplicates it.SO how would it work/what could it do when plugged into say-- a specular or gloss node?
(This is still very difficult for me to understand... How would a simple yes/no true/false pure black/pure white function allow for a LIE/layered image?)
More often used on input variables or things like shadows...set on/off conditions, test vectors directions and stuff like that.