Transcript
Page 1: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

www.nvidia.com/GDC

Morgan McGuire | April 2019

DYNAMIC DIFFUSE GLOBAL ILLUMINATIONWITH RAY-TRACED IRRADIANCE FIELDS

Page 2: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

2

Page 3: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

3

DIRECT

Page 4: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

4

DIRECT + DIFFUSE GI

Page 5: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

5

DIRECT + DIFFUSE GI + VOLUMETRIC

Page 6: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

6

DIRECT + DIFFUSE GI + VOLUMETRIC + GLOSSY GI

Page 7: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

7

DIRECT + DIFFUSE GI + VOLUMETRIC + GLOSSY GI + MATERIALS

Diffuse GI: 1.0 ms/frameGlossy GI: 1.1 ms/frameThroughput: 1.5 Grays/s

GeForce RTX 2080 Ti @ 1080p

Page 8: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

8

DIRECT + DIFFUSE GI + VOLUMETRIC + GLOSSY GI + MATERIALS

Diffuse GI: 1.0 ms/frameGlossy GI: 1.1 ms/frameThroughput: 1.5 Grays/s

GeForce RTX 2080 Ti @ 1080p

Page 9: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

9

BEFORE: NO GLOBAL ILLUMINATION

Page 10: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

10

BEFORE: CLASSIC PROBES

Page 11: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

11

AFTER: NEW DYNAMIC DIFFUSE GI

Page 12: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

12

MOVING CAMERA, GEOMETRY, AND LIGHTS…

Page 13: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

13

OVERVIEW

1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred)

Runs everywhere, best quality on RTX. Constant performance, varying indirect light latency across platforms.

Uses existing engine data paths, no bake time, minimizes leaks and noise. Good artist workflow.

Fresh out of the lab after six years of R&D with academic collaborators [Mara 2012, Crassin 2013, Evangelakos 2015, Donow 2016, McGuire 2017, Wang 2019, Majercik 2019]

Working with partners on game integration and art team feedback now.

No patents on the algorithm. No SDK or licensing.

Dynamic Diffuse Global Illumination with Ray Traced Irradiance Fields

Page 14: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

14

AGENDA

1. Global Illumination Overview

2. Glossy GI Best Practices

3. The Diffuse GI challenge

4. New Dynamic Diffuse GI

5. Engine Integration

6. Examples & Demo

Page 15: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

15

AGENDA

1. Global Illumination Overview

2. Glossy GI Best Practices

3. The Diffuse GI challenge

4. New Dynamic Diffuse GI

5. Engine Integration

6. Examples & Demo

Everybody

Art Director,Project Manager

Programmers

Page 16: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

16

GLOBAL ILLUMINATION

Page 17: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

17

DIRECT ILLUMINATION

Direct illumination:

straight from the emitterEmitter

Camera

Direct

Direct

Page 18: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

18

DIRECT ILLUMINATION

Direct illumination:

straight from the light emitterEmitter

Camera

PrimarySurface

PrimarySurface

Direct

Direct

Page 19: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

19

DIRECT ILLUMINATION

Direct illumination:

straight from the light emitterLight

Camera

PrimarySurface

PrimarySurface

Page 20: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

20

DIRECT ILLUMINATION

Direct illumination:

straight from the light emitterEmitter

Camera

PrimarySurface

PrimarySurface

Direct

Direct

Page 21: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

21

GLOBAL ILLUMINATION

Direct illumination:

straight from the light emitter

Global illumination:

bounces off at least one other surface

Emitter

Camera

PrimarySurface

PrimarySurface

SecondarySurface

Direct

Direct

Direct

Global

Page 22: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

22

GLOBAL ILLUMINATION

Direct illumination:

straight from the light emitter

Global illumination:

bounces off at least one other surface

Light

Camera

PrimarySurface

PrimarySurface

SecondarySurface

Page 23: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

23

GLOBAL ILLUMINATION

Direct illumination:

straight from the light source

Global illumination:

bounces off at least one other surface

Visibility:

unobstructed line of sight

primary surface: visibility to camera

direct shadow: visibility to emitter

G.I. “visibility”: any two points

Emitter

Camera

PrimarySurface

PrimarySurface

SecondarySurface

Global

Direct

Direct

Direct

