DirectX 1 0 / 1 1 Visual Effects Sim on Green, NVI DI A I - - PowerPoint PPT Presentation

directx 1 0 1 1 visual effects
SMART_READER_LITE
LIVE PREVIEW

DirectX 1 0 / 1 1 Visual Effects Sim on Green, NVI DI A I - - PowerPoint PPT Presentation

DirectX 1 0 / 1 1 Visual Effects Sim on Green, NVI DI A I ntroduction Graphics hardware feature set is starting to stabilize and mature New general-purpose compute functionality (DX11 CS) - enables new graphical effects - and


slide-1
SLIDE 1
slide-2
SLIDE 2

DirectX 1 0 / 1 1 Visual Effects

Sim on Green, NVI DI A

slide-3
SLIDE 3

I ntroduction

» Graphics hardware feature set is starting to stabilize and mature » New general-purpose compute functionality (DX11 CS)

  • enables new graphical effects
  • and allows more of game computation to

move to the GPU

Physics, AI, image processing

» Fast hardware graphics combined with compute is a powerful combination! » Next generation consoles will likely follow this path

slide-4
SLIDE 4

Overview

» Volumetric Particle Shadowing » Horizon Based Ambient Occlusion (HBAO) » DirectX 11 Compute Shader Effects

slide-5
SLIDE 5

Volum etric Particle Shadow ing

slide-6
SLIDE 6

Particle System s in Today’s Gam es

» Commonly used for smoke, explosions, spark effects » Typically use relatively small number of large particles (10,000s) » Rendered using point sprites with artist painted textures

Use animation / movies to hide large particles

» Sometimes include some lighting effects

normal mapping

» Don’t interact much with scene

slide-7
SLIDE 7

Particle System s in Today’s Gam es

» Can get some great effects with current technology » Game screen shot here (pending approval) » World in Conflict?

slide-8
SLIDE 8

Tom orrow ’s Particle System s

» Will likely be more similar to particle effects used in film » Millions of particles » Physically simulated

With artist control

» Interaction (collisions) with scene and characters » Simulation using custom compute shaders or physics middleware » High quality shading and shadowing

slide-9
SLIDE 9

Tom orrow ’s Particle System s - Exam ple

Low Viscosity Flow Simulations for Animation, Molemaker et al., 2008

slide-10
SLIDE 10

Volum e Shadow ing

» Shadows are very important for diffuse volumes like smoke

  • show density and shape

» Not much diffuse reflection from a cloud of smoke

  • traditional lighting doesn’t help

much

» Usually achieved in off-line rendering using deep shadow maps

  • still too expensive for real time
slide-11
SLIDE 11

Volum e Shadow ing

Before After

slide-12
SLIDE 12

Half-Angle Slice Rendering

» Very simple idea » Based on old volume rendering technique by Joe Kniss et. Al [ 1] » Only requires sorting particles along a given axis

  • you’re probably already doing this

» Plus a single 2D shadow texture

  • no 3D textures required

» Works well with simulation and sorting done on GPU (compute)

slide-13
SLIDE 13

Half-Angle Slice Rendering

» Calculate vector half way between light and view direction » Render particles in slices perpendicular to this half-angle vector

slide-14
SLIDE 14

Half-Angle Slice Rendering

» Same slices are visible to both camera and light » Lets us accumulate shadowing to shadow buffer at the same time as we are rendering to the screen

slide-15
SLIDE 15

Half-Angle Slice Rendering

» Need to change rendering direction (and blend mode) based on dot(l, v) » if (dot(l, v) > 0) - render front-to-back » if (dot(l,v ) < 0) – render back-to-front » Always render from front-to-back w.r.t. light

slide-16
SLIDE 16

Half-Angle Slice Rendering

» Sort particles along half-angle axis

  • based on dot(p, h)
  • can be done very quickly using compute

shader

» Choose a number of slices

  • more slices improves quality
  • but causes more draw calls and render

target switches

» batchSize = numParticles / numSlices » Render slices as batches of particles starting at i* batchSize » Render particles as billboards using GS

slide-17
SLIDE 17

Pseudo-Code

If (dot(v, l) > 0) { h = normalize(v + l) draw front-to-back } else { h = normalize(-v + l) draw back-to-front } sort particles along h batchSize = numParticles / numSlices for(i=0; i<numSlices; i++) { draw particles to screen looking up in shadow buffer draw particles to shadow buffer }

slide-18
SLIDE 18

Tricks

» Shadow buffer can be quite low resolution (e.g. 256 x 256) » Can also use final shadow buffer to shadow scene » Screen image can also be rendered at reduced resolution (2 or 4x) to reduce fill rate requirements » Can blur shadow buffer at each iteration to simulate scattering:

slide-19
SLIDE 19

W ithout Scattering

slide-20
SLIDE 20

W ith Scattering

slide-21
SLIDE 21

Dem o

slide-22
SLIDE 22

Volum e Shadow ing - Conclusion

» Very simple to add to existing particle system renderer » Only requires depth-sorting along a different axis

  • Can be done using CPU radix sort or

Compute

» Plus a single shadow map » Simulating particle systems on the GPU can enable millions of particles in real-time

slide-23
SLIDE 23

Horizon Based Am bient Occlusion

slide-24
SLIDE 24

Am bient Occlusion

» Simulates lighting from hemi-spherical sky light » Occlusion amount is % of rays that hit something within a given radius R » Usually solved offline using ray-tracing

scene

P

N

R

slide-25
SLIDE 25

Am bient Occlusion

» Gives perceptual clues to depth, curvature and spatial proximity

Without AO With AO

