Skip to main content
Version: 5.x
Supported on
Snapchat
Spectacles
This feature may have limited compatibility and may not perform optimally.
Camera Kit Mobile
Camera Kit Web
This feature may have limited compatibility and may not perform optimally.

VFX Sub-Graph Library

This page lists VFX Sub-Graph Library presets in alphabetical order, grouped by Particle Behavior.

In VFX Editor, you can create regular Sub-Graphs as seen in Material Editor, but you can also create Container Sub-Graphs to modify particle attributes. Container Sub-Graphs are functionally similar to regular Sub-Graphs, but they do not let you create Export nodes. Instead, Modify Attribute nodes can be connected vertically to manipulate particle data.

To learn more about Sub-Graphs in general, check out the Sub-Graph Overview page.

Getting Started

To create a Container Sub-Graph in a VFX Editor container, you can either click on the Add button or hit tab on your keyboard while pointing your cursor at a desired container. A sub-graph will only show up within its corresponding container (Spawn, Update or Output Quad). After the list appears, you can begin typing to filter subgraphs by name.

To create a Regular Sub-Graph outside of VFX Editor containers, hit tab on your keyboard while pointing your cursor anywhere outside of a VFX container.

Remember, you are not limited by all these presets below: an empty sub-graph is at the bottom of the sub-graph list (or by typing “Sub-Graph” in the search menu) for you to create your own.

Container Sub-Graphs can be imported and exported to files on your hard drive like regular sub-graphs. Depending on which container you exported the sub-graph from, it will come with one of three new extensions:

  • subgraph_vfx_spawn
  • subgraph_vfx_update
  • subgraph_vfx_output

Container Sub-Graphs can only be imported onto the same container type from which they were exported.

Container Sub-Graphs

Color

Set Alpha ( by Age ) Update

Alpha animates from the Start Alpha value to the End Alpha value based on normalized particle age ratio (0-1).

Set Alpha ( Fade In/Out ) Update

Alpha animates from Alpha Min to Alpha Max in the amount of time (seconds) set on Fade In Time, relative to the moment the particle spawns. Alpha then animates back to Alpha Min in the amount of time (seconds) set on Fade Out Time, relative to the lifespan of the particle.

Set Color ( 3D Texture ) Spawn Update

Set particle color by sampling a 3D texture, using Particle Position as the sample coordinate. Scale is the size of the 3D Texture in particle space and Offset adds an offset to the particle position. More 3D textures can be found in the Asset Library.

Set Color ( by Age ) Update

Particle Color animates from the Start Color RGB value to the End Color RGB value based on normalized particle age ratio (0-1). Note that this only sets RGB Color, to control alpha use Set Alpha ( by Age )sub-graph.

Set Color ( Fade In/Out ) Update

Color animates from Color Min to Color Max in the amount of time (seconds) set on Fade In Time, relative to the moment the particle spawns. Color then animates back to Alpha Min in the amount of time (seconds) set on Fade Out Time, relative to the lifespan of the particle. Note that this only sets RGB Color, to control alpha use Set Alpha ( Fade In/Out )sub-graph.

Set Color ( Hue over Time ) Spawn

Spawn with varying colors over time. Hue Transition Time controls how long it takes to rotate the hue 360 degrees (to go from red through the color spectrum and back to red again). Saturation and Value range from 0 to 1.

Set Color ( Random Range ) Spawn

Sets particle color to be a mix between two colors, with random weight to either Color A or Color B.

Set Color ( Ramp Texture by Age ) Update

Sample a 1D ramp texture and set the color by normalized particle age ratio (0-1).

Note that the Y coordinate for this texture sample is set to 0.5.

Force

Add Force ( 3D Texture ) Spawn Update

Add force by sampling a 3D Texture using Particle Position as the sample coordinate. Scale is the size of the 3d texture in particle space, Strength is a multiplier on the force, Offset adds an offset to the particle position, and Animate will offset the coordinates over time with this value controlling the speed. More 3D textures can be found in the Asset Library.

