Ray Tracing Essentials: Ethan Einhorn Eric Haines

Download as pdf or txt
Download as pdf or txt
You are on page 1of 103

Ray Tracing Essentials

Ethan Einhorn
Eric Haines

Eric Haines
Ray Tracing Essentials

Eric Haines
NVIDIA
“There is an old joke that goes, ‘Ray tracing is the
technology of the future, and it always will be!’”
– David Kirk, March 2008
What is a Ray?

Direction
Origin
Ray Casting

Direction
Origin

Point(distance) = Origin + distance*Direction


Ray Casting

Between two points

B
Direction = B - A
Ray Casting

Between two surfaces

B
Direction = B - A
1968: Appel - Rays for shadows
1979: Whitted - Classical Ray Tracing

Image now generated in real time in NVIDIA OptiX™ (was 74 minutes per frame in 1980)
1979: Whitted Classical Ray Tracing

highly polished surface


Generated using OptiX sample “optixWhitted”
eye eye ray

glass
Classical Ray
Tracing
shadow
eye ray

glass
Classical Ray
Tracing
eye

glass
Classical Ray refraction
ray
Tracing reflection
ray
shadow
ray
eye

glass
Classical Ray
Tracing
eye
reflection
ray
refraction
ray
glass
Classical Ray
Tracing
shadow
rays

eye

glass
Classical Ray
Tracing
Hard Shadows
Hard Shadows
1984: Cook - Stochastic (“Distribution”) Ray Tracing

glossy surface
area
light

shadow
rays
eye

Stochastic
Ray Tracing
area
light

shadow
rays
eye

Stochastic
Ray Tracing
area
light

shadow
rays
eye

Stochastic
Ray Tracing
Soft Shadows
Soft Shadows
Depth of Field,
Background Blur
Depth of Field,
Foreground Blur
Motion Blur
1986: Kajiya - Path Tracing, The Rendering Equation

diffuse surface reflection


Path Tracing
Secondary ray

pixel samples

eye Primary ray

diffuse
box
Path Tracing

pixel samples

eye
diffuse
box
Path Tracing

pixel samples

eye
diffuse
box
Path Tracing

pixel samples

eye
diffuse
box
Path Tracing

pixel samples

eye
diffuse
box
Path Tracing

pixel samples

eye
diffuse
box
Path Tracing

pixel samples

eye
diffuse
Use all paths’
contributions box
The Rendering Equation

Outgoing light Emitted light Incoming light Material Lambert


Interreflection
a.k.a.
indirect lighting
a.k.a.
color bleeding
a.k.a.
global
illumination
Interreflection
a.k.a.
indirect lighting
a.k.a.
color bleeding
a.k.a.
global
illumination
Interreflection
a.k.a.
indirect lighting
a.k.a.
color bleeding
a.k.a.
global
illumination
Path-Traced Game: Quake II

Simple assets and limit path types – game published in 1997.

First three levels free on Steam.


Glossy Reflections
Interreflection
Throughout

Soft Shadows
The Big Dig build by
Quaxalot in Vokselia
Atmospheric Effects

The Big Dig build by


Quaxalot in Vokselia
Caustics
Caustics

“Caustics”
Glass Caustics

Images courtesy Matt Pharr, Wenzel Jakob, and Greg Humphreys. Glass model by Simon Wendsche.
Why Ray Tracing is Great

The back of Paul Heckbert’s business card


Rasterization vs. Ray Tracing
Rasterization loop: Ray tracing loop:
For each object For each pixel
For each pixel—closer? For each object—closest?
Rasterization
Rasterization
Rasterization
Rasterization
Rasterization

+depth +depth +depth


Depth buffer,
a.k.a.
+depth +depth Z-buffer

+depth
Rasterization
Rasterization

depth >
+depth
depth tests pass
depth >
+depth
Rasterization
Rasterization
Rasterization

X X

X: depth test fails


X X
Rasterization
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Ray Tracing
Rasterization and Ray Tracing
The Bounding Volume Hierarchy (BVH)

Figure courtesy of Real-Time Rendering