slide-26
SLIDE 26

Screen Space Am bient Occlusion

» Approach introduced by

[ Shanmugam and Orikan 07] [ Mittring 07] [ Fox and Compton 08]

» Input - Z-Buffer + normals

Render approximate AO for

dynamic scenes with no precomputations

» Z-Buffer = Height field

z = f(x,y)

eye image plane Z-Buffer

slide-27
SLIDE 27

Horizon Based Am bient Occlusion

» Screen Space Ambient Occlusion (SSAO) technique presented at SIGGRAPH'08 and in ShaderX7 [ 2] » HBAO Approach

Goal = approximate the result of ray

tracing the depth buffer in 2.5D

Based on ideas from horizon mapping

[ Max 1986]

slide-28
SLIDE 28

I ntegration in Gam es

» Implemented in DirectX 9 and DirectX 10 » Has been used successfully in several shipping games

slide-29
SLIDE 29

Ray Traced AO

Several minutes with Gelato and 64 rays per pixel

slide-30
SLIDE 30

HBAO w ith large radius

HBAO with 16x64 depth samples per pixel

slide-31
SLIDE 31

HBAO w ith large radius

HBAO with 16x16 depth samples per pixel

slide-32
SLIDE 32

“Crease shading” look with 6x6 depth samples per pixel

HBAO w ith sm all radius

slide-33
SLIDE 33

“Crease shading” look with 4x8 depth samples per pixel

HBAO w ith sm all radius

slide-34
SLIDE 34

HBAO Gam e Screenshots

» Screenshots pending approval

slide-35
SLIDE 35

Horizon Mapping

  • Given a 1D height field

P

  • Z

sampling direction

horizon angle +X

slide-36
SLIDE 36

Finding the Horizon

» March along the height field

P

  • Z

sampling direction

horizon angle +X S0

slide-37
SLIDE 37

Finding the Horizon

» Keeping track of maximum angle

P

  • Z

sampling direction

horizon angle +X S0 S1

slide-38
SLIDE 38

Finding the Horizon

P

  • Z

sampling direction

horizon angle +X S0 S1 S2

slide-39
SLIDE 39

Finding the Horizon

P

  • Z

sampling direction

horizon angle +X S0 S1 S2 S3

slide-40
SLIDE 40

Sam pling the Depth I m age

» Estimate occlusion by sampling depth image » Use uniform distribution of directions per pixel

Fixed number of

samples / dir

» Per-pixel randomization

Rotate directions by

random per-pixel angle

Jitter samples along ray

by a random offset

P u v

slide-41
SLIDE 41

Noise

» Per-pixel randomization generates visible noise

AO with 6 directions x 6 steps/dir

slide-42
SLIDE 42

Cross Bilateral Filter

» Blur the ambient occlusion to remove noise » Depth-dependent Gaussian blur

[ Petschnigg et al. 04]

[ Eisemann and Durand 04]

  • Reduces blurring across edges

» Although it is a non-separable filter, we apply it separately in the X and Y directions

No significant artifacts visible

slide-43
SLIDE 43

Cross Bilateral Filter

Without Blur With 15x15 Blur

slide-44
SLIDE 44

Half-Resolution AO

» AO is mostly low frequency

  • Can render the AO in half resolution
  • Source half-resolution depth image

» Still do the blur passes in full resolution

  • To avoid bleeding across edges
  • Source full resolution eye-space

depths [ Kopf et al. 07]

slide-45
SLIDE 45

Rendering Pipeline

Render opaque geometry

Render AO (Half or Full Res)

Blur AO in X Blur AO in Y Modulate Color (eye-space normals) eye-space depths colors Unprojection parameters (fovy and aspect ratio) Eye-space radius R Number of directions Number of steps / direction Kernel radius Spatial sigma Range sigma

slide-46
SLIDE 46

Half-Resolution AO 6x6 (36) samples / AO pixel No Blur

slide-47
SLIDE 47

Half-Resolution AO 6x6 (36) samples / AO pixel 15x15 Blur

slide-48
SLIDE 48

Full-Resolution AO 6x6 (36) samples / AO pixel 15x15 Blur

slide-49
SLIDE 49

Full-Resolution AO 16x16 (256) samples / pixel No Blur

slide-50
SLIDE 50

Full-Resolution AO 16x32 (512) samples / pixel No Blur

slide-51
SLIDE 51

Dem o

slide-52
SLIDE 52

HBAO - Conclusion

» DirectX10 SDK sample

Now available on developer.nvidia.com Including video and whitepaper

» DirectX9 and OpenGL samples to be released soon » Easy to integrate into a game engine

Rendered as a post-processing pass Only requires eye-space depths (normals can

be derived from depth)

» More details in ShaderX7 (to appear)

slide-53
SLIDE 53

Acknow ledgm ents

NVIDIA

Miguel Sainz, Louis Bavoil, Rouslan Dimitrov,

Samuel Gateau, Jon Jansen

Models

Dragon - Stanford 3D Scanning Repository Science-Fiction scene - Juan Carlos Silva

http: / / www.3drender.com/ challenges/ index.htm

Sibenik Cathedral - Marko Dabrovic

slide-54
SLIDE 54

References

1. Volume Rendering Techniques, Milan Ikits, Joe Kniss, Aaron Lefohn, Charles Hansen. Chapter 39, section 39.5.1, GPU Gems: Programming Techniques, Tips, and Tricks for Real-Time Graphics (2004). 2. BAVOIL, L., AND SAINZ, M. 2009. Image-space horizon-based ambient occlusion. In ShaderX7

  • Advanced Rendering Techniques.