search
Start typing to search...

Shaders: Math / Arithmetic, Logical Modules

Author: Aximmetry

Introduction

This document describes the built-in Flow Graph modules of the following categories for shaders:

  • Shaders: Math / Arithmetic - Modules that perform element-wise arithmetic, interpolation, rounding, derivatives, noise, power, and trigonometric operations on shader vectors.
  • Shaders: Math / Logical - Modules that compare values and combine logical conditions to drive shader-graph branching and selection.

Shaders: Math / Arithmetic

This section describes the built-in Flow Graph modules that perform element-wise arithmetic, interpolation, rounding, derivatives, noise, power, and trigonometric operations on shader vectors.

Absolute

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Returns the absolute value of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise absolute value of In.

Add

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Adds two vectors. The operation is performed element-wise. A single-component operand is broadcast across the other.
  • Input pins:
    •   A (vector) - First input vector.
    •   B (vector) - Second input vector.
  • Output pins:
    •   Out (vector) - Element-wise sum of A and B.

Arccosine

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes arccosine of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise arccosine of In in radians.

Arctangent

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes arctangent of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise arctangent of In in radians.

Arctangent YX

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes arctangent from Y and X vectors. The operation is performed element-wise. A single-component operand is broadcast across the other.
  • Input pins:
    •   Y (vector) - Y component input for atan2.
    •   X (vector) - X component input for atan2.
  • Output pins:
    •   Out (vector) - Element-wise atan2(Y, X) in radians.

Arcsine

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes arcsine of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise arcsine of In in radians.

Ceiling

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Rounds a vector up to the nearest integer values. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise ceiling of In.

Clamp

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Limits a vector to a minimum and maximum range. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
    •   Minimum (vector) - Lower bound for each output component.
    •   Maximum (vector) - Upper bound for each output component.
  • Output pins:
    •   Out (vector) - Input clamped between Minimum and Maximum per component.

Cosine

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes cosine of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise cosine of In.

Cosine Hyp

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes hyperbolic cosine of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise hyperbolic cosine of In.

DDX

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes the screen-space X derivative of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise partial derivative along screen X.

DDY

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes the screen-space Y derivative of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise partial derivative along screen Y.

Divide

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Divides one vector by another. The operation is performed element-wise. A single-component operand is broadcast across the other.
  • Input pins:
    •   A (vector) - Input vector to divide.
    •   B (vector) - Input vector used as divisor.
  • Output pins:
    •   Out (vector) - Element-wise quotient of A and B.

Exponential

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes the natural exponential of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise result of e raised to In.

Floor

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Rounds a vector down to the nearest integer values. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise floor of In.

Fractional

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Extracts the fractional part of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise fractional part of In.

Invert

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes one minus a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise result of 1 - In.

Lerp

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Linearly interpolates between two vectors by a blend factor. The operation is performed element-wise on A and B. A single-component operand is broadcast across the other.
  • Input pins:
    •   A (vector) - Value used when Factor is 0.
    •   B (vector) - Value used when Factor is 1.
    •   Factor (scalar) - Blend amount between A and B.
  • Output pins:
    •   Out (vector) - Interpolated vector between A and B.

Logarithm

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes the natural logarithm of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise natural logarithm of In.

Maximum

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Selects the larger value from two vectors. The operation is performed element-wise. A single-component operand is broadcast across the other.
  • Input pins:
    •   A (vector) - First input vector.
    •   B (vector) - Second input vector.
  • Output pins:
    •   Out (vector) - Element-wise maximum of A and B.

Minimum

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Selects the smaller value from two vectors. The operation is performed element-wise. A single-component operand is broadcast across the other.
  • Input pins:
    •   A (vector) - First input vector.
    •   B (vector) - Second input vector.
  • Output pins:
    •   Out (vector) - Element-wise minimum of A and B.

Modulo

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes the floating-point modulo of two vectors. The operation is performed element-wise. A single-component operand is broadcast across the other.
  • Input pins:
    •   A (vector) - Input vector to wrap.
    •   B (vector) - Input vector used as divisor.
  • Output pins:
    •   Out (vector) - Element-wise floating-point remainder from fmod(A, B).

Multiply

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Multiplies two vectors. The operation is performed element-wise. A single-component operand is broadcast across the other.
  • Input pins:
    •   A (vector) - First input vector.
    •   B (vector) - Second input vector.
  • Output pins:
    •   Out (vector) - Element-wise product of A and B.

Negate

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Negates a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise negated value of In.

Noise

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Generates noise from a 3D position input.
  • Input pins:
    •   Position (vector) - Position used to sample the noise function.
  • Output pins:
    •   Out (scalar) - Noise value generated at Position.

