Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and...

69
Advanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao – DevTech Engineer [email protected]

Transcript of Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and...

Page 1: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Advanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks

Jerry Cao – DevTech [email protected]

Page 2: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Overview

VXAO

HRTS

TXAA 3.0

ANSEL

HDR Display

Page 3: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Voxel Ambient Occlusion

VXGI is NVIDIA’s new real-time global illumination solution

Works by voxelizing geometry on every frame

Produces approximate but realistic looking diffuse and specular GI

Still too resource intensive to use in mainstream games

VXAO is a special mode of operation of VXGI

Throw away all the lighting information, keep only occlusion

Works much faster

Integration is significantly simpler

Page 4: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Screen-Space AO Issues

View dependence

Lack of occlusion behind foreground objects

Errors and unstable results near screen edges

Locality

Only a small volume around a surface contributes to AO

Blurriness

Computing a complete solution for every pixel would be too expensive

Page 5: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Why VXAO is Better Than SSAO

It has none of the aforementioned issues

World-space solution

An occluder can be behind something else

Even behind the viewer (which means less aggressive culling is required)

Uses Voxel Cone Tracing approach

Occluders can be far from the surface under consideration

Their information will be sampled from a very coarse voxel LOD

Using a large AO distance has very little effect on performance

Page 6: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Overview of voxel cone tracing

Transform the scene into voxels that encode opacity

Then downsample the opacity map

Opacity gives us information to compute occlusion

Gather light by tracing cones through the opacity

Page 7: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Voxelization

The process of converting a mesh into a voxel representation

Treat it as 3D space rasterization

A binary voxel representation

of an object with color information

Page 8: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

In a real demo

Voxelization

VXAO Result

Page 9: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Example: HBAO+ Channel

Page 10: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Example: VXAO Channel

Page 11: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Image Quality Differences #1

Ground under the

tank

Bottom part of the

tracks

Blurriness

HBAO+ VXAO

Page 12: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Image Quality Differences #2

HBAO+ VXAO

HBAO+

VXAO

Page 13: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

HBAO+ with Color

Page 14: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

VXAO with Color

Page 15: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Handling Dynamic Scenes

Voxel representation is very expensive to construct or update?

Wrong !

It takes about 1 ms to voxelize a 300K triangle scene on a GTX 980

Most of voxel data can be preserved between frames

Pass a list of AABBs for geometry that has changed

Those regions will be cleared and updated, everything else stays

Page 16: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Performance on GTX 980

Pass Time Conditions

VXAO: Full scene voxelization 1.0 ms 300K triangles

1283 clip-map, 5 LODsVXAO: Voxel post-processing 1.4 ms

VXAO: Cone tracing,

Interpolation

1.6 ms 1920x1080

VXAO overall 4.0 ms

HBAO+ overall 1.2 ms 1920x1080

Blur radius 4, normal channel supplied

HBAO+ is about 2-4x faster than VXAO on Maxwell GPUs, but loses in quality

Page 17: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Performance with Partial Updates

For mostly static scenes, voxelization and post-processing cost

can be significantly reduced

Voxelized geometry percentage 30% 40% 63% 83% 100%

Voxelization time, ms 0.23 0.28 0.45 0.63 1.01

Voxel post-processing time, ms 1.02 1.06 1.08 1.22 1.49

Total time relative to full voxelization 50% 54% 61% 74% 100%

In 100% case, some large floor and wall triangles add significant contribution.Actual numbers strongly depend on the specific scene (Sponza Atrium in this case)

Page 18: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Hybrid Ray-Traced Shadows

Combine ray tracing with traditional shadow map algorithm

Benefits

Razor sharp anti-alised hard shadows

Super soft shadows

HRTS will blend between the two result automatically

Page 19: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Issues in Shadow Map

Acne

Peter-panning

Aliasing

Endless tuning to alleviate the above...

Page 20: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional
Page 21: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional
Page 22: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional
Page 23: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Traditional Spatial Hierarchy

Typical solutions

KD-Tree

Bounding Volume Hierarchy

Uniform Grid

Not practical

Reconstructing or updating is expensive

Tree traversal is inherently slow

Page 24: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Ray Traced Shadow Map Construction

Prim Buffer – Triangle vertices

Prim Indices Map – Prim buffer indices

of triangles

Prim Count Map – # of tris per texel

Raytrace triangles in a later pass

Prim Count MapNxN

Prim Indices MapNxNxd

Prim Buffer

Page 25: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Conservative Rasterization

Hardware Support

DX12

NVAPI

Software Implementation

http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter42.html

Page 26: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Shadow Map Algorithm

Page 27: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Hybrid Ray Traced Shadow

Page 28: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Hybrid Approach

Combine ray-traced shadow with conventional soft shadows

Use an advanced filtering technique such as PCSS

Use blocker distance to compute a lerp factor

As blocker distance approaches 0, ray-traced result is prevalent

Page 29: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Lerp Factor Visualization

L = saturate( BD / WSS * PHS )

L: Lerp factor

