nvidia research talk: the magic behind gameworks …

59
Chris Wyman July 28, 2016 NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS HYBRID FRUSTUM TRACED SHADOWS

Upload: others

Post on 20-Oct-2021

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

Chris Wyman

July 28, 2016

NVIDIA RESEARCH TALK:

THE MAGIC BEHIND GAMEWORKS’ HYBRID FRUSTUM TRACED SHADOWS

Page 2: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

2

Now available as GameWorks module; shipped in Tom Clancy’s The Division

MARCH 2016: 1ST RAY-TRACED SHADOWS IN GAMESLeft

: H

ybri

d F

rust

um

Tra

ced S

hadow

s (H

FT

S)

Rig

ht:

Perc

enta

ge C

lose

r Soft

Shadow

s (P

CSS)

Page 3: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

3

WHO?

Joint work:

Chris Wyman, NVIDIA Research

Jon Story, NVIDIA DevTech

UbiSoft’s Massive, developers of The Division

Fro

m T

om

Cla

ncy

’s T

he D

ivis

ion

Page 4: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

4

WHO?

Joint work:

Chris Wyman, NVIDIA Research

Jon Story, NVIDIA DevTech

UbiSoft’s Massive, developers of The Division

An NVIDIA success story of transitioning research to product

Fro

m T

om

Cla

ncy

’s T

he D

ivis

ion

Page 5: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

5

WHO?

Joint work:

Chris Wyman, NVIDIA Research

Jon Story, NVIDIA DevTech

UbiSoft’s Massive, developers of The Division

An NVIDIA success story of transitioning research to product

May not know:

NVIDIA has research division of 100+ researchers

Covering graphics, VR, machine learning, AI, compilers, vision, circuits, etc.

Fro

m T

om

Cla

ncy

’s T

he D

ivis

ion

Page 6: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

6

WHO?

Joint work:

Chris Wyman, NVIDIA Research

Jon Story, NVIDIA DevTech

UbiSoft’s Massive, developers of The Division

An NVIDIA success story of transitioning research to product

May not know:

NVIDIA has research division of 100+ researchers

Covering graphics, VR, machine learning, AI, compilers, vision, circuits, etc.

(2+ years effort)

(6+ months effort)

NVIDIA enables researchers and engineers to spend time addressing

important graphics problems

Fro

m T

om

Cla

ncy

’s T

he D

ivis

ion

Page 7: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

7

BUT THERE’S MORE!

Today, GameWorks supports 1 ray per pixel

The research extends to 32+ rays per pixel(For a 2x increase in cost)

Page 8: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

8

STORY

Today: talk about the road to productization and research tech transfer

Page 9: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

9

STORY

Today: talk about the road to productization and research tech transfer

Up to 5 billion shadow rays/sec in fully dynamic scenes, incl. data structure build

On GeForce GTX Titan X (2015)

Specialized algorithm for ray traced hard shadows

Fits in raster pipeline; no extra ray tracing library

Page 10: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

10

STORY

Today: talk about the road to productization and research tech transfer

Up to 5 billion shadow rays/sec in fully dynamic scenes, incl. data structure build

On GeForce GTX Titan X (2015)

Specialized algorithm for ray traced hard shadows

Fits in raster pipeline; no extra ray tracing library

Builds on a “irregular z-buffer” for ray acceleration

Not a traditional BVH or kd-tree

Irregular z-buffers regarded as a dead end 3 years ago

Page 11: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

11

WHY IS THIS WORTH INVESTIGATING?

Page 12: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

12

WHY IS THIS WORTH INVESTIGATING?

Cause:

• Precompute shadow map

• Has fixed resolution

• Multiple adjacent pixels query same texel, get same answer

Page 13: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

13

ALIASES EVEN WITH HIGH RESOLUTION

Page 14: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

14

ALIASES EVEN WITH HIGH RESOLUTION

Page 15: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

15

ALIASES EVEN WITH HIGH RESOLUTION

Page 16: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

16

ALIASES EVEN WITH HIGH RESOLUTION

Page 17: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

17

ALIASES EVEN WITH HIGH RESOLUTION

Page 18: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

18

FILTERING SHADOW MAPS HELP

Page 19: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

19

FILTERING SHADOW MAPS HELP

Page 20: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

20

FILTERING SHADOW MAPS HELP

Page 21: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

21

AND BLOCKS STILL VISIBLE AFTER FILTERING!

Less contact shadows

Lose fine geometric details

And they move and flicker during animation…

Page 22: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

22

HIGH QUALITY RAY TRACING

Page 23: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

23

HIGH QUALITY SHADOW MAP

1 or 32 samples per pixel

Page 24: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

24

HIGH QUALITY RAY TRACING

Page 25: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

25

USING RAY TRACING TODAY

