visual effect graph - unite seoul · parameter interface programmable, hybrid, stack/node-based...

61

Upload: others

Post on 08-Jul-2020

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship
Page 2: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Visual Effect Graph

Julien FRYER @JulienFryer Graphics Engineer

Thomas ICHÉ @peeweekVFX Visual Effect Artist

Unite Seoul 2019

Page 3: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Visual Effect Graph

3

— Concepts and Philosophy

— Technical Overview

— Spaceship Demo : Pin Screen VFX Breakdown

— Roadmap

Page 5: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Replace with image

Visual Effect Graph

5

Next Generation Visual Effects tool for Unity

Tailored for Next-Generation platforms (GPU/Compute)

Self-contained asset templates with Event and Parameter interface

Programmable, hybrid, Stack/Node-Based Effect behaviors

Page 6: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Replace with image

Goals and Philosophy

6

Industry trend : Programmable effect behaviors

Scalability of FX: from small to very large, from simple to complex

Artist friendly / Data Driven

Scalability of features: compiled vs composed

Page 7: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

7

CPU GPU

PARTICLE COUNT Thousands Millions

SIMULATION Simple Complex

PHYSICS Underlying Physics System• Primitives• Scene Representation (SDF…)• Depth Buffer

GAMEPLAY READBACK Yes No** Potentially small data with latency

OTHER Can read Frame Buffers-

CPU vs GPU Particles

Page 8: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Concept and Philosophy

Page 9: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

9

0

Asset Instance Configuration● Use Template in Scenes● Edit Parameters● Call Events● C# Scripting

Levels of Editing

Page 10: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

10

Graph Asset Authoring● Author Effect Behaviors● Define Events● Setup Parameter Interface

1

Levels of Editing

Page 11: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

11

2

Feature Creation/Editing● Author New Features● Improve Library

Levels of Editing

Page 12: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Logic Flow● Chained States (Contexts)● Contexts made of Blocks● Blocks can be parametrized

Graph Flow

Page 13: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Logic Flow● Chained States (Contexts)● Contexts made of Blocks● Blocks can be parametrized

SpawnHow many particles?

InitializeWhat are their initial values?

UpdateHow do they behave over time?

OutputHow are they rendered?

Page 14: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Node Blocks● Reorderable Stack● Define Context Behaviour● Alter Simulation Attributes● Expose Slots that can be fed by

operators

Blocks

Page 15: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Logic Flow● Chained States (Contexts)● Contexts made of Blocks● Blocks can be parametrized

Operator Flow● Chained Operators● Access to Simulation Attributes● Can Scale CPU/GPU (per-element)

Page 16: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Attributes

16

— Define Particle State

— Stored only if needed by processing

— Standard Attributes (position, color, …)

— Custom Named Attributes

Generic Read/Write System from various Modes (Constant/Random/Curve/Texture)

Page 17: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Parameter Interface● Defined in Blackboard● Exposed at Component Level● Access to Parameters in Graph● Edit Gizmos in Scene

Page 18: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Parameter Interface● Defined in Blackboard● Exposed at Component Level● Access to Parameters in Graph● Edit Gizmos in Scene

Page 19: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Parameter Interface● Defined in Blackboard● Exposed at Component Level● Access to Parameters in Graph● Edit Gizmos in Scene

Page 20: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Parameter Interface● Defined in Blackboard● Exposed at Component Level● Access to Parameters in Graph● Edit Gizmos in Scene

Page 21: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Events● Default OnPlay / OnStop● Custom Named Events● Event Attribute Payload● C# API● Timeline Integration

Events

Page 22: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

22

Technical Overview

Page 23: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

VFX Compilation

23

High level graph model

< Expression Graph

— Data layout (buffer description)— Shaders (Compute for simulation, VS/PS for rendering)— Bytecode for our CPU interpreter— PropertySheet (inputs and exposed parameters)— VFXSystems description

Target < 500 ms for compilation

Page 24: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Expression Graph

24

Graph from the pink Unity logo sample

Page 25: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Expression Graph

25

particle attributes reads

Page 26: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Expression Graph

26

Evaluated on GPU: Generates shader code

Page 27: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Expression Graph

27

Evaluated on CPU: Generates interpreter bytecode

Page 28: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Expression Graph

28

FX time is not known at compile time

Page 29: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Expression Graph

29

Exposed parameter can be overriden per instance or via script

Page 30: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Expression Graph

30

Unknown at compile time: Evaluated at runtime

Statically known at compile time: Constant folded

Page 31: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Expression Graph - Low level

31

— Intermediate language

— Abstract representation allows several backends (CPU particles but not yet…)

Page 32: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Expression Graph - Low level

32

— 2 versions of runtime data

– Edition - All inputs are accessible

– Runtime - Constant folded graph and optimized effect

Page 33: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Rendering

33

— Built-in primitives

– Points, lines, quads, octagon, hexahedron, meshes...

— Built-in shaders

– HDRP Lit, Unlit, Decals (Hexahedron), ray-traced spheres (Quads)...

– Features: soft particles, flipbook blending…

— We need shader graph integration with VFX graph (2019.3)

Page 34: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

34

Point Line Quad Cube Mesh

Decal Sphere Lit Quad Lit Cube Lit Mesh

Rendering - output types

Page 35: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Sorting

35

— Rendering order hell with transparent objects

— We didn’t sort that out… (no OIT or global per particle sorting)

— …instead we gave controls at different granularity (per component / per system / per particle)

