Branch Node
Description
This node provides a dynamic branch to the shader. If input Condition is true, the return output will be equal to input True, otherwise it will be equal to input False. This is determined per vertex or per pixel depending on shader stage.
The compilation mode of the branch can be selected with the Mode dropdown parameter (double-click somewhere inside the node to see the dropdown):
- Flatten — evaluate both sides of the branch and choose between the two resulting values. However, if the Condition receives a Constant as a value, one of the branches won't be used at all.
- Branch (DirectX only) — evaluate only one side of the branch depending on the given condition. Available only for DirectX Graphics API.
- Auto — the compiler auto selects the most appropriate mode.
Usage Examples
Example 1
This example demonstrates how to paint the front (visible) and back faces of polygons in different colors using the Branch node, which sets the albedo color based on the value provided by the Is Front Face node. This technique allows you to differentiate the appearance of your material on the front and back faces of polygons.
The information on this page is valid for UNIGINE 2.20 SDK.