Add Force ( Attract / Repel ) Spawn Update

An attractive or repulsive force depending if the Strength is positive or negative. Attractive forces have positive Strength values and repulsive forces have negative Strength values. Target Position is the position where the force is attracted to or repelled from.

Add Force ( Directional ) Spawn Update

Force along a given XYZ Direction with a Strength control.

Add Force ( Drag ) Update

Resisting force of particle motion by slowing it down over time. The value of this force depends on Density (of the medium in which the particle exists), relative velocity, and the Area the cross section of the object facing in the direction of velocity (which currently is user-definable). The Drag Coefficient value is very sensitive, a smaller Drag Coefficient means less drag on particles.

Note the default Density value is 1.2 selected to represent air, 1.21 kg/m^3.

Set Force ( Gravity ) Spawn Update

Adds a gravitational force. Gravity Scale scales the gravitational constant.

Add Force ( Simplex Noise ) Spawn Update

A procedural simplex noise force using Particle Position for the noise coordinate. Scale is the size of the noise in particle space, Strength is a multiplier on the force, Offset adds an offset to the particle position, and Animate will offset the coordinates over time with this value controlling the speed.

Add Force ( Triplanar Texture ) Spawn Update

A 3D noise force derived from a 2d texture by sampling in three axes using Particle Position as the sample coordinate. Scale is the size of the noise in particle space, Offset adds an offset to the particle position, Strength is a multiplier on the force, and Animate will offset the coordinates over time with this value controlling the speed.

Add Force ( Vortex ) Spawn Update

Inject a velocity along a vortex axis, with an optional additional pull towards the vortex origin.

Life

Set Life ( Random Range ) Spawn

Set life to be a random value between Life Min and Life Max.

Mass

Set Mass ( Random Range ) Spawn

Set mass to be a random value between Mass Min and Mass Max.

Matrix

Set Matrix ( Random Rotation ) Spawn

Set the particle matrix to be a random rotation matrix between Angle Min (Degrees) and Angle Max (Degrees).

Set Matrix ( Rotate on Axis ) Spawn Update

Transforms the particle matrix to rotate about a Rotation Axis and Angle (Degrees).

Set Matrix ( Rotation Angle ) Spawn Update

Set the particle matrix to be a rotation matrix with XYZ angles by Angle (Degrees).

Set Matrix ( Rotate by Velocity ) Update

Transforms the particle matrix to rotate along an axis relative to its velocity. Rotation Amount controls how much rotation is applied on each frame.

Position

Add Position ( Random ) Spawn

Adds random offset Amount to the position.

Set Position (Depth) Spawn

Calculates position from depth. This sub-graph uses UV coords (usually screen UV) and depth input to generate camera space coordinates, which are then transformed into a world space position where particles will spawn. Particles will be discarded around the area that doesn't have depth information.

Set Position Plane ( Disc ) Spawn

Spawn particles within a 2d disc with Radius, Center, Edge Fill, Scale, and Axis (dropdown menu) controls.

Set Position Plane ( Square ) Spawn

Spawn particles within a 2d rectangle with Size, Center and Axis controls. Axis 0 = XY, Axis 1 = XZ, Axis 2 = YZ.

Set Position Volume ( Cone ) Spawn

Spawn particles in a cone shape with Length, Cone Angle, Orientation Axis (dropdown menu), and Volume Fill controls.

Set Position Volume ( Cube ) Spawn

Spawn particles within a 3d cube with Size and Center controls.

Set Position Volume ( Cylinder ) Spawn

Spawn particles in a cylinder shape with Height, Radius, Arc Angle and Volume Fill controls.

Set Position Volume ( Sphere ) Spawn

Spawn particles in a sphere or hemisphere shape, with Radius, Scale, Center, Volume Fill, and Sphere Type (dropdown menu) controls.

Set Position Volume ( Torus ) Spawn