— GPU Sorting for per particle sorting

Page 36: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Input Data

36

— Textures and buffers on GPU

— Generated constant buffers for expressions values

— Curve and gradient baked in a generated texture

— Point caches: attributes packed in textures

— Volumetric data as texture3D + oriented box– Vector field: forces

– SDF: collision and conformance

Page 39: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

VFX Toolbox

39

— A suite of tools to generate data– Houdini exporters for SDF, Vector Fields, point cache– Point cache baker from mesh– Image sequencer for flipbooks

Page 40: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

40

Breakdown

Looking into Spaceship Demo

Page 43: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

43

Let’s Break it Down( Hey ! We even made a public sample for this ! )

Page 44: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Control Room : Scene Setup

44

— Scene Setup

– Holographic Table (2 Lights + 1 VFX)

– Simple Animation

– Pin Screen Effect : 1 Visual Effect

— PinScreen VFX

– Only 1 System

– Multiple Outputs : Pins, Caps and Rays

– Custom Update

Page 45: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

45

Visual Effect Overview

Page 46: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

PinScreen VFX : In a nutshell (1/2)

46

— Spawn : Simple Burst : count = 65536

— Initialize:

– position From pCache Attribute Map + backup in BasePosition

– Everlasting particles (no lifetime Attribute)

— Update:

– Simulate Heightfield animation in position Attribute

– Sum of position offsets : HeightField, Wave, Glitch

– Blend position : smooth animation

– No Aging / Reaping / Velocity Integration

Page 47: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

PinScreen VFX : In a nutshell (2/2)

47

— For each Pin : Multiple Outputs

– Cap : Lit quad / At position / Facing World Up

– Pin : Lit quad / stretched between position and BasePosition

— Light Rays :

– Start at position / Stretches towards upper source

– Scale based on pin height or cull if pin is too small

Page 48: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

48

Breaking Down MechanicsOne feature at a time

Page 49: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Spawn On Point Cache

49

— pCache File : 65536 items

– Baked in Houdini

– Relax Iterations

– Custom Sorting

— Initialize:

– Read Position in Cache based on particleID

– Back-up initial position in BasePosition (Custom Attribute)

Page 50: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Heightfield Push

50

— Compute 2D Sample Position

– Based on BasePosition.xy (World .zx)

– Apply Scale + Bias based on World-Space AABoxControl parameter

— Sample HeightField:

– Use Texture Sample Operator (SampleLOD)

— Scale Pin Heights:

– Use Reference Height to scale input (read from Texture) value.

– Scale Height based on Distance to Table Center : Curve Mapped

Page 51: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Scan Wave

51

— Inner > Outer Animation

– 1D Coordinate : Distance to center + Time Cycle

– 1D Coordinate Samples Curve to get Height

— Adding Noise:

– Modify 1D Coordinate by adding noise offset.

– 3D Noise :

– XZ : 2D Coordinates

– Y : Time

Page 52: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Glitches

52

— 3D Offset on Pins

– 2D Polar Coordinate

– Samples 2D Texture : use XYZ value as offset for the pin tip.

– Unsigned normalized (centered on 0.5)

— Coordinate Computation

– Add 2D Noise to XZ Coordinate (Offset)

– 2D Rectangular to Radial conversion

Page 53: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

53

Scene Control / Sequencing

Page 54: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

PinScreen VFX : Scene Control

54

— Exposed Parameters :

– AABoxControl : Axis Aligned Box

– _center : Bound by rig GameObject using ParamterBinder

– _size : Used By Animation

— Lighting :

– Fixed : One Top Spotlight + One Cyan PointLight

– Animated Pointlight (Red, Toggled in Animation)

— Animation/Sequencing :

– Simple Animation : Controls 1 Vector Parameter + 1 GameObject (Parameter Binder)

Page 55: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

55

Rendering Pin Screen

Page 56: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

PinScreen VFX : Rendering Pins

56

— All Opaque :

– 2 DrawCalls : 1 Quad (Tip) + 1 Quad (Body) : 8vx/pin

– Normals : Fake volume / Cast Shadows + Contact Shadows

– Transmission + Fake Occlusion gradient in BC

— Light Rays :

– Potential Frame rate Killer : Additive Blending

– Only one ray out of 15 pins

– Camera Fade for near particles (Fade + Cull)

Page 57: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

57

Roadmap

Page 58: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Roadmap

58

— 2019.2

– Improved HDRP integration

– Subgraphs

– Static mesh sampling

– Motion vectors

– LWRP lit support (compute only)

– Ribbon/trails

Page 59: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Roadmap

59

— 2019.3 - Target Out of Preview

– Shader graph integration

– Skinned mesh sampling

– Profiling/debugging tools

Page 60: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

We need your feedback!

60

— Join the discussions on the forums

– https://forum.unity.com/threads/feedback-wanted-visual-effect-graph.572110/

— Follow the devs on Twitter:

– @JulienFryer

– @PaulDemeulenaer

– @peeweekVFX

– @iTris666

– @VladimirNeykov

— #vfx channel on Unity Community Discord

Page 61: Visual Effect Graph - Unite Seoul · Parameter interface Programmable, hybrid, Stack/Node-Based Effect behaviors. Replace with image Goals and Philosophy 6 ... Looking into Spaceship

Thank You!Time for some Q&A?

Download this sample and 9 others for 2019.1 at :https://github.com/Unity-Technologies/VisualEffectGraph-Samples