Requires separate ray tracing libraries, APIs, and acceleration structures:

May need separate geometric representation

Data structure rebuild traditionally costly (for dynamic scenes)

Page 26: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

26

USING RAY TRACING TODAY

Requires separate ray tracing libraries, APIs, and acceleration structures:

May need separate geometric representation

Data structure rebuild traditionally costly (for dynamic scenes)

Our goals:

Specialize ray tracing for hard shadows

Build on existing APIs (DirectX, OpenGL, Vulkan) and geometric representations

Quickly build a new data structure each frame

Page 27: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

27

WHAT IS RAY TRACING?

Query visibility along arbitrary rays

Page 28: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

28

WHAT IS RAY TRACING?

Query visibility along arbitrary rays

To shadow each pixel, test ray to light

If occluded, pixel shadowed

If unoccluded, pixel lit

Page 29: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

29

WHAT IS RAY TRACING?

Query visibility along arbitrary rays

To shadow each pixel, test ray to light

If occluded, pixel shadowed

If unoccluded, pixel lit

Avoids problems with shadow maps

Light visibility not precomputed

Computations exactly match pixel locations

Page 30: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

30

MAKING SHADOW RAY TRACING FAST

Typical ray tracer is extremely general

10s, 100s, or 1000s of rays per pixel

Incoherent memory access

Unknown reflectance of surfaces in scene

From WikiPedia

Page 31: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

31

MAKING SHADOW RAY TRACING FAST

Typical ray tracer is extremely general

10s, 100s, or 1000s of rays per pixel

Incoherent memory access

Unknown reflectance of surfaces in scene

Specializing for shadows helps

Only care about binary visibility per ray

From WikiPedia

Page 32: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

32

MAKING SHADOW RAY TRACING FAST

Typical ray tracer is extremely general

10s, 100s, or 1000s of rays per pixel

Incoherent memory access

Unknown reflectance of surfaces in scene

Specializing for shadows helps

Only care about binary visibility per ray

Specializing for hard shadows helps even more

Know all rays go to same location (i.e., the point light)

Starts to look like raster, with irregular samples

From WikiPedia

Page 33: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

33

DATA STRUCTURE: IRREGULAR Z-BUFFER

Accelerates queries emanating from a point

Can efficiently build and traverse in parallel

Fully rebuilds in < 1 ms per frame

Shadow map Irregular Z-buffer

Page 34: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

34

DATA STRUCTURE: IRREGULAR Z-BUFFER

Accelerates queries emanating from a point

Can efficiently build and traverse in parallel

Fully rebuilds in < 1 ms per frame

A type of ray caching

Stores ray endpoints rather than triangles

Reorders rays; allows ray tracing via raster hardware

Leverage shadow map techniques for more perf wins

Shadow map Irregular Z-buffer

Page 35: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

35

WHY HAS NOBODY ELSE DONE THIS?

Irregular z-buffering is hard

3 years ago, was a “dead end” in academic research

Our 1st prototype cost >2 sec for this frame (now <5 ms; a 400x speedup)

Page 36: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

36

WHY HAS NOBODY ELSE DONE THIS?

Irregular z-buffering is hard

3 years ago, was a “dead end” in academic research

Our 1st prototype cost >2 sec for this frame (now <5 ms; a 400x speedup)

Bad: Costs increased linearly with # pixels & polygons

Page 37: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

37

WHY HAS NOBODY ELSE DONE THIS?

Irregular z-buffering is hard

3 years ago, was a “dead end” in academic research

Our 1st prototype cost >2 sec for this frame (now <5 ms; a 400x speedup)

Bad: Costs increased linearly with # pixels & polygons

Worse: Performance could vary 100:1 between frames

Page 38: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

38

MAKING IRREGULAR Z-BUFFERS USABLE

IZBs eliminate aliasing, converting it to performance variability

Page 39: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

39

MAKING IRREGULAR Z-BUFFERS USABLE

IZBs eliminate aliasing, converting it to performance variability

If shadow maps alias, many pixels correspond to one texel

IZBs have to enumerate, cache, and reorder these pixels

Coverts aliasing into a parallel load balancing problem

Poor load balancing = poor GPU performance

Well balanced

Poorly balanced

Page 40: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

40

MAKING IRREGULAR Z-BUFFERS USABLE

IZBs eliminate aliasing, converting it to performance variability

If shadow maps alias, many pixels correspond to one texel

IZBs have to enumerate, cache, and reorder these pixels

Coverts aliasing into a parallel load balancing problem

Poor load balancing = poor GPU performance

Our research:

First, identified this problem

Second, proposed a simple solution implementable today

Well balanced

Poorly balanced

Page 41: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

41

HOW TO LOAD BALANCE

Even well designed shadow map implementations alias badly from some views

