Common ShaderFX nodes and applications

If Else Basic

Create this node by selecting: Hw Shader Nodes > Flow Control > If Else Basic in the ShaderFX editor.

To use this node, provide a Condition. If the condition is true, then the value connected to the True attribute is used. If the condition is false, then the value connected to the False attribute is used.

Instead of providing a value to the False attribute, you can also provide a Default Output Value. The Default Output Value is used unless the condition is true. It provides for cleaner code and optimization.

In this example, if Bool is set to true, then the Diffuse Color is red.

If Bool is set to false, then the Diffuse Color is green.

The same result occurs whether you connect the green Color to Default Output Value or to False.

Comparison

Create this node by selecting: Hw Shader Nodes > Flow Control > Comparison in the ShaderFX editor.

A Comparison node compares two values. For example, it compares two values to see if they are equal or if one is greater than the other. Select among condition operators such as >, <, != and so forth in the Attribute Editor.

It is very useful for providing a condition for the If Else Basic node.

In this example, the Comparison node compares the Red channel in the Texture Map to the specified Float value. If the value in the Red channel is > 0.5, then the True value (blue color) is applied. Otherwise, the default value (yellow color) is applied.