Page 24: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

24

GLOBAL ILLUMINATION

Direct illumination:

straight from the light source

Global illumination:

bounces off at least one other surface

Visibility:

unobstructed line of sight

primary surface: visibility to camera

direct shadow: visibility to emitter

G.I. “visibility”: any two points

Emitter

Camera

PrimarySurface

PrimarySurface

SecondarySurface

Global

Direct

Direct

Direct

x x

Page 25: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

25

GLOSSY REFLECTION

Glossy Reflection:

(e.g., specular, microfacet, GGX, etc.)

- reflects off the surface

- only visible near mirror angle

Light

Glossy Reflection

Page 26: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

26

GLOSSY REFLECTION

Glossy Reflection:

(e.g., specular, microfacet, GGX, etc.)

- reflects off the surface

- only visible near mirror angle

Light

Glossy Reflection

Page 27: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

27

DIFFUSE REFLECTION

Glossy Reflection:

(e.g., specular, microfacet, GGX, etc.)

- reflects off the surface

- only visible near mirror angle

Diffuse Reflection:

(e.g., matte, Lambertian, etc.)

- scatters just below the surface

- visible from all directions

Light

Glossy Reflection

Diffuse Reflection

Page 28: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

28

DIFFUSE REFLECTION

Glossy Reflection:

(e.g., specular, microfacet, GGX, etc.)

- reflects off the surface

- only visible near mirror angle

Diffuse Reflection:

(e.g., matte, Lambertian, etc.)

- scatters just below the surface

- visible from all directions

Light

Glossy Reflection

Diffuse Reflection

Page 29: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

29

Glossy Reflection:

(e.g., specular, microfacet, GGX, etc.)

- reflects off the surface

- only visible near mirror angle

Diffuse Reflection:

(e.g., matte, Lambertian, etc.)

- scatters just below the surface

- visible from all directions

Light

Glossy Reflection

Diffuse Reflection

Today: Dynamic Diffuse Global Illumination with correct Visibility

Page 30: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

30

GLOSSY GISTATE OF THE ART

Page 31: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

31

GLOSSY GIBattlefield V Metro: Exodus

Killzone: Shadow FallControl

State of the Art

Page 32: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

32

GLOSSY GI

1. Ray TraceTrace and shade perfect mirror rays at full

resolution X, ½ resolution Y

2. BlurBilateral filter into MIPs, respecting edges

3. SampleSample in screen-space based on primary roughness and total reflection distance

1.1 ms/frame in our simple demo, including BVH update

Page 33: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

34

GLOSSY GI IMPLEMENTATION

Heavy lifting is all in your existing forward or deferred shader, which runs on ray hits. Uses shadow maps, regular materials, etc. so no special shading code for the base implementation.

We use half resolution only vertically because that gives a good performance to quality tradeoff on high-end hardware. Most reflections are on floors, and they’ll be blurred vertically in screen space anyway.

Stretch to full resolution and bilateral blur into MIP-maps. Gaussian kernel, normal & depth weighting. Expand out into untraced areas so that trilinear fetches don’t hit black. MIP generation is about 0.1 ms of total time.

When rendering the camera view, compute MIP level to gather from smoothness, distance to primary surface + distance to reflected surface. Produces proper distance fading.

To improve quality: address flicker. final-frame TAA can help and hurt. Use everything you know about filtering and flickering inside the glossy shader: MIP bias, bump to roughness, TAA/FXAA on the glossy trace, LOD.

Can optimize down to about 0.5 ms/frame (see Battlefield V): Combine with screen-space ray tracing and environment maps, use geometric and material level of detail, apply checkerboarding plus upsampling, DLSS.

Page 34: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

35

DIFFUSE GISTATE OF THE ART

Page 35: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

36

STATE OF THE ART

Baked light maps

Light propagation volumes

Sparse voxel cone tracing

Denoised ray tracing

Baked irradiance probes

Real-Time Diffuse GI

Page 36: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

37

IRRADIANCE PROBES

Image Credits: Geomerics and Ninja Theory, https://unity3d.com/learn/tutorials/topics/graphics/probe-lighting,https://docs.unrealengine.com/en-us/Engine/Rendering/LightingAndShadows/IndirectLightingCache, https://unity3d.com/learn/tutorials/topics/graphics/probe-lighting

