Using the First Valid node

First Valid allows you to handle possible graph evaluation errors by providing alternative branches.

For example, here’s how you’d set up a compound to use either an attribute value or a value entered in the compound PPG. In this example, the PPG value is the fallback: if the attribute is not set, the value from the PPG is used.

Here’s another example. If there’s a texture map on the object, First Valid will pass through the texture map color. Otherwise, solid black is used.

Note that you don’t need to keep the constant color node. You just need it to force the type (Color) of the First Valid node.
After that, you can simplify to this:

1 thought on “Using the First Valid node

  1. Might be interesting to add, that a connection that comes from the input port of a compound directly, is always valid, even if it’s not connected.
    (this was my personal GOTCHA recently ;))

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s