Interested in creating film-like effects such as fire, smoke or holograms in Unity? At Unite Copenhagen, this session showed how to use node-based effects and adaptive features in Unity's Visual Effect Graph to create striking VFX in real-time. VFX Graph is out of Preview in 19.3.
Speaker: Vlad Neykov – Unity
Watch the session on YouTube: https://youtu.be/POLFhSOiWms
3. Overview
3
Next Generation Visual Effect tool for Unity
Self contained template Assets with Event and Parameter interface
Tailored for Next-Generation platforms (GPU/Compute)
Powered by SRP
4. 4
PARTICLE COUNT Thousands Millions
SIMULATION Simple Complex
PHYSICS Underlying Physics System
- Scene Representation (primitives, SDF…)
- Depth Buffer
GAMEPLAY READBACK Yes No*
* Potentially small data with latency
OTHER - Can read Frame Buffers
CPU GPU
Comparison
5. 5
How many particles?
What are their initial
values?
How do they behave
over time?
How are they rendered?
Flow
Next gen tool for authoring VFX in Unity
VFX exist as assets in the project folder, and can be controlled via other areas within Unity, timeline, inspector, via script, etc.
Designed to work with the new Scriptable Render Pipelines. Shaders can be modified to work for the built-in rendering pipeline, but not officially supported
Runs on compute-capable devices. Plans for CPU particles to broaden the range of platforms.
Quick comparison between the built-in Shuriken particle system (CPU) and the VFX Graph (GPU)
Pros and Cons in both approaches:
Number of particles
Types of simulation
Physics, CPU interact with the world, GPU needs scene representation
CPU particles can easily querry what each particle’s values are, for GPU particles it is more expensive and potentially possible for small data with some latency
Have access to the camera buffers (depth, color, etc.)
As mentioned, we do plan on supporting CPU particles in the VFX graph down the road
Lots of info, blog posts, tutorials. Quick overview: contextual nodes, or contexts, data flow, top to bottom.
Can get more complex. Added subgraphs in 19.2 to help organize graphs.
Many of these are available as samples
Graph: context, blocks, nodes - a high level overview, what the user sees
Expression Graph: Generating an expression graph - low level representation
VFX Compiler: Compiler generates runtime data, we use a lot
Shaders:
compute for simulation
vertex/pixel shader pairs for rendering
CPU interpreter: Some calculations are better off being calculated once per frame on the CPU rather than once per particle on the GPU
Unexposed parameters whose values we can determine at compilation time are constant folded
Data Layout: only include what is needed. If a system is not using velocity, we won’t store it
Property Sheet: access exposed parameters by name, allows overwriting from script or via timeline, and also per-component
List of VFX Systems: bind everything together and issue commands to our VFX manager
Two types of data, one for ease of use within the editor, the other for optimization