Enlighten Unity

Dunia (Far Cry engine)Unreal Engine

Page 37: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

38

LIGHT & SHADOW LEAKS

[Hooker 2016]

Page 38: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

39

LIGHT & SHADOW LEAKS

[Iwanicky 2013]

Image Sources: https://forums.unrealengine.com/development-discussion/content-creation/18712-need-help-how-to-fix-the-light-under-walls, https://answers.unrealengine.com/questions/336484/light-

leaking-problem-solid-geometry.html, https://www.worldofleveldesign.com/categories/udk/udk-lightmaps-03-how-to-fix-light-shadow-lightmap-bleeds-and-seams.php

[Rakhteenko 2018]

Page 39: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

40

NEW: DYNAMIC DIFFUSE GIWITH RAY-TRACED IRRADIANCE FIELDS

Page 40: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

42

UPGRADING PROBES WITH VISIBILITY

Classic Probes: Fast to sample, noise-free, work with characters and transparents, parameterization-free, already in your engine.

Upgrade:

Leaks: Store visibility information to prevent light and shadow leaking.

Dynamic: Asynchronous GPU ray trace directly into low resolution probes, gather blending

Workflow: Art cost is in avoiding leaks and bake time. Real-time + no leaks fixes worflow.

Page 41: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

43

Page 42: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

44

PROBE PLACEMENT

[Kaplanyan and Dachsbacher 2010] [Asirvatham and Hoppe 2005]

Grid

Optionally optimize around static geo [Chajdas 2011, Donow 2016, Wang et al. 2019, Unity]

Artists may override placement

Cascades

32 x 4 x 32 = 4 k probes around the camera that update frequently.

Coarse cascades in space and time to scale out to big scenes.

Top View

Page 43: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

45

DATA STRUCTURE

RG16F Depth: (radius, radius2) 16x16-texel probe

6x6-texel probe

32x32-probe scene layer

R11G11B10F Irradiance

5 MB GPU RAM for 8k Probes

Page 44: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

46

DYNAMIC DIFFUSE GI

1. Ray TraceTrace and shade packed rays from active probes.(Pack into the bottom of the Glossy GI ray pass)

Uses previous iteration for shading: infinite bounce GI.

2. BlendBlend irradiance and depth into probes.

Duplicate probe border texels for fast bilinear.

3. SampleVolumetric sample based on 3D position,

visibility, and normal.

Independent of framerate and screen resolution

Page 45: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

47

ACCURATE & NOISE FREE

Direct Direct

Global Global

Page 46: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

48

ACCURATE & NOISE FREE

Path Tracing Dynamic Diffuse GI

Page 47: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

49

REALISTIC

Direct Illumination Only + Dynamic Diffuse GI

Page 48: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

50

REALISTIC

Direct Illumination Only + Dynamic Diffuse GI

Page 49: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

51

REALISTIC

Direct Illumination Only + Dynamic Diffuse GI

Page 50: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

52

DYNAMIC LIGHTINGEveningAfternoon

Page 51: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

53

LARGE SCENES

Page 52: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

54

DYNAMIC GEOMETRY

Page 53: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

55

DYNAMIC GEOMETRY

Page 54: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

56

AVOIDS LEAKS

Page 55: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

57

AVOIDS LEAKS

[Hooker 2016]

Page 56: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

58

AVOIDS LEAKSBefore: Classic Probes After: Dynamic Diffuse GI

Light leak

Shadow leak

Correct

Correct

Correct

Page 57: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

59

AVOIDS LEAKS

Light leak

Shadow leak

Correct

Before: Classic Probes After: Dynamic Diffuse GI

Page 58: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

60

AVOIDS LEAKS

Light leak Correct

Before: Classic Probes After: Dynamic Diffuse GI

Page 59: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

61

LIMITATIONS

Self-shadow bias must be tuned to geometry thickness

Light crossfades in time under dramatic changes

Blurrier than light maps (use screen-space AO for contact shadows)

Page 60: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

62

ENGINE INTEGRATION

Page 61: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

63

RADIAL GAUSSIAN DEPTH

Encoding Visibility

Page 62: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

64

RADIAL GAUSSIAN DEPTH

Encoding Visibility

