Shader Graphs

Shader graphs can be used to define the material of particles more precisely allowing you to fine-tune colors and even make materials react dynamically to particle properties like velocity and force influence. Such a shader graph consits of nodes that work together to define the final pixel color and opacity. Each nodes implements a specific function that computes an output value from its input values, which are supplied by other nodes. Some nodes also have additional parameters that influence their function.

An example of a node is the Blend node, which mixes two colors together: The two colors are connected to the input pins of the blend node while the output pin, carrying the resulting color, is connected to other nodes in the graph. The parameter Mode determines how the colors are blended together.

Shader Node Blend

Eventually, all nodes run together into the Output node, which sets the final color of each pixel. Color values are stored in RGBA (Red, Green, Blue, Alpha) format, where each channel contains a number in the range [0, 1] defining the color intensity for that channel. The alpha component defines the opacity.

Shader Node Output


The shader graph of an object can be modified in the shader graph window. To open this window, click Shader Graph... from the Material property of an object.

Creating Shader Graphs

Each emitter and sprite already has a default shader graph, which applies a texture and combines it with the color set from the particle or sprite properties. To assign a completely new shader graph to the object click New or select a preset with Preset....

Adding Nodes

New nodes can be added by right-clicking an empty space and selecting a node type, by dragging out an attribute pin and dropping it on an empty space or by clicking Add in the toolbar. The list of available nodes can be filtered by typing in the search box at the top.

Shader Graph Add

While right-clicking or dragging out a node pin, there are several keyboard shortcuts for creating common node types directly.

1Number Constant
2Float2 Constant
3Float3 Constant
4Float4 Constant
BBoolean Constant
CColor Constant

Removing Nodes

To remove a node, click Remove in the context menu (right mouse button) or select the node(s) and press Remove in the tool bar.

Applying Changes

Changes to the graph are not actually applied to the object until you click Apply in the toolbar. Otherwise, they are not saved when you close the window.


Nodes: Constants

BooleanBoolean constant, which can be true or false.
IntegerInteger constant, which can be any positive or negative integer.
NumberNumber constant, which can be any rational number.
Vector 2Vector constant with two components.
Vector 3Vector constant with three components.
Vector 4Vector constant with four components.
ColorColor constant with four components (RGBA).

Nodes: Inputs

Input: Texture CoordinateThe per-vertex texture coordinate for the current drawable. Used to sample textures.
Input: ColorThe per-vertex color of the current drawable. This input can be set with Color attribute in the Visuals tab.
Input: VelocityThe velocity vector of the current drawable (only available for particles).
Input: ForceThe force vector of the current drawable (only available for particles).
Input: LifeThe percentage of life left for the current drawable from 1.0 (drawable has spawned) to 0.0 (drawable is about to disappear).
Input: Object IDThe ID of the current drawable, which can be used to differentiate individual particles, for example.
Effect TimeTime passed since the effect has started.
Object TimeTime passed since the object (emitter or sprite) was instantiated.

Nodes: Colors

BlendA, BBlends colors A and B together using the specified blending mode.
Color RampValuePicks a color from the specified gradient using Value as an index between 0.0 and 1.0.
Adjust BrightnessColor, BrightnessIncreases the brightness of Color for Brightness > 0 and decreases it for Brightness < 0.
Adjust ExposureColor, ExposureIncreases the exposure of Color for Exposure > 0 and decreases it for Exposure < 0.
Adjust ContrastColor, ContrastIncreases the contrast of Color for Contrast > 0 and decreases it for Contrast < 0.
Adjust SaturationColor, SaturationIncreases the saturation of Color for Saturation > 0 and decreases it for Saturation < 0.
PosterizeColor, NumberReduce the number of available colors per channel to Number.

Nodes: Textures

