Making of Delta Building Visualization enviorment w/ Compute - - PowerPoint PPT Presentation

making of delta building visualization enviorment w
SMART_READER_LITE
LIVE PREVIEW

Making of Delta Building Visualization enviorment w/ Compute - - PowerPoint PPT Presentation

Making of Delta Building Visualization enviorment w/ Compute Shaders Kristo Mnna Who am I Hobbyist solo game developer Unity3D Project POMPEII Delta building visualization project Who am I Hobbyist solo game developer Unity3D Who am I


slide-1
SLIDE 1

Making of Delta Building Visualization enviorment w/ Compute Shaders

Kristo Männa

slide-2
SLIDE 2

Who am I

Hobbyist solo game developer Unity3D Project POMPEII Delta building visualization project

slide-3
SLIDE 3

Who am I

Hobbyist solo game developer Unity3D

slide-4
SLIDE 4

Who am I

Hobbyist solo game developer Unity3D Project POMPEII

slide-5
SLIDE 5

Who am I

Hobbyist solo game developer Unity3D Project POMPEII Delta building visualization project

slide-6
SLIDE 6

Topics

What are compute shaders Introduction to compute shaders (using Unity) Breakdown of Delta Building Visualization effects

slide-7
SLIDE 7

Topics

What are compute shaders Introduction to compute shaders (using Unity) Breakdown of Delta Building Visualization effects

slide-8
SLIDE 8

Topics

What are compute shaders Introduction to compute shaders (using Unity) Breakdown of Delta Building Visualization effects

slide-9
SLIDE 9

Topics

What are compute shaders Introduction to compute shaders (using Unity) Breakdown of Delta Building Visualization effects

slide-10
SLIDE 10

What are compute shaders?

GPU is very good at parallel processing (like really good) This power is underutilized

slide-11
SLIDE 11

What are compute shaders?

GPU is very good at parallel processing (like really good) This power is underutilized Thats where Compute Shaders come in

slide-12
SLIDE 12

What are compute shaders?

GPU is very good at parallel processing (like really good) This power is underutilized Thats where Compute Shaders come in Use GPU for other things besides graphics

slide-13
SLIDE 13

What are compute shaders?

GPU is very good at parallel processing (like really good) This power is underutilized Thats where Compute Shaders come in Use GPU for other things besides graphics

slide-14
SLIDE 14

How to use a Compute Shader

slide-15
SLIDE 15

How to use a Compute Shader

Normal code vs. cs code

slide-16
SLIDE 16

How to use a Compute Shader

slide-17
SLIDE 17

How to use a Compute Shader

slide-18
SLIDE 18

How to use a Compute Shader

slide-19
SLIDE 19

How to use a Compute Shader

slide-20
SLIDE 20

How to use a Compute Shader

slide-21
SLIDE 21

When to use compute shaders

A lot of operations that can be done in parallel

slide-22
SLIDE 22

When to use compute shaders

A lot of operations that can be done in parallel

slide-23
SLIDE 23

When to use compute shaders

A lot of operations that can be done in parallel

slide-24
SLIDE 24

When to use compute shaders

A lot of operations that can be done in parallel

slide-25
SLIDE 25

When to use compute shaders

A lot of operations that can be done in parallel

slide-26
SLIDE 26

Quick demo Batch rendering in unity

slide-27
SLIDE 27

Quick demo - Batch rendering in unity

  • 100 x 100 = 100 000 objects
  • GPU: GTX 1070 TI
slide-28
SLIDE 28

Quick demo - Batch rendering in unity

  • 100k Capsule GameObjects
  • 30-40 fps
  • Can use Unity’s static batching
  • Best approach for lower end GPUs

Standard rendering

slide-29
SLIDE 29

Quick demo - Batch rendering in unity

  • 100k Capsule GameObjects
  • GPU Instancing enabled shaders
  • 50-60 fps
  • For lower end about the same performance as Standard
  • For Mid-Higher end meaningfully better

GPU Instanced rendering

slide-30
SLIDE 30

Quick demo - Batch rendering in unity

  • 100k Capsule meshes
  • Custom shaders
  • must call draw from code
  • 300-600 fps
  • For lower end can be worse that previous methods
  • For Mid-Higher end way better

Manual Instanced rendering

slide-31
SLIDE 31

Quick demo - Batch rendering in unity

  • 1 Million quads
  • Simpler, smaller mesh improves performance
  • Lighter shader improves performance

Manual Instanced rendering

slide-32
SLIDE 32

Delta Building Visualization project (DBV)

slide-33
SLIDE 33