BVH Algorithm
Embarrassingly Parallel

Image from Wikimedia Commons, File:UNM - Dreamstyle Stadium panorama.jpg


1987: AT&T Pixel Machine

AT&T Pixel Machine: Interactive,


postage-stamp-sized, ray-traced
mirror sphere atop a mandrill texture.

+
Sphereflake: 512 x 512 pixels of 7,381
spheres and plane rendered in just 30
seconds, later optimized to 16 seconds
in 1988.
Moore’s Law Is Ending (Really!) End of the Line
» 2X / 20 yrs.
Amdahl’s Law (3%/yr.)
» 2X / 6 yrs.
100,00040 (12%/yr.)
End of Dennard Scaling
Performance vs. VAX11-780

» Multicore 2X / 3.5 yrs.


(23%/yr.)
10,000
30

1,000 RISC 2X / 1.5 yrs.


(52%/yr.)
20

100

10
10
CISC 2X / 2.5 yrs.
(22%/yr.)

10
1980 1985 1990 1995 2000 2005 2010 2015

Figure after Norman P. Jouppi, Cliff Young, Nishant Patil, David Patterson, “A Domain-Specific Architecture for Deep Neural Networks,”
Communications of the ACM, September 2018, Vol. 61 No. 9, Pages 50-59.
More Special-Purpose Hardware
RT Cores
RT Cores perform:
● Ray-bounding volume
hierarchy (BVH) traversal
● Ray-triangle intersection
● Instancing: 1 level

Return to streaming
multiprocessors for:
● Multi-level instancing
● Custom intersection
● Shading
GPU Memory Capacity in Gigabytes
512 DGX-2

DGX-1
DGX Station

64 GV100 + NVLink

M6000 24 GB GV100

K6000

8 6000
FX 5800

FX 5600
1
FX 5500

FX 4400

FX 4000
0.125
2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018

Products referenced include NVIDIA® Quadro® GPUs; NVIDIA DGX™ and DGX Station™; and NVIDIA NVLink™
One METRO Exodus Frame

NVIDIA
PASCAL™
NVIDIA GeForce®
GTX 1080 Ti TIME

NVIDIA TURING™
GeForce RTX™ 2080
NO RT CORE

TIME

TURING RTX
GeForce RTX 2080
RT CORE+DLSS
TIME

FP32 Cores INT32 Cores RT Cores Tensor Cores


Tuning
Battlefield V, RTX 2080 Ti, Ultra Preset, Ultra DXR, 1440p

Source: Core i9-9900K, 32 GB RAM


2019: RTX

Sphereflake: 48,427,561 spheres rendering in real time


1 spp 4 spp

5000 spp
Austrian Imperial Crown, modeled by Martin Lubich 16 spp 50 spp
Ray Tracing at Low Sample Counts
Denoised

Austrian Imperial Crown, modeled by Martin Lubich


Start with a noisy result and reconstruct…
To get this
1 spp Ray Traced Shadows
1 spp Ray Traced Shadows + Denoising
Ray Traced Shadow Ground Truth
Other Uses of RT For faster baking

For ground truth


Images from three.js sample “webgl_materials_lightmap”

For other
(ab)uses

Image courtesy of Matt Pharr, Wenzel Jakob, and Greg Humphreys.

Model by Yasutoshi Mori (@MirageYM), available under CC-BY license. Image from “RTX Beyond Ray Tracing” by Wald et al.
“There is an old joke that goes, ‘Ray tracing is the
technology of the future, and it always will be!’”
– David Kirk, March 2008

“Ray tracing is simple enough to fit on a business card,


yet complicated enough to consume an entire career.”
– Steven Parker, May 2019
Call for articles for the book:

Ray Tracing Gems II


Submit your article abstract today:
[email protected]

September 1 – articles due


December 1 – revised articles due
GDC 2021 – publication

Short practical articles with battle-tested


techniques are highly encouraged!

Editors:
Adam Marrs, Peter Shirley, Ingo Wald
Submit by 11:59pm Pacific
Time, June 26, 2020
https://developer.nvidia.co
m/DXR-spotlight
103

You might also like