BD: Blocker distance (from ray origin)

WSS: World space scale – chosen based

upon model

PHS: Desired percentage of hard

shadow

FS = lerp( RTS, PCSS, L )

FS: Final shadow result

RTS: Ray traced shadow result (0 or 1)

PCSS: PCSS+ shadow result (0 to 1)

Page 30: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional
Page 31: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional
Page 32: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Performance

Prims: ~10K

Shadow Map: 3K x 3K (36 MB)

Primitive Map: 1K x 1K x 32 (128 MB)

Primitive Buffer: ~360K

Shadow Buffer: 1920 x 1080

GTX 980

Primitive Map + HW CR 0.4

Primitive Map + SW CR 0.5

Ray Trace 0.4

PCSS 1.3

PCSS + Ray Trace 1.8

Page 33: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Performance

Prims: ~65K

Shadow Map: 3K x 3K (36 MB)

Primitive Map: 1K x 1K x 64 (256 MB)

Primitive Buffer: ~2.2 MB

Shadow Buffer: 1920 x 1080

GTX 980

Primitive Map + HW CR 0.5

Primitive Map + SW CR 0.7

Ray Trace 0.7

PCSS 1.3

PCSS + Ray Trace 2.8

Page 34: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Performance

Prims: ~240K

Shadow Map: 3K x 3K (36 MB)

Primitive Map: 1K x 1K x 64 (256 MB)

Primitive Buffer: ~8.2 MB

Shadow Buffer: 1920 x 1080

GTX 980

Primitive Map + HW CR 3.4

Primitive Map + SW CR 4.1

Ray Trace 1.0

PCSS 1.3

PCSS + Ray Trace 3.4

Page 35: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Next Generation TXAA

Time varying sample locations (PSL)

Simpler filtering

No Gaussian Blur anymore, no over blurred image

Faster

All MSAA mode

8x MSAA mode supported

1x MSAA or NonAA mode supported

Page 36: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

TXAA 3.0 core algorithm

Base Pass

Motion Vector

Scene Color

TXAA Resolve Resolved Color Post Processing

Setup/Restore PSL Patterns

Prior Color

Texture Rendering Pass

TXAA 3.0 = [MSAA] + Temporal AA + MFAA

Page 37: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Exponential Sum

The math formula

𝑇𝑋𝐴𝐴𝑛 = 𝛼𝑀𝑆𝐴𝐴𝑛 + 1 − 𝛼 𝑇𝑋𝐴𝐴𝑛−1

A little mathematic background:

𝑀𝑆𝐴𝐴𝑛 = 𝑀𝑆𝐴𝐴𝑛−𝑘True for static image, k is the number of patterns used

𝑇𝑋𝐴𝐴𝑛 =𝛼

1 − 1−𝛼 𝑘 Σ𝑡=0𝑘−1 1 − 𝛼 𝑡𝑀𝑆𝐴𝐴𝑛−𝑡

lim𝛼→0

𝛼

1− 1−𝛼 𝑘 Σ𝑡=0𝑘−1 1 − 𝛼 𝑡𝑀𝑆𝐴𝐴𝑛−𝑡 =

1

𝑘Σ𝑡=0𝑘−1𝑀𝑆𝐴𝐴𝑛−𝑡

Ideal result, at least for static image

Unfortunately, there are issues:

𝛼 will never be zero

The formula doesn’t work if 𝛼 depends on 𝑀𝑆𝐴𝐴𝑛The first equation may be false for dynamic scene

Page 38: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Color Clipping

To get rid of ghost issue

An AABB in YCgCo space is

constructed by neighbor

pixels

Min = min( c , n , s , w , e )

Max = max( c , n , s , w , e )

Feedback color is clipped

against the AABB

Current Resolved Color

Feedback Color

Clipped Color

A simple demonstration in 2D space, in

TXAA it works similarly in YCgCo space

Page 39: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Programmable Sample Location

Enable graphics programmer to set up customized sample locations

for each sample

Enhance AA quality at minimal extra overhead

Quality of AA algorithm depends on the number of sample patterns

available, 4 or 8 samples patterns work fine

Page 40: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Disable PSL if Necessary

Shadow map generation pass

Reflection map

UI Rendering

Post-Processing

Page 41: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

TXAA 3.0 Integration

Easy to integrate, only three interfaces:

GFSDK_TXAA_DX11_InitializeContext( &txaaContext, device )

Initialize TXAA 3.0 context, it will fail on devices prior to Kepler

GFSDK_TXAA_DX11_ResolveFromMotionVectors(&resolveParameters, &motion)

Perform TXAA 3.0 resolve pass

GFSDK_TXAA_DX11_ReleaseContext(&txaaContext)

Release TXAA 3.0 context

Misc:

TXAA 3.0 also provides several debugging features

Besides the library itself, there is also an utility library providing some helper interfaces

Edge detection

Motion vector generation from depth and camera information

Page 42: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

No AA

Page 43: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

4x MSAA

Page 44: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

TXAA 2 (4x)

Page 45: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