DBV effects

  • Individually animated crowd rendering
  • Bonus: Bubbles
  • 1 million grass object rendering
  • Cloud shadows
  • Dynamic snow tracks
  • Falling snow
slide-34
SLIDE 34

DBV effects

  • Individually animated crowd rendering
  • Bonus: Bubbles
  • 1 million grass object rendering
  • Cloud shadows
  • Dynamic snow tracks
  • Falling snow
slide-35
SLIDE 35

DBV effects

  • Individually animated crowd rendering
  • Bonus: Bubbles
  • 1 million grass object rendering
  • Cloud shadows
  • Dynamic snow tracks
  • Falling snow
slide-36
SLIDE 36

DBV effects

  • Individually animated crowd rendering
  • Bonus: Bubbles
  • 1 million grass object rendering
  • Cloud shadows
  • Dynamic snow tracks
  • Falling snow
slide-37
SLIDE 37

DBV effects

  • Individually animated crowd rendering
  • Bonus: Bubbles
  • 1 million grass object rendering
  • Cloud shadows
  • Dynamic snow tracks
  • Falling snow
slide-38
SLIDE 38

DBV effects

  • Individually animated crowd rendering
  • Bonus: Bubbles
  • 1 million grass object rendering
  • Cloud shadows
  • Dynamic snow tracks
  • Falling snow
slide-39
SLIDE 39

2000 Animated Agent rendering

Requirements:

  • max 2000 actors → max visible actors ~1500
  • Every actor has animations
  • Need to render them all
slide-40
SLIDE 40

2000 Animated Agent rendering

Naive approach: 1. Have two gameObject pools

a. Far away actors b. Close animated actors

2. Based on distance to camera render actors with objects from first or second pool

  • Very slow for 50+ animators
slide-41
SLIDE 41

2000 Animated Agent rendering

Used approach: 1. Bake animations to a texture 2. Only have one pool for all actors 3. Render visible actors with that pool

slide-42
SLIDE 42

Bubbles

Requirements:

  • Actors sometimes create bubbles
  • Bubbles are animated
  • max 500 bubbles at once

Used approach:

  • GPU instanced billboard shader
  • Bubble pool
  • Simple procedural scale animations
slide-43
SLIDE 43

1 Million grass object rendering

Requirements:

  • There is some grass outside the building
  • Would be nice if it looked like real grass
  • Need to handle 1 million grass objects
slide-44
SLIDE 44

1 Million grass object rendering

Naive approach: 1. Place down GPU instanced grass GameObjects 2. Let unity handle culling and batching Works okay for sub 10 000 grass objects ...but we need 1 million

slide-45
SLIDE 45

1 Million grass object rendering

Used approach: 1. Bake grass object positions 2. Using compute shader apply:

a. Frustum culling b. Distance culling c. 3D dither distance culling

3. Render visible with Graphics.DrawMeshInstanced()

slide-46
SLIDE 46

1 Million grass object rendering

slide-47
SLIDE 47

1 Million grass object rendering

slide-48
SLIDE 48

1 Million grass object rendering

slide-49
SLIDE 49

Cloud shadows

Requirements:

  • Would be nice if could visualize cloudiness somehow

Naive approach:

  • Use Unity’s projector component to render cloud shadows onto ground
  • Will have to affected objects twice

Used approach:

  • Same as naive
  • Ok since only one object to re-render
slide-50
SLIDE 50

Cloud shadows

slide-51
SLIDE 51

Dynamic snow tracks

Requirements:

  • Would be nice if could visualize snow tracks for actors
  • Will need to create tracks for 2000 actors every frame
slide-52
SLIDE 52

Dynamic snow tracks

Used approach: 1. Send actor positions to compute shader 2. Draw to splatmap 3. Tessellate a plane 4. Use vertex displacement

slide-53
SLIDE 53

Dynamic snow tracks

Requirements:

  • Would be nice if could visualize snow tracks for actors
  • Will need to create tracks for 2000 actors every frame
slide-54
SLIDE 54

Dynamic snow tracks

slide-55
SLIDE 55

Dynamic snow tracks

slide-56
SLIDE 56

Snowflakes

Naive approach:

  • Use Unity’s particle system
  • Very slow for 1000+ particles since CPU based
slide-57
SLIDE 57

Snowflakes

Used approach

  • Using compute shader cull and apply velocity to particles
  • Use DrawMeshInstanced() to draw visible snowflakes
slide-58
SLIDE 58

Conclusion

Learned about: 1. Compute shaders 2. How and where to use them 3. Breakdown of some simple DBV effects

slide-59
SLIDE 59

Any final questions?

slide-60
SLIDE 60

Peace!