1 of 32

Ray Tracing

Instructor: Christopher Rasmussen (cer@cis.udel.edu)

Course web page:

http://goo.gl/tJ4Kn4

April 27, 2017 ❖ Lecture 20

2 of 32

Outline

  • Distributed ray tracing
    • Soft shadows
    • Glossy reflections
  • Bounding volumes
    • Hierarchies
    • Uniform spatial subdivision
  • Light paths & caustics

3 of 32

Basic Ray Tracing: Notes

  • Global illumination effects simulated by basic algorithm are shadows, purely specular reflection/transmission
  • Some outstanding issues
    • Aliasing, aka jaggies
    • Shadows have sharp edges, which is unrealistic
    • No diffuse reflection from other objects
  • Intersection calculations are expensive, and even more so for more complex objects
    • Not currently suitable for real-time (i.e., games)

4 of 32

Ambient Occlusion

  • Extension of shadow ray idea—not every point should get full ambient illumination
  • Idea: Cast multiple random rays (a “distribution of rays”) from each rendered surface point to estimate percent of sky hemisphere that is visible
    • Limit length of rays so distant objects have no effect
    • Cosine weighting/distribution for foreshortening
  • Developers of this idea won a technical Oscar in 2010

5 of 32

Ambient Occlusion: Example

http://www.gavinharrison.co.uk/renderman04.php

6 of 32

DRT Application #2: Soft Shadows

  • For point light sources, sending a single shadow ray toward each is reasonable
    • But this gives hard-edged shadows
  • Simulating soft shadows
    • Model each light source as sphere
    • Send multiple jittered shadow rays toward a light sphere; use fraction that reach it to attenuate color
    • Similar to ambient occlusion, but using list of light sources instead of single hemisphere

7 of 32

Soft Shadows: Example

1 shadow ray

10 shadow rays

50 shadow rays

Note discrete "shadow points" -- need post-processing to smooth into contiguous region

8 of 32

DRT Application #3: Glossy Reflections

  • Analog of hard shadows are “sharp reflections”—every reflective surface acts like a perfect mirror
  • To get glossy or blurry reflections, send out multiple jittered reflection rays and average their colors

Why is the reflection sharper at the top?

9 of 32

DRT for Glossy Reflections

from Hill

10 of 32

Other DRT Effects

  • Depth of field

  • Motion blur

11 of 32

Other DRT Effects

  • Depth of field

  • Motion blur

12 of 32

Bounding Volumes for Efficiency

  • Idea: enclose complex objects (i.e., .obj models) in simpler ones (e.g., spheres, boxes) and test simple intersection before complex intersection
  • Want bounds as tight as possible

13 of 32

Bounding Boxes as Volumes: Multiple Objects

  • With multiple objects in the scene, how to arrange bounding boxes?

A box around each object, or a single box surrounding all objects, are not optimally efficient schemes

14 of 32

Bounding Boxes as Volumes: Multiple Objects

  • With multiple objects in the scene, how to arrange bounding boxes?

Nested boxes impose a hierarchy...

...that allow a more efficient recursive tree search

15 of 32

Uniform Spatial Subdivision

  • Another approach is to divide space equally, such as into boxes
  • Each object "belongs" to every box it intersects
  • Trace ray through boxes sequentially, check every object belonging to current box

16 of 32

Uniform Spatial Subdivision

  • Tracing ray here is a little like rasterizing a line -- must keep track of intersections with current box sides to know which box will be entered next
  • Must make sure that only hits inside current box are reported
    • In figure, cell (i, j) is being checked
    • Object b "belongs" to (i, j) and intersects ray, but hit point is outside (i, j)

17 of 32

Can Ray Tracing Do This?

courtesy of H. Wann Jensen

caustic

18 of 32

Light Paths

  • Consider the path that a light ray might take through a scene between the light source L and the eye E
  • It may interact with multiple diffuse (D) and specular (S) objects along the way
    • Includes reflections, refractions
  • We can describe this series of interactions with the regular expression L (D | S)* E
    • (If a surface is a mix of D and S, the combination is additive so it is still OK to treat in this manner)

from Sillion & Puech

19 of 32

Light Paths: Examples

  • Direct visualization of the light: LE
  • Local illumination: LDE, LSE
  • Ray tracing: LS*E, LDS*E

from Hill

Ray tracing light paths

General light paths

from Sillion & Puech

20 of 32

Caustics

  • Definition: (Concentrated) specular reflection/refraction onto a diffuse surface
    • In simplest form, follow an LSDE path
  • Standard ray tracing cannot handle caustics—only paths described by LDS*E

courtesy of H. Wann Jensen

from Sillion & Puech

21 of 32

Caustics: Examples

22 of 32

More about caustics

  • What is the problem with LS+DE paths for ray tracing?
  • Review: Radiance for a viewing direction given all incoming light:

emitted light

reflected light

23 of 32

Review: BRDFs

  • Bidirectional Reflectance Distribution Function (BRDF): Ratio of outgoing radiance in one direction to incident irradiance from another
  • Can view BRDF as probability that incoming photon will leave in a particular direction (given its incoming direction)

from Sillion & Puech

24 of 32

The Problem with Diffuse Surfaces

  • For specular surfaces, we “know” where the photon will go (= “came from”, if going backwards), whereas for diffuse surfaces there’s much more uncertainty
    • If we’re tracing a ray from the eye and we hit a diffuse surface, this uncertainty means that the source of the photon could be anywhere in the hemisphere
    • Conventional ray tracing just looks for lights at this point, but for LS+DE paths we need to look for other specular surfaces
      • How to find them?

from P. Heckbert

from Sillion & Puech

25 of 32

Bidirectional Ray Tracing (P. Heckbert, 1990)

  • Idea: Trace forward light rays into scene as well as backward eye rays
  • At diffuse surfaces, light rays additively “deposit” photons in radiosity textures, or “rexes”, where they are accessed by eye rays
    • Summation approximates integral term in radiance computation
    • Light rays carry information on specular surface locations—they have no uncertainty

from P. Heckbert

26 of 32

Bidirectional Ray Tracing: Notes

  • This kind of bidirectional ray tracing simulates LS*DS*E paths
  • Photons deposited in rexes are sparse, so they must be interpolated
    • Use density estimation
    • Still have noise issues
  • Storage of illumination only on surfaces means that we ignore fog and other volume-based scattering/absorption (aka “participating media”)

from P. Heckbert

27 of 32

Bidirectional Ray Tracing: Results

from P. Heckbert

Lens, mirrored sphere, and diffuse surface with caustic

of focused light

28 of 32

“Backwards” Ray Tracing (1986)

courtesy of J. Arvo

A technique similar to Heckbert’s was used to form this image

29 of 32

What’s Still Missing?

30 of 32

What’s Still Missing?

from http://gurneyjourney.blogspot.com

(This is a photo)

31 of 32

What’s Still Missing?

An LD*E

scene

courtesy of Cornell

32 of 32

Color Bleeding

  • Transfer of color between diffuse surfaces via reflection

courtesy of K. Fatahalian & J. Hui

White light only, so red and blue on white wall are from bleeding