Page 63: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

65

RADIAL GAUSSIAN DEPTH

Encoding Visibility

Page 64: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

66

RADIAL GAUSSIAN DEPTH

Encoding Visibility

Page 65: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

67

RADIAL GAUSSIAN DEPTH

Encoding Visibility

μ

σ

r0

r1 r2

r4

r5

r6

Page 66: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

68

RADIAL GAUSSIAN DEPTH

Encoding Visibility

Mean:μ = ∑r / n

Standard Deviation:

σ = sqrt(∑(r - μ) 2 / n) = sqrt((∑r2) / n - μ2)

Each probe texel stores (∑r, ∑r2)

μ

σ

r0

r1 r2

r4

r5

r6

Irradiance blurs over a cosine-weighted hemisphere in a gather pass.

Blur depth over a power-cosine to capture variation but retain some sharpness.

Page 67: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

69

READING IRRADIANCE// float3 n = shading normal, X = shading point

X

n

Page 68: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

70

READING IRRADIANCE// float3 n = shading normal, X = shading point, P = probe location

P

X

n

Page 69: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

71

READING IRRADIANCE// float3 n = shading normal, X = shading point, P = probe location

float4 irradiance = float4(0);for (each of 8 probes around X) {

float3 dir = P – X;float r = length(dir);dir *= 1.0 / r;

// smooth backfacefloat weight = (dot(dir, n) + 1) * 0.5;

// adjacencyweight *= trilinear(P, X);

// visibility (Chebyshev)float2 temp = texelFetch(depthTex, probeCoord).rg;float mean = temp.r, mean2 = temp.g;if (r > mean) {

float variance = abs(square(mean) – mean2);weight *= variance / (variance + square(r – mean));

}irradiance += sqrt(texelFetch(colorTex, probeCoord) * weight;

}

return square(irradiance.rgb * (1.0 / irradiance.a));

P

X

n

dir

r

1

2

3

Page 70: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

72

READING IRRADIANCE// float3 n = shading normal, X = shading point, P = probe location

float4 irradiance = float4(0);for (each of 8 probes around X) {

float3 dir = P – X;float r = length(dir);dir *= 1.0 / r;

// smooth backfacefloat weight = (dot(dir, n) + 1) * 0.5;

// adjacencyweight *= trilinear(P, X);

// visibility (Chebyshev)float2 temp = texelFetch(depthTex, probeCoord).rg;float mean = temp.r, mean2 = temp.g;if (r > mean) {

float variance = abs(square(mean) – mean2);weight *= variance / (variance + square(r – mean));

}irradiance += sqrt(texelFetch(colorTex, probeCoord) * weight;

}

return square(irradiance.rgb * (1.0 / irradiance.a));

P

X

n

dir

r

1

2

3

Page 71: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

73

READING IRRADIANCE// float3 n = shading normal, X = shading point, P = probe location

float4 irradiance = float4(0);for (each of 8 probes around X) {

float3 dir = P – X;float r = length(dir);dir *= 1.0 / r;

// smooth backfacefloat weight = (dot(dir, n) + 1) * 0.5;

// adjacencyweight *= trilinear(P, X);

// visibility (Chebyshev)float2 temp = texelFetch(depthTex, probeCoord).rg;float mean = temp.r, mean2 = temp.g;if (r > mean) {

float variance = abs(square(mean) – mean2);weight *= variance / (variance + square(r – mean));

}irradiance += sqrt(texelFetch(colorTex, probeCoord) * weight;

}

return square(irradiance.rgb * (1.0 / irradiance.a));

P

X

n

dir

r

1

2

3

Page 72: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

74

READING IRRADIANCE// float3 n = shading normal, X = shading point, P = probe location

float4 irradiance = float4(0);for (each of 8 probes around X) {

float3 dir = P – X;float r = length(dir);dir *= 1.0 / r;

// smooth backfacefloat weight = (dot(dir, n) + 1) * 0.5;

// adjacencyweight *= trilinear(P, X);

// visibility (Chebyshev)float2 temp = texelFetch(depthTex, probeCoord).rg;float mean = temp.r, mean2 = temp.g;if (r > mean) {

float variance = abs(square(mean) – mean2);weight *= variance / (variance + square(r – mean));

}irradiance += sqrt(texelFetch(colorTex, probeCoord) * weight;

}