Nearby texels here 100:1 larger than distant ones

Page 42: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

42

HOW TO LOAD BALANCE

Even well designed shadow map implementations alias badly from some views

Nearby texels here 100:1 larger than distant ones

Hence the use of cascaded shadow maps

Cascades reduce variability in aliasing

Page 43: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

43

HOW TO LOAD BALANCE

Even well designed shadow map implementations alias badly from some views

Nearby texels here 100:1 larger than distant ones

Hence the use of cascaded shadow maps

Cascades reduce variability in aliasing

IZBs convert aliasing to poor load balancing

Some texels cost 100x more than others

Page 44: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

44

HOW TO LOAD BALANCE

Even well designed shadow map implementations alias badly from some views

Nearby texels here 100:1 larger than distant ones

Hence the use of cascaded shadow maps

Cascades reduce variability in aliasing

IZBs convert aliasing to poor load balancing

Some texels cost 100x more than others

Cascaded IZBs reduce this variability (to <<2x)

Other shadow map techniques apply too

(E.g., adaptive, perspective, logarithm, etc.)

Page 45: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

45

HOW TO GET SOFT SHADOWS

Ray Traced PCSS HFTS

Unlike shadow maps, maintains high quality contact shadows when filtering

Page 46: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

46

USE AS INPUT TO SHADOW FILTER

Irregular Z-buffer PCSS Hybrid Frustum Traced Shadows

Unlike shadow maps, maintains high quality contact shadows when filtering

Irregular Z-buffer PCSS HFTS

Page 47: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

47

HOW TO COMBINE?Multiple ways, but straightforward seems to work pretty well

See “Hybrid Ray Traced Shadows” from Jon Story at GDC 2015 for details

Page 48: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

48

HFTS PERFORMANCE

0 1 2 3 4 5

PCSS

IZB

HFTS

ms

Images

from

Tom

Cla

ncy

’s T

he D

ivis

ion

GeForce GTX Titan X (2015) at Resolution: 1920x1080

Page 49: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

49

HFTS PERFORMANCE

0 1 2 3 4 5 6 7

PCSS

IZB

HFTS

ms

Images

from

Tom

Cla

ncy

’s T

he D

ivis

ion

GeForce GTX Titan X (2015) at Resolution: 1920x1080

Page 50: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

50

HFTS PERFORMANCE

GeForce GTX Titan X (2015) at Resolution: 1920x1080

Images

from

Tom

Cla

ncy

’s T

he D

ivis

ion

0 1 2 3 4 5

PCSS

IZB

HFTS

ms

Page 51: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

51

FURTHER TO GO

GameWorks version limited by in-game feasibility

More advanced features available in budgets ~10-30 ms

Research prototype shows

32 samples per pixel ~2x cost of 1 sample

Seemless shadows from transparent and alpha tested geometry

Possibility of higher quality soft shadows

Page 52: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

52

FURTHER TO GO

16 ms per frame

Page 53: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

53

TAKEAWAYS

Can do fast ray traced shadows in games today

Page 54: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

54

TAKEAWAYS

Can do fast ray traced shadows in games today

Eliminates shadow map aliasing larger than a pixel

Page 55: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

55

TAKEAWAYS

Can do fast ray traced shadows in games today

Eliminates shadow map aliasing larger than a pixel

Introduces some variability to perf; cascades & other techniques reduce dramatically

Page 56: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

56

TAKEAWAYS

Can do fast ray traced shadows in games today

Eliminates shadow map aliasing larger than a pixel

Introduces some variability to perf; cascades & other techniques reduce dramatically

Provides high quality input to shadow filters for approximate soft shadows

Page 57: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

57

TAKEAWAYS

Can do fast ray traced shadows in games today

Eliminates shadow map aliasing larger than a pixel

Introduces some variability to perf; cascades & other techniques reduce dramatically

Provides high quality input to shadow filters for approximate soft shadows

HFTS available in NVIDIA GameWorks; shipped in Tom Clancy’s The Division

Page 58: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

QUESTIONS?

Contact:

Chris Wyman Jon Story

[email protected] [email protected]

@_cwyman_

More on:Irregular Z-Buffers

More on:Hybrid Frustum Traced Shadows

Page 59: NVIDIA RESEARCH TALK: THE MAGIC BEHIND GAMEWORKS …

COME DO YOUR LIFE’S WORKJOIN NVIDIA

We are looking for great people at all levels to help us accelerate the next wave of AI-driven

computing in Research, Engineering, and Sales and Marketing.

Our work opens up new universes to explore, enables amazing creativity and discovery, and

powers what were once science fiction inventions like artificial intelligence and autonomous

cars.

Check out our career opportunities:

• www.nvidia.com/careers

• Reach out to your NVIDIA social network or NVIDIA recruiter at

[email protected]