Texture: ImageUVSamples the given image at texture coordinate UV.
Texture: Sprite SheetUV, FrameSamples the image at index Frame in the given sprite sheet at texture coordinate UV.
Tiling and OffsetUV, Tiling, OffsetTransforms texture coordinate UV by tiling it Tiling times and applying Offset.
TwirlUV, AmountTransforms texture coordinate UV by twirling it with strength Amount.

Nodes: Procedural

Circle MaskUV, Radius, SmoothnessGenerates a circular mask, where (0.5, 0.5) is the circle's center, Radius is its radius and Smoothness dictates how slowly the value falls off outside the radius. The circle is then sampled at coordinate UV.
Noise (2D)UV, Amplitude, Frequency, Persistence, LacunarityGenerates 2D Simplex noise with the given parameters. This noise is sampled at coordinate UV.

Nodes: Math

AddA, BAdds A and B (A + B).
SubtractA, BSubtracts B from A (A - B).
MultiplyA, BMultiplies A with B (A * B).
DivideA, BDivides A by B (A / B).
ModuloA, BComputes the modulus of A and B (A mod B).
PowerA, BRaises A to the power of B (AB).
Natural ExponentiationValueComputes the natural exponentiation of Value (exp(Value)).
Natural LogarithmValueComputes the natural logarithm of Value (ln(Value)).
SignValueReturns the sign of Value, i.e. +1 if Value is positive, -1 if Value is negative and 0 if Value is 0.
Absolute ValueValueReturns the absolute value of Value (|Value|).
MinA, BReturns the minimum of A and B (min(A, B)).
MaxA, BReturns the maximum of A and B (max(A, B)).
ClampValue, Min, MaxLimits Value to the range [Min, Max].
Linear InterpolationA, B, FactorInterpolations linearly between A and B using Factor (in the range [0, 1]).
FloorValueRounds Value down to the next integer.
CeilValueRounds Value up to the next integer.
RoundValueRounds Value to the nearest integer.
Square RootValueComputes the square root of Value.
SinValueComputes the sine of Value.
CosValueComputes the cosine of Value.
ArcsinValueComputes the arcus sine of Value.
ArccosValueComputes the arcus cosine of Value.
Dot ProductA, BComputes the dot product of vectors A and B.
Cross ProductA, BComputes the cross product of vectors A and B.
NormalizeVectorNormalizes Vector to a vector of length 1.
Vector LengthVectorReturns the length or magnitude of Vector.
StepValue, EdgeGenerates a step function by comparing Value to Edge. If Value < Edge, the output is 0 and otherwise 1.
Smooth StepValue, Edge 1, Edge 2Performs a smooth interpolation between 0 and 1 when Edge 1 < Value < Edge 2.
ThresholdValueReturns parameter Output if Value is smaller than parameter Threshold.
NegateValueNegates the boolean Value.

Nodes: Comparison

EqualA, BOutputs True if A = B and False otherwise.
Not EqualA, BOutputs True if A ≠ B and False otherwise.
Approximately EqualA, BOutputs True if A ≈ B (depending on given Epsilon) and False otherwise.
LessA, BOutputs True if A < B and False otherwise.
Less or EqualA, BOutputs True if A ≤ B and False otherwise.
GreaterA, BOutputs True if A > B and False otherwise.
Greater or EqualA, BOutputs True if A ≥ B and False otherwise.

Nodes: Utililty

BranchPredicate, True, FalseOutputs the value for True if Predicate evaluates to true and the value for False otherwise.
Frame AnimationTimeComputes the frame (for example of a sprite sheet) that has been reached after time Time. The animation is characterized by the given parameters.
Split Vector (2)VectorSplits the two-dimensional vector Vector into its components.
Split Vector (3)VectorSplits the three-dimensional vector Vector into its components.
Split Vector (4)VectorSplits the four-dimensional vector Vector into its components.
Merge Vector (2)X, YCombines X, Y into a two-dimensional vector.
Merge Vector (3)X, Y, ZCombines X, Y, Z into a three-dimensional vector.
Merge Vector (4)X, Y, Z, WCombines X, Y, Z, W into a four-dimensional vector.