return square(irradiance.rgb * (1.0 / irradiance.a));

P

X

n

dir

r

1

2

3

Page 73: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

75

READING IRRADIANCE

// float3 n = shading normal, X = shading point, P = probe location// threshold = low-perception threshold (around 0.2)X += bias * (n - viewVector)float4 irradiance = float4(0);float4 irradianceNoCheb = float4(0);for (each of 8 probes around X) {

// smooth backfacefloat weight = square( (dot(dir, n) + 1) * 0.5 ) + 0.2;

// adjacencyweight *= trilinear(P, X) + 0.001;

// visibility (Chebyshev)…if (weight < threshold)

weight *= square(weight) / square(threshold);…

}

return lerp(square(irradianceNoCheb.rgb * (1.0 / irradianceNoCheb.a)), square(irradiance.rgb * (1.0 / irradiance.a)),saturate(irradiance.a));

P

X

n

dir

r

Page 74: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

76

PROBE PACKING

Sphere → Octahedron → Square

Pack XZ squares, layer in Y

Including border texels for fast bilinear:

Depth: 16x16 RG16F = 1024 bytes

Irradiance: 6x6 R11G11B10F= 144 bytes

= 1168 bytes/probe

[Cigolle 2014]

Page 75: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

77

DEMO

Page 76: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

78

Page 77: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

79

Page 78: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

80

Page 79: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

81

Page 80: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

82

Page 81: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

83

Page 82: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

84

Page 83: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

85

Page 84: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

86

MORE GI OPTIMIZATIONS

Scale down to lower-end hardware by reduce number of probes updated each frame or decreasing ray count and increasing hysteresis. Similar to what Enlighten did for their probes

Use fewer probes vertically for typical environments. Most illumination changes are due to walls. If you have two probes per room vertically that may be fine.

Order diffuse probe rays to capture coherence.

Pack diffuse probe rays and glossy into a single ray shader. Having more work in a single pass allows the scheduler to fill the machine and do more optimizations. This will get even faster over time with driver updates.

Compute ray derivatives for mip bias to reduce flicker and increase cache coherence. Force higher roughness on indirect bounces.

Clamp maximum radiance on indirect shading so that tiny reflections into light sources won’t become fireflies.

Use fewer rays for diffuse in bright situations. Dim/high contrast is the case where rays get different results and you need more to avoid low-frequency flicker.

Use simplified shaders on indirect rays: no shadow map filtering, simpler BRDF model, no volumetrics.

Blurred mirror reflections are more stable than blurred stochastic reflections.

Page 85: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

87

STREAMING GI

The Ultimate Optimization

[Crassin et al. 2015]

H.265 DDGI Probe TextureGame Engine Clients

Diffuse GI + MultiplayerRTX Server

Proprietary Game Data

5G

Page 86: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

88

SUMMARY

Dynamic Diffuse GI

Avoids leaks to decrease artist workload while increasing visual quality

1 ms/frame, 4.5 MB per cascade

Scales down to XboxOne by reducing update frequency

Scales up to 4k, 240 Hz, and VR

Dynamic lights and geometry, forward, deferred, transparent, volumetric

Page 87: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

89

MORE [email protected], @CasualEffects

After the conference:

Blog Post: https://morgan3d.github.io/articles/2019-04-01-ddgi

Technical Paper: Dynamic Diffuse Global Illumination with Ray-Traced Irradiance Fields, Zander Majercik (NVIDIA), Jean-Philippe Guertin (University of Montreal), Derek Nowrouzezahrai (McGill University), and Morgan McGuire (NVIDIA), JCGT 2019

Thanks to Dylan Lacewell, Mike Mara, Dan Evangelakos, Sam Donow, and Corey Taylor for their work on the implementation infrastructure.

Page 88: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

90

BIBLIOGRAPHY

Greger et al., The Irradiance Volume, IEEE CG&A 1998

Gilabert and Stefanov, Deferred Radiance Transfer Volumes: Global Illumination in Far Cry 3, GDC 2012

Tatarchuk, Irradiance Volumes for Games, GDC 2005

Kaplanyan, Light Propagation Volumes in CryEngine 3, SIGGRAPH Advances in Real-Time Rendering Course, 2009

