UnityRef is currently in early development. Some features may be incomplete and/or not functioning.

UNITYREF

Your Pit Stop For Solving ANYTHING in Unity

graphics

[VFX] Drive Shader Graph Properties with Particle Attributes

Solution

shader graphvfx graphparticlesrenderingshadersvisual effects

Unity 2019.3.x - Unity 6.3.x

Published 9 days ago

Issue

 Accessing internal VFX Graph attributes like color or custom data within a Shader Graph is necessary for advanced particle effects and per-particle rendering logic.

Explanation

Communication between a Shader Graph and a VFX Graph is established by mapping Exposed properties to specific particle data streams. This allows particle-specific attributes, such as color or texIndex, to drive the visual output of custom shaders.

  1. Open your Shader Graph and define new properties in the Blackboard.
  2. In the Graph Inspector, ensure that the Exposed checkbox is enabled for every property intended for VFX Graph control.
  3. Save your Shader Graph asset to update its metadata.
  4. Open your VFX Graph and select the Output Particle context.
  5. Assign your Shader Graph to the Shader property slot within that context.
  6. Create a Get Attribute node or drag an attribute directly from the VFX Graph Blackboard into the graph.
  7. Connect the attribute output to the corresponding Exposed property port appearing on the Output Particle block.

Additional Tips

  • Dragging an attribute from the Blackboard in Unity 6 automatically generates the correct Get Attribute node for a faster workflow.
  • Ensure data types match between systems; for example, a Vector4 attribute should map to a Vector4 Exposed property to avoid conversion errors.
  • Use the Property Overrides section in the VFX Graph if you need to apply global constants to the shader instead of per-particle data.

TL;DR

Map Exposed shader properties to particle attributes using Get Attribute nodes in the VFX Graph to sync data between systems.


Related Posts Haven't quite found a solution to your problem? We think these posts might help you.

Content inspired by a Unity discussion post.