Perlin Noise

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Generates fractal Perlin noise from a 3D position input.
  • Input pins:
    •   Position (vector) - Position used to sample the noise function.
    •   Type (integer, Perlin Noise Type) - Selects the fractal style for the generated noise.
    •   Octaves (integer) - Number of fractal layers combined in the result.
    •   Lacunarity (scalar) - Frequency multiplier applied between octaves.
    •   Gain (scalar) - Amplitude multiplier applied between octaves.
    •   Ridge Offs (scalar) - Offset used by ridged mode when shaping peaks.
  • Output pins:
    •   Out (scalar) - Fractal noise value generated at Position.

Power

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Raises one vector to the power of another. The operation is performed element-wise. A single-component operand is broadcast across the other.
  • Input pins:
    •   A (vector) - Base vector. Its absolute value is used before exponentiation.
    •   B (vector) - Exponent vector.
  • Output pins:
    •   Out (vector) - Element-wise result of pow(abs(A), B).

Reciprocal

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes the reciprocal of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise result of 1 / In.

Remainder

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes the floating-point remainder of two vectors. The operation is performed element-wise. A single-component operand is broadcast across the other.
  • Input pins:
    •   A (vector) - Input vector to divide.
    •   B (vector) - Input vector used as divisor.
  • Output pins:
    •   Out (vector) - Element-wise floating-point remainder from fmod(A, B).

Round

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Rounds a vector to the nearest integer values. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise rounded value of In.

Saturate

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Clamps a vector to the 0-1 range. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Input clamped to 0-1 per component.

Sign

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Returns the sign of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Returns -1, 0, or 1 for each component of In.

Sine

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes sine of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise sine of In.

Sine Cosine

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes sine and cosine of a vector in one operation. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Sine (vector) - Element-wise sine of In.
    •   Cosine (vector) - Element-wise cosine of In.

Sine Hyp

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes hyperbolic sine of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise hyperbolic sine of In.

Square

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Squares a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise result of In multiplied by itself.

Square Root

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes the square root of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise square root of In.

Subtract

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Subtracts one vector from another. The operation is performed element-wise. A single-component operand is broadcast across the other.
  • Input pins:
    •   A (vector) - Input vector to subtract from.
    •   B (vector) - Input vector to subtract.
  • Output pins:
    •   Out (vector) - Element-wise difference of A and B.

Tangent

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes tangent of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise tangent of In.

Tangent Hyp

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes hyperbolic tangent of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise hyperbolic tangent of In.

Truncate

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Removes the fractional part of a vector. The operation is performed element-wise.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Element-wise truncated value of In.

Unlerp

  • Category: Shaders: Math / Arithmetic
  • Access: All editions.
  • Function: Computes where an input vector falls between two endpoints. The operation is performed element-wise on In. A and B are single-component endpoints broadcast across In.
  • Input pins:
    •   In (vector) - The source value
    •   A (scalar) - Lower endpoint used for normalization.
    •   B (scalar) - Upper endpoint used for normalization.
    •   Clamp (logical) - When on, clamps the result to the 0-1 range.
  • Output pins:
    •   Out (vector) - Normalized blend position of In between A and B.

Shaders: Math / Logical

This section describes the built-in Flow Graph modules that compare values and combine logical conditions to drive shader-graph branching and selection.

All

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Checks whether all vector components are on.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (logical) - On when every component of In is non-zero.

And

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Computes logical AND of two logical values.
  • Input pins:
    •   A (logical) - First logical input.
    •   B (logical) - Second logical input.
  • Output pins:
    •   Out (logical) - On only when both A and B are on.

And Vector

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Computes logical AND of two vectors.
  • Input pins:
    •   A (vector) - First vector input.
    •   B (vector) - Second vector input.
  • Output pins:
    •   Out (vector) - Per-component logical AND of A and B.

Any

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Checks whether any vector component is on.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (logical) - On when at least one component of In is non-zero.

Equal

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Compares two scalar values for equality.
  • Input pins:
    •   A (scalar) - First scalar input.
    •   B (scalar) - Second scalar input.
  • Output pins:
    •   Out (logical) - On when A equals B.

Equal Vector

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Compares two vectors for equality.
  • Input pins:
    •   A (vector) - First vector input.
    •   B (vector) - Second vector input.
  • Output pins:
    •   Out (vector) - Per-component equality result of A and B.

Greater

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Checks whether one scalar value is greater than another.
  • Input pins:
    •   A (scalar) - First scalar input.
    •   B (scalar) - Second scalar input.
  • Output pins:
    •   Out (logical) - On when A is greater than B.

Greater Or Equal

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Checks whether one scalar value is greater than or equal to another.
  • Input pins:
    •   A (scalar) - First scalar input.
    •   B (scalar) - Second scalar input.
  • Output pins:
    •   Out (logical) - On when A is greater than or equal to B.

Greater Or Equal Vector

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Checks whether one vector is greater than or equal to another.
  • Input pins:
    •   A (vector) - First vector input.
    •   B (vector) - Second vector input.
  • Output pins:
    •   Out (vector) - Per-component result of A greater than or equal to B.