Kaplanyan and Dachsbacher, Cascaded Light Propagation Volumes for Real-Time Indirect Illumination, I3D 2010

Asirvatham and Hoppe, Terrain Rendering Using GPU-Based Geometry Clipmaps, GPU Gems 2, Pharr & Fernando eds., 2005

Donow, Light Probe Selection Algorithms for Real-Time Rendering of Light Fields, Williams College Thesis, 2016

Evangelakos, A Light Field Representation for Real Time Global Illumination, Williams College Thesis, 2015

Mara et al., An Efficient Denoising Algorithm for Global Illumination, HPG 2017

Wang et al., Fast Non-Uniform Radiance Probe Placement and Tracing, I3D 2019

Keller, Instant Radiosity, SIGGRAPH 1997

Ritschel et al., Imperfect Shadow Maps, SIGGRAPH Asia 2008

Dachsbacher and Stamminger, Reflective Shadow Maps, I3D 2005

Donnelly and Lauritzen, Variance Shadow Maps, I3D 2006

Hooker, Volumetric Global Illumination at Treyarch, SIGGRAPH Advances in Real-Time Rendering, 2016

Cigolle et al., Survey of Efficient Representations for Independent Unit Vectors, JCGT 2014

Page 89: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

91

BIBLIOGRAPHY

Stachowiak, Stochastic Screen-Space Reflections, SIGGRAPH Advances in Real-Time Rendering, 2015

Valient, Reflections and Volumetrics of Killzone Shadow Fall, SIGGRAPH Advances in Real-Time Rendering, 2014

McGuire and Mara, Efficient GPU Screen-Space Ray Tracing, JCGT 2014

Majercik et al., Dynamic Diffuse Global Illumination with Ray Traced Irradiance Fields, JCGT 2019

Mara, CloudLight: A Distributed Global Illumination System for Real-Time Rendering, Williams College Thesis, 2012

McGuire et al. Real-Time Global Illumination using Precomputed Light Field Probes, I3D 2017

Silvennoinen and Lehtinen, Real-time Global Illumination by Precomputed Local Reconstruction from Sparse Radiance Probes, ACM ToG 2017

Schied et al., Spatiotemporal Variance-Guided Filtering: Real-Time Reconstruction for Path Traced Global Illumination, HPG 2017

Chajdas et al., Assisted Environment Map Probe Placement, SIGRAD 2011

Rakhteenko, Baking artifact-free lightmaps on the GPU, 2018 https://ndotl.wordpress.com/2018/08/29/baking-artifact-free-lightmaps/

Crassin et al., Interactive Indirect Illumination Using Voxel Cone Tracing, INRIA 2011

Crassin et al., CloudLight: A System for Amortizing Indirect Lighting in Real-Time Rendering, JCGT 2015

Mitchell et al., Shading in Valve’s Source Engine, SIGGRAPH Advanced Real-Time Rendering in 3D Graphics and Games, 2006

O’Donnell, Precomputed Global Illumination in Frostbite, GDC 2018

Iwanicki, Lighting Technology of “The Last of Us”, SIGGRAPH Advances in Real-Time Rendering, 2013

Dimitrov, Cascaded Shadow Maps, NVIDIA 2007 https://developer.download.nvidia.com/SDK/10.5/opengl/src/cascaded_shadow_maps/doc/cascaded_shadow_maps.pdf

Page 90: DYNAMIC DIFFUSE GLOBAL ILLUMINATION - Nvidia · 1 ms/frame dynamic diffuse global illumination on everything (static, dynamic, transparent, volumetric, forward, deferred) Runs everywhere,

92

VR VILLAGE

Explore the VR Village to get hands-on with the latest advances in virtual reality

VR THEATER

Go to the VR Theater to see and experience narrated VR demos built by our partners

VR PARTNERS

Explore a great lineup of VR partners around the VR Village showcasing their groundbreaking technology

COME EXPLORE ALL THINGS VR AT GTC 2019

VR VILLAGE HOURS Tuesday: 12:00pm - 7:00pm Wednesday: 12:00pm - 7:00pm

Thursday: 11:00am - 2:00pm

VR on the Exhibition Floor

Expo Hall 3, Concourse Level


Recommended