Spawn particles in a 3D torus shape with Inner Radius1, Outer Radius, Arc Angles, Scale, Center, Volume Fill, and Axis (dropdown menu) controls.

Size

Size sub-graphs typically have two size modes: Explicit and Normalize to AABB. Explicit sets particle size directly and is good default for quad particles. Normalize to AABB will scale particles based on their render mesh's AABB and is useful when working with Custom Meshes.

Multiply Size ( Normalize to AABB ) Spawn

Scales the particle size attribute to the render mesh's AABB. This is especially useful when working with custom meshes.

Set Size ( Compute from Mass ) Spawn

Set particle size based on the mass value.

This sub-graph should be used after modifying particles mass (eg. with a Set Mass ( Random Range ) sub-graph before this one).

Set Size ( Random Range ) Spawn

Set life to be a random value between Size Min and Size Max.

Set Size ( by Age ) Update

Particle size animates from the Start Size value to the End Size value based on normalized particle age ratio (0-1).

Set Size ( Fade In/Out ) Update

Particle size animates from Size Min to Size Max in the amount of time (seconds) set on Fade In Time, relative to the moment the particle spawns. Size then animates back to Size Min in the amount of time (seconds) set on Fade Out Time, relative to the lifespan of the particle.

Velocity

Add Velocity ( Random ) Spawn

Add a random velocity value between Min Velocity and Max Velocity.

Multiple

Set Position and Color (2D Texture) Spawn Update

Spawns particles from a 2D texture. An example of this can be found in the VFX template.

Collision

Check out the VFX Collision page for examples on how to use the VFX Collision subgraphs.

Collision ( Depth Buffer ) Update

Enables VFX collision using the depth buffer and a screen space normals texture. For more information, check out the documentation for Screen Space Normals Generation.

Collision ( Plane ) Update

Enables VFX collision with a plane defined by a position and normal.

Collision ( Plane Array ) Update

Enables VFX collision with an array of planes, defined by an array of positions and normals.

Collision ( SDF ) Update

Enables VFX collision with a Signed Distance Field Texture that corresponds with a mesh and a Scene Object transform. A helper script should be used to send the transform matrix and mesh bounding box information.

Pixel Color

Align to Camera Output Quad

Aligns particle quads to face their render camera, and optionally orient and stretch along the particle's velocity vector.

Facing Mode and Alignment dropdown menus determine how the particle quad orients itself relative to the camera. Velocity Stretch Amount controls how much the particle is scaled along the velocity vector. When Velocity Stretch Amount is 0, particles only face the camera and are oriented relative to their Alignment setting.

Align to Velocity Output Quad

Aligns particle quads to their velocity vector. Stretch Amount controls how much the particle is scaled along the velocity vector. Alignment setting (dropdown menu) determines how the particle quad orients itself relative to its velocity.

Depth Distance Fade Output Quad

Fades pixels as they get close to other objects in the scene. This sub-graph is useful for softly fading particle effects such as smoke and fire.

Particle Lighting ( Phong ) Output Quad

Apply basic Phong shading on particles using Directional and Point Lights. Lights can be added and manipulated under Objects > Light > Light Source.

To enable shadows, click on the Output Quad container, go to Graph Properties on the right-hand side and change Shadow Mode to Caster at the end of the list. Click on the directional light you wish to create the shadow from in the Scene Hierarchy panel and enable the Shadow check box under the Inspector. Finally, add a Shadow Plane using Object > Shadow Plane.

If you don’t see shadows, try to move your Shadow Plane down in case your particles are below the shadow receiver. Make sure the shadow plane is visible by the camera, and the light direction is casting towards the shadow plane.

For more information about lighting, check out the Lighting and Shadow Page.

General Sub-Graphs

Most general sub-graphs are shared between the Material and VFX Editors. For documentation on sub-graphs in both the Material and VFX Editors, visit the Sub-Graph Library Page.

Particle Screen UV

Computes the screen UV coordinate of the particle from its position, useful in the Spawn/Update stages of VFX Editor.

Was this page helpful?
Yes
No