1 / 12

Path Tracing

Path Tracing. CS 319 Advanced Topics in Computer Graphics John C. Hart. objects. lights. Ray Tracing. Whitted, CACM 80 LDS*E Rays cast from eye into scene Why? Because most rays cast from light wouldn’t reach eye Shadow rays cast at each intersection

drago
Download Presentation

Path Tracing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Path Tracing CS 319 Advanced Topics in Computer Graphics John C. Hart

  2. objects lights Ray Tracing • Whitted, CACM 80 • LDS*E • Rays cast from eye into scene Why? Because most rays cast from light wouldn’t reach eye • Shadow rays cast at each intersection Why? Because most rays wouldn’t reach the light source • Workload badly distributed Why? Because # of rays grows exponentially, and their result becomes less influential

  3. Tough Cases • Caustics • Light focuses through a specular surface onto a diffuse surface • LSDE • Which direction should secondary rays be cast to detect caustic? • Bleeding • Color of diffuse surface reflected in another diffuse surface • LDDE • Which direction should secondary rays be cast to detect bleeding?

  4. objects lights Path Tracing • Kajiya, SIGGRAPH 86 • Diffuse reflection spawns infinite rays • Pick one ray at random • Cuts a path through the dense ray tree • Still cast an extra shadow ray toward light source at each step in path • Trace 40 paths per pixel

  5. Approximate Integration • Can’t solve integral symbolically • Replace continuous integral with discrete summation  f(x)dx  S f(xi)Dxi • Discretization requires sampling • Potential Sampling Problems • Aliasing • Jitter samples • Biasing • Ensure samples properly distributed • Inaccuracy • Ensure samples representative

  6. Importance Sampling • Areas of constant illumination need few samples • walls, floors, table tops • Areas of interesting illumination need many samples • edges, shadow boundaries, caustic boundaries • cast rays in high variance directions of reflectivity • Important that bright areas receive at least one sample • cast a ray directly to light source • cast a ray in highlight direction of reflectivity

  7. Stratified Sampling • Add sample until variance falls below threshold • Sequential Uniform Sampling • Lee, Redner and Uselton SIGGRAPH 85 • Subdivide largest area first • Breadth first subdivision • Hierarchical Integration • Weight samples by area represented • Variance becomes O(1/n2) instead of O(1/n)

  8. Examples Jensen, Stanford

  9. Probability Distributions p(z) Uniform pdffrom a to b 1/(b-a) • Continuous real random variable z • Probability density function (pdf) p(z) • Prob. of choosing a (P[z=a]) is p(a) • Prob. of azb is abp(z)dz • Pdf is always positive: p(z) 0 z • Pdf sums to 100%: p(z)dz = 1 • Expected value: E[f(z)] = f(z)p(z)dz • Linear, regardless of corr. of f and g E[f(z)+g(z)] = E[f(z)] + E[g(z)] • Variance: V[z] = E[(z – E[z])2] • Easier to compute as: E[z 2] – E[z]2 z 0 a b p(z) = 2z 2 1 z 0 0 1 Prob. z < 50% is 25%

  10. Monte Carlo Integration L(w) w • Expected value of f • Given random variable z • With pdf p E[f(z)] = f(z)p(z)dz • Implemented as • So to integrate some function g • Pick samples z with pdf p, then Uniform samples waste toomuch time measuring low light L(w) w Non-uniform samples skewedtoward brighter directions, butbias result to appear too bright Dividing by pdf gives multiple samplesin brighter areas less weight. Ideal pdf is a normalized version of the integrand.

  11. Monte Carlo Path Tracing • Reflectance equation Lr(wr) = Le(wr) + W fr(wi,wr)Li(wi) cosqi dwi • Path tracing • Repeated recursive evaluation of • Assume diffuse surface fr(wi,wr) = r/p • Setting p(wi) = (1/p) cos qi yields Lr(wr) = Le(wr) + r Li(wi) Dwi • How can we pick wi with prob. (1/p) cos qi ? • Use Nusselt analog of random disk points

  12. Sampling Strategies • Sampling incident radiance • Bias samples toward direction of maximal incident radiance • Sampling the BRDF • Bias samples toward directions of maximal reflectance

More Related