Go to: Attributes.

Condition is a utility node that allows you to switch between two colors or textures, depending on a simple mathematical relationship between two input values. If the relationship (Greater Than, Less Than, Equals, Is Not Equal To, etc) is true, then the first color or texture is output. If the relationship is false, then the second color or texture is output.

You can use Condition nodes for many different purposes. Some examples:

See the Rendering Book for more in-depth examples.

Note: The Condition node is completely unrelated to the "condition" command found in the MEL scripting language.

In general, the operation of the Condition Node is this:

     IF ( First Term OPERATION Second Term ) THEN
         Out Color = Color If True
     ELSE
         Out Color = Color If False

In the table below, important attributes have their names listed in bold in the description column.

This node is MP safe

Node nameParentsClassificationMFn typeCompatible function sets
conditionnodeutility/general:drawdb/shader/operation/conditionkConditionkBase
kNamedObject
kDependencyNode
kCondition

Attributes (15)

colorIfFalse, colorIfFalseB, colorIfFalseG, colorIfFalseR, colorIfTrue, colorIfTrueB, colorIfTrueG, colorIfTrueR, firstTerm, operation, outColor, outColorB, outColorG, outColorR, secondTerm

Long name (short name)TypeDefaultFlags
operation (op) enum0outputinputconnectablestorable
Operation is the test that is performed between the First Term and Second Term attributes. If the test is true, Out Color is set to ColorIfTrue. If it is false, Out Color is set to ColorIfFalse.

The possible operations are:

  • Equal
  • Not Equal
  • Greater Than
  • Greater Or Equal
  • Less Than
  • Less or Equal
firstTerm (ft) float0.0outputinputconnectablestorablekeyable
First Term is the first term of the if condition. (See description at top).
secondTerm (st) float0.0outputinputconnectablestorablekeyable
Second Term is the second term of the if condition. (See description at top).
colorIfTrue (ct) float30.0, 0.0, 0.0outputinputconnectablestorablekeyable
ColorIfTrue. The color or texture that will be output by this node when the condition is True. See description at top.
colorIfTrueR (ctr) float0.0outputinputconnectablestorablekeyable
The red component of ColorIfTrue
colorIfTrueG (ctg) float0.0outputinputconnectablestorablekeyable
The green component of ColorIfTrue
colorIfTrueB (ctb) float0.0outputinputconnectablestorablekeyable
The blue component of ColorIfTrue
colorIfFalse (cf) float31.0, 1.0, 1.0outputinputconnectablestorablekeyable
ColorIfFalse. The color or texture that will be output by this node when the condition is False. (See description at top).
colorIfFalseR (cfr) float0.0outputinputconnectablestorablekeyable
The red component of ColorIfFalse
colorIfFalseG (cfg) float0.0outputinputconnectablestorablekeyable
The green component of ColorIfFalse
colorIfFalseB (cfb) float0.0outputinputconnectablestorablekeyable
The blue component of ColorIfFalse
outColor (oc) float30.0, 0.0, 0.0outputconnectable
Out Color. This is set to Color IfTrue when the condition is True, and to Color IfFalse when the condition is False.
outColorR (ocr) float0.0outputconnectable
The red component of Out Color
outColorG (ocg) float0.0outputconnectable
The green component of Out Color
outColorB (ocb) float0.0outputconnectable
The blue component of Out Color