CS 655 Computer Graphics - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

CS 655 Computer Graphics

Description:

x via x' scattered. twice. Light to. x via x' scattered. three ... At each bounce, send a ray out in the direction determined according to some distribution ... – PowerPoint PPT presentation

Number of Views:16
Avg rating:3.0/5.0
Slides: 29
Provided by: cs6
Category:

less

Transcript and Presenter's Notes

Title: CS 655 Computer Graphics


1
CS 655 Computer Graphics
  • Path Tracing
  • (some material from University of Wisconsin)

2
Path Tracing
  • An extension to ray tracing
  • Simulates global illumination
  • Can handle all possible light bounces
  • L(SD)E
  • Introduced by Kajiya as a solution to the
    rendering equation
  • Stochastically samples all light paths
  • Handles area light sources, diffuse reflections
  • Approximates the integral of illumination

3
Path Tracing Algorithms
  • Determine the intensity of each pixel by tracing
    light transport paths
  • Paths that start at light sources and carry
    energy
  • A path of length k is a sequence of vertices
  • ltx0, , xk-1gt where every xi and xi1 is
    mutually
  • visible and x0 is on a light

4
Important Paths
  • We are most interested in the important paths
  • Paths that go from a light source to the eye
  • Paths that carry the most energy
  • The rendering equation can be written as a sum of
    integrals, each one integrating over a different
    path length

5
The Rendering Equation - reordered
Light to x directly from x
Light from light source to x, then to x
Light to x via x scattered twice
Light to x via x scattered three times
etc.
6
Sampling Important Paths
  • We want to evaluate the integral using importance
    sampling
  • i.e., attempt to sample the most important paths
  • How do we find those paths?
  • Several approaches have been tried

7
Naïve Path Tracing (version 1)
  • Start at a light
  • Build a path by randomly choosing a direction at
    each bounce, send the ray in that direction, and
    add the point hit to the path vertex list
  • Join the last point to the eye
  • Problems? What path is achieved by this approach?

8
Naïve Path Tracing (version 2)
  • Start at eye
  • Build a path by randomly choosing a direction at
    each bounce, follow the path in that direction,
    add the point hit to the path vertex list
  • Optionally join the last point to a light
  • Problems? What paths are generated?

9
Path Tracing (Kajiya)
  • Start at eye
  • At each bounce, send a ray out in the direction
    determined according to some distribution
  • At each point on the path, cast a shadow ray and
    add direct lighting contribution at that point
  • Send multiple paths per pixel, average the
    contributions to get the final intensity

10
Path Tracing (Kajiya) Sampling Strategies
  • The way in which the direction of each bounce is
    determined makes a big difference in image
    quality.
  • Stratified Sampling
  • Break the possible directions into sub-regions
    and cast one sample per sub-region.
  • Importance Sampling
  • Sample according to the BRDF

11
Path Tracing (Kajiya) - Summary
  • Pros
  • Focuses on objects that are visible doesnt
    waste time on objects that cant be seen
  • Spends equal time on all path lengths
  • ray tracing spends more time on longer paths
  • Cons
  • Little information gain for each ray cast
  • Not easy to get good (important) samples
  • Spends equal time on slow-varying diffuse
    components and fast varying specular components

12
Path Tracing Algorithm
  • Send a ray through a pixel
  • Trace the ray to its first intersected object
  • From the intersected object, send out
  • One ray to each light source
  • One additional ray
  • a diffusely reflected ray,
  • a specularly reflected ray, or
  • a transmissive ray
  • Trace the ray and recursively follow it, as above
  • Produces a ray path not a ray tree

13
Light ray
Light
Eye
Image plane
14
Illuminance ray
Light
Diffuse?
Specular?
Transmission?
Eye
Image plane
15
Path Tracing
  • This provides a Monte Carlo approach to global
    illumination
  • Stochastic samples are taken that should
    represent the actual surface properties
  • The lighting distribution is sampled by tracing
    rays stochastically along all possible light
    paths
  • Averaging a large number of sample rays gives an
    estimate of the integral of all light paths
    through the pixel

16
Selecting the ray to trace
  • How do we select which ray to trace?
  • Each material has a kd, ks, and kt
  • Let ktot kd ks kt
  • Select a random number R in the range (0, ktot )
  • if (R lt kd) then send diffuse ray
  • else if (R lt kd ks) then send specular ray
  • else send transmission ray

17
Tracing a Diffuse Reflection
  • Ideal diffuse reflection

Light is scattered equally in all directions
18
Tracing a Diffuse Reflection
  • Tracing a ray from the eye, the light I see could
    have come from any direction (direct from the
    light, or indirect from another object)

Randomly pick a direction and trace it
19
Computing the Diffuse reflection
  • We can compute a random direction as follows
  • Given two random numbers x1in 0,1 and x2 in
    0,1, the randomly reflected direction wd is
    given by
  • wd (q, f) (cos-1(sqrt(x1)), 2px2 )

20
Tracing a Specular Reflection
  • Ideal specular reflection

Light is scattered according to the reflection
direction
21
Tracing a Specular Reflection
  • As with diffuse lighting, tracing a ray from the
    eye, the light I see could have come from any
    direction (direct from the light, or indirect
    from another object)

Light is scattered according to the reflection
direction
22
Problems
  • Need to trace a lot of rays to get an accurate
    image
  • Typically trace 100 1000 rays per pixel

23
Problems
  • Need to trace a lot of rays to get an accurate
    image
  • Typically trace 100 1000 rays per pixel

24
  • 10,000 rays per pixel (Henrik Wann Jensen)

25
Bi-directional Path Tracing
  • What if we were to combine rays from both
    directions?
  • Send a ray from the eye and trace it into the
    scene
  • Send a ray from the light and trace it into the
    scene
  • Combine them by sending a ray from the end of one
    path to the end of the other path

26
Bi-directional Path Tracing
  • Pros
  • Each ray cast contributes to many paths
  • Building from both ends can catch difficult cases
  • All specular paths
  • Caustics
  • The idea extends to participating media
  • Cons
  • Still spends a lot of time in slow varying
    diffuse areas
  • May not sample some of the more difficult paths

27
Example Mirror
Eye ray tracing ESDL
Light ray tracing LSDE
Problematic ESDSL
Even Worse LSDSDSE
28
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com