Greater Vector

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Checks whether one vector is greater than another.
  • Input pins:
    •   A (vector) - First vector input.
    •   B (vector) - Second vector input.
  • Output pins:
    •   Out (vector) - Per-component result of A greater than B.

If

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Selects between two vectors using a logical condition.
  • Input pins:
    •   If (logical) - Logical selector for the output value.
    •   Then (vector) - Output value when If is on.
    •   Else (vector) - Output value when If is off.
  • Output pins:
    •   Out (vector) - Then when If is on, otherwise Else.

If Vector

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Selects between two vectors using a vector condition.
  • Input pins:
    •   If (vector) - Per-component selector vector.
    •   Then (vector) - Output value for components where If is non-zero.
    •   Else (vector) - Output value for components where If is zero.
  • Output pins:
    •   Out (vector) - Per-component selection from Then or Else.

Less

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Checks whether one scalar value is less than another.
  • Input pins:
    •   A (scalar) - First scalar input.
    •   B (scalar) - Second scalar input.
  • Output pins:
    •   Out (logical) - On when A is less than B.

Less Or Equal

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Checks whether one scalar value is less than or equal to another.
  • Input pins:
    •   A (scalar) - First scalar input.
    •   B (scalar) - Second scalar input.
  • Output pins:
    •   Out (logical) - On when A is less than or equal to B.

Less Or Equal Vector

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Checks whether one vector is less than or equal to another.
  • Input pins:
    •   A (vector) - First vector input.
    •   B (vector) - Second vector input.
  • Output pins:
    •   Out (vector) - Per-component result of A less than or equal to B.

Less Vector

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Checks whether one vector is less than another.
  • Input pins:
    •   A (vector) - First vector input.
    •   B (vector) - Second vector input.
  • Output pins:
    •   Out (vector) - Per-component result of A less than B.

Not

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Computes logical negation of a logical value.
  • Input pins:
    •   In (logical) - The source value
  • Output pins:
    •   Out (logical) - Inverted logical value.

Not Equal

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Compares two scalar values for inequality.
  • Input pins:
    •   A (scalar) - First scalar input.
    •   B (scalar) - Second scalar input.
  • Output pins:
    •   Out (logical) - On when A and B are different.

Not Equal Vector

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Compares two vectors for inequality.
  • Input pins:
    •   A (vector) - First vector input.
    •   B (vector) - Second vector input.
  • Output pins:
    •   Out (vector) - Per-component inequality result of A and B.

Not Vector

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Computes logical negation of a vector.
  • Input pins:
    •   In (vector) - The source value
  • Output pins:
    •   Out (vector) - Per-component logical negation of In.

Or

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Computes logical OR of two logical values.
  • Input pins:
    •   A (logical) - First logical input.
    •   B (logical) - Second logical input.
  • Output pins:
    •   Out (logical) - On when A or B is on.

Or Vector

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Computes logical OR of two vectors.
  • Input pins:
    •   A (vector) - First vector input.
    •   B (vector) - Second vector input.
  • Output pins:
    •   Out (vector) - Per-component logical OR of A and B.

Switch

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Selects one value from sixteen vector inputs by index.
  • Input pins:
    •   Switch (integer) - Selection index from 1 to 16.
    •   Value 1 (vector) - Value returned when Switch is 1.
    •   Value 2 (vector) - Value returned when Switch is 2.
    •   Value 3 (vector) - Value returned when Switch is 3.
    •   Value 4 (vector) - Value returned when Switch is 4.
    •   Value 5 (vector) - Value returned when Switch is 5.
    •   Value 6 (vector) - Value returned when Switch is 6.
    •   Value 7 (vector) - Value returned when Switch is 7.
    •   Value 8 (vector) - Value returned when Switch is 8.
    •   Value 9 (vector) - Value returned when Switch is 9.
    •   Value 10 (vector) - Value returned when Switch is 10.
    •   Value 11 (vector) - Value returned when Switch is 11.
    •   Value 12 (vector) - Value returned when Switch is 12.
    •   Value 13 (vector) - Value returned when Switch is 13.
    •   Value 14 (vector) - Value returned when Switch is 14.
    •   Value 15 (vector) - Value returned when Switch is 15.
    •   Value 16 (vector) - Value returned when Switch is 16.
  • Output pins:
    •   Out (vector) - Selected value, or zero when Switch is outside 1-16.

Xor

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Computes logical exclusive OR of two logical values.
  • Input pins:
    •   A (logical) - First logical input.
    •   B (logical) - Second logical input.
  • Output pins:
    •   Out (logical) - On when exactly one of A or B is on.

Xor Vector

  • Category: Shaders: Math / Logical
  • Access: All editions.
  • Function: Computes logical exclusive OR of two vectors.
  • Input pins:
    •   A (vector) - First vector input.
    •   B (vector) - Second vector input.
  • Output pins:
    •   Out (vector) - Per-component logical exclusive OR of A and B.
Article Content

Loading
Close
Loading spinner icon
1/10