Working with Shader Graph in the Visual Effect Graph
Visual Effect Graphs (VFX Graphs) can use compatible Shader Graphs to render particles. This enables you to build custom shaders to use in visual effects. This document explains:
- How to make a Shader Graph compatible with Visual Effect Graphs
- How to set up a Visual Effect Graph to use a Shader Graph to render particles
- How to upgrade an existing project
- Known limitations of the Visual Effect Graph
Make a Shader Graph compatible with a Visual Effect Graph
To make a Shader Graph compatible with the Visual Effect Graph:
- Open a shader in the Shader Graph window.
- In the Graph Settings tab, specify the render pipeline Target (HDRP or Universal).
- Enable Support VFX Graph.
A Shader Graph shader that is compatible with the Visual Effect Graph can also work as a regular shader. Most HDRP and URP Shader Graph shaders support the Visual Effect Graph. For exceptions, see Known Limitations.
Note: VFX Graph support does not impact runtime performance but Shader Graphs which use Support VFX Graph take longer to compile.
Upgrade your project
Unity versions 2021.2, and earlier use the deprecated Visual Effect Target to integrate Shader Graphs with Visual Effect Graphs.
The Visual Effect Target limits functionality and requires you to use the following:
- Dedicated VFX shaders
- The Metallic workflow
To upgrade a project to use the new render pipeline Target:
- Go to Edit > Preferences > Visual Effects.
- Enable Improved Shader Graph Generation.
- In the Graph Settings tab of the shader add a HDRP or Universal Target.
- Enable Support VFX Graph.
- Remove the Visual Effect Target.
Use a Shader Graph in a Visual Effect Graph
To make a visual effect with Shader Graph:
- Go to Edit > Preferences > Visual Effects.
- Enable Experimental Operators/Blocks. This reveals a Shader Graph slot in the output.
- Open your Visual Effect Graph in the Visual Effect Graph window. If you do not have a Visual Effect Graph, go to Create > Visual Effects > Visual Effect Graph to create a new one.
- In the interface for output contexts, assign your compatible Shader Graph to the Shader Graph property. To do this, either search for the Shader Graph directly in the Asset Picker, or drag the Shader Graph sub-asset to the Shader Graph slot:
- Click on the output context to view it in the Inspector.
You can make changes to the Shader Graph's Surface Options in the output context.
Note: Any edits you make to a Shader Graph in the VFX Graph are local to the VFX Graph and do not affect the Shader Graph asset.
Visual Effect Graph output compatibility
The following output contexts support Shader Graphs:
- Particle Mesh (including Particle Lit Mesh)
- Particle Primitive (including Particle Quad, Particle Triangle, Particle Octagon, Particle Lit Quad, Particle Lit Triangle, and Particle Lit Octagon)
- Particle Strip Quad (including Particle Lit Strip Quad)
Known limitations
Visual Effect Graph does not support the following Blackboard features:
Shader Graph does not support some features in specific Targets.
- The HDRP Target does not support the following:
- Decal Shader Graph.
- Motion vectors for vertex animation.
- The URP target does not support the following:
- The Visual Effect Target (deprecated) does not support:
- HDRP or Universal material types.
- Access to the shader's Vertex stage.