TXAA 3 (1x)

Page 46: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

TXAA Performance

Comparing with other AA techniques, the overhead in TXAA can

almost be neglected

TXAA only has one draw call, relatively cheap

On a GTX 980, it costs less than 1ms

Even with 4x MSAA

Page 47: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Ansel

EXR 360SUPER REZFILTERSFREE CAMERA

Page 48: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

ANSEL Integration

Ease of integration

Overlay UI Controls

Witness integration is ~40

lines of code

Witcher 3 integration is ~150

lines of code

GAME

DRIVER

NVIDIA GPUs

ANSEL

Page 49: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

ANSEL Architecture

FREE CAMERA OVERLAY UI

HI-RES 360 STEREO EXR (HDR)

NVIDIA GPUs

TILING STITCHING POST-PROCESSING

SHADER SDK

Post Effect...Post Effect

Page 50: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Free Camera

Page 51: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Super Resolution

Page 52: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

ANSEL POST-PROCESS SHADER

FINAL DISPLAY IMAGE

BUFFERSCOLOR BUFFER

Z BUFFERG BUFFER

GAMEENGINE

POSTPROCESSSHADER

Page 53: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Loads of Effects!

Color curves

Sketch

Color space transformation

Hue shift

Desaturation

Brightness

Contrast

Film grain

Bloom

Lens flares

Anamorphic glare

Distortion effects

Map distortion

("heathaze")

Fisheye

Explosion

Color aberration

Tonemapping schemes

Haarm-Peter Duiker

Reinhard

Hable (Uncharted2)

Lens dirt

Lightshafts

Vignette

Gamma correction

Convolution filters

Sharpening

Edge detection

Blur

Hipass/lowpass

FXAA

Sepia tone

Halftone

Deband

Denoise

Page 54: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

360 photos

Page 55: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Stereo capture

LeftEye

RightEye

STEREOIMAGE

Page 56: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Ansel Coming to games soon

Page 57: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Ansel Coming to games soon

Page 58: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Why HDR Display

LDR display offers much limited range of gamut

Without HDR display

Highlight looks flatter, can’t be distinguished from diffuse white

Highlight compromise on saturation

Shadows get crushed toward black

HDR Display

Higher luminance. (1000+nits)

Wider gamut.

Page 59: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

LDR Displayed Image

Page 60: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

CIE Chromaticity Diagram

It reveals the gamut that is

visible to human

Colors with the highest

saturation are at the

boundary

Any interior color can be

generated by interpolating

different set of colors

Page 61: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

sRGB vs BT.2020/Rec.2020

sRGB BT.2020/Rec.2020

Page 62: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Does the old way work?

Over compressed

image

Lose bright values

Dim values appears

shiny

Middle-Grey

appears white

0

100

200

300

400

500

600

700

800

900

1000

0.0

45

0.0

636

0.0

9

0.1

273

0.1

8

0.2

546

0.3

6

0.5

091

0.7

2

1.0

182

1.4

4

2.0

365

2.8

8

4.0

729

5.7

6

8.1

459

11.5

2

16.2

917

23.0

4

32.5

835

46.0

8

65.1

67

92.1

6

130.3

339

Aces LDR

Aces 1K

Reinhard

Middle

Gray

Page 63: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Can we drop Tonemapping?

Since we have HDR display now, is

tone mapping still necessary?

Yes

The best displays come nowhere

close to the range of luminance in

real world

The first generation HDR compliant

will generate 1000 nits of

luminance

BT. 2020 only supports luminance

up to 10000 nits

ConditionLuminance

(cd/m𝟐, or nits)

Sun at horizon 600000

60-watt light bulb 120000

Clear sky 8000

Typical office 100-1000

LDR display 80-100

Cloudy moonlight 0.25

Page 64: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

A new Tone Mapping

Tone mapping in Academy

Color Encoding System

(ACES)

Sigmoid-style curve

Performs on each color

channel independently

We have already

implemented the

algorithm for you0

200

400

600

800

1000

1200

1400

1600

1800

2000

Aces SDR 150 nits

Aces 1000 nits

Aces 2000 nits

Page 65: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

UI Composition

Used to be done in sRGB space after 3D Rendering

It works the same way on HDR display

Hints:

Don’t use color with maximum luminance in UI components

Add a scaling factor

Be careful with alpha blending, use a simple tonemapper (Reinhard)

Page 66: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Physically Based Shading

It will generate colors with a large range of luminance

Page 67: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Be Careful with Light Geometry Proxy

Light geometry proxy may

be dimmer than reflected

light

It used to work fine in

LDR monitor since both

reach maximum

brightness

Page 68: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

LDR vs HDR

Left : Image rendered on LDR display

Right : Image rendered on HDR TV and captured with a real camera

Page 69: Advanced Ambient Occlusion, Shadow and Anti · PDF fileAdvanced Ambient Occlusion, Shadow and Anti-Aliasing in NVIDIA GameWorks Jerry Cao ... Combine ray-traced shadow with conventional

Q&A

THANKS