1 / 35

Ray Tracing and PBRT

Ray Tracing. TodayBasic algorithmsOverview of pbrtRay-surface intersection for single surfaceNext lectureAcceleration techniques for ray tracing large numbers of geometric primitives. Classic Ray Tracing. Greeks: Do light rays proceed from the eye to the light, or from the light to the eye?Gau

hosea
Download Presentation

Ray Tracing and PBRT

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. Ray Tracing and PBRT

    2. Ray Tracing Today Basic algorithms Overview of pbrt Ray-surface intersection for single surface Next lecture Acceleration techniques for ray tracing large numbers of geometric primitives

    3. Classic Ray Tracing Greeks: Do light rays proceed from the eye to the light, or from the light to the eye? Gauss: Rays through lenses Three ideas about light 1. Light rays travel in straight lines 2. Light rays do not interfere with each other if they cross 3. Light rays travel from the light sources to the eye (but the physics is invariant under path reversal - reciprocity). Eventually get the detailed history of the Greeks right. Marc has some notes on this in his lectures on perspective. Photons are bosons. 3. And the Greek ideas are related, but not together on the slide. The Gauss thing is tangential.Eventually get the detailed history of the Greeks right. Marc has some notes on this in his lectures on perspective. Photons are bosons. 3. And the Greek ideas are related, but not together on the slide. The Gauss thing is tangential.

    4. Ray Tracing in Computer Graphics Appel 1968 - Ray casting 1. Generate an image by sending one ray per pixel 2. Check for shadows by sending a ray to the light

    5. Ray Tracing in Computer Graphics Whitted 1979 Recursive ray tracing (reflection and refraction)

    6. Spheres-over-plane.pbrt (g/m 10)

    7. Spheres-over-plane.pbrt (mirror 0)

    8. Spheres-over-plane.pbrt (mirror 1)

    9. Spheres-over-plane.pbrt (mirror 2)

    10. Spheres-over-plane.pbrt (mirror 5)

    11. Spheres-over-plane.pbrt (mirror 10)

    12. Spheres-over-plane.pbrt (glass 0)

    13. Spheres-over-plane.pbrt (glass 1)

    14. Spheres-over-plane.pbrt (glass 2)

    15. Spheres-over-plane.pbrt (glass 5)

    16. Spheres-over-plane.pbrt (glass 10)

    17. Spheres-over-plane.pbrt (glass 10)

    19. PBRT Architecture

    20. PBRT Architecture

    21. Ray-Surface Intersection

    22. Ray-Plane Intersection Ray: Plane: Solve for intersection Substitute ray equation into plane equation

    23. Ray-Polyhedron Ray-slab Optimize code so parts of the dot products are not duplicated Find tmin and tmax If slabs are perpendicular to the principal directions, can reduce calculation further Ray-bbox Compute tmin and tmax for the first set of parallel planes Compute tmin and tmax for the second set of parallel planes Find the max of the mins, and the min of the maxes Ray-convex polyhedra Compute all the tmins; mins are defined as rays crossing from positive to negative half-space Compute all the tmaxs; maxs are defined as rays crossing from negative to positive half-spaces Take the max of the mins, and the min of the maxs Check whether the point is inside the convex half-spaces Note this is an O(n) algorithm. The simplest algorithm, find each intersection and test whether It is inside the polyhedra is O(n^2). In all these examples need to be careful that the intersection is in the positive half-interval of the ray Ray-slab Optimize code so parts of the dot products are not duplicated Find tmin and tmax If slabs are perpendicular to the principal directions, can reduce calculation further Ray-bbox Compute tmin and tmax for the first set of parallel planes Compute tmin and tmax for the second set of parallel planes Find the max of the mins, and the min of the maxes Ray-convex polyhedra Compute all the tmins; mins are defined as rays crossing from positive to negative half-space Compute all the tmaxs; maxs are defined as rays crossing from negative to positive half-spaces Take the max of the mins, and the min of the maxs Check whether the point is inside the convex half-spaces Note this is an O(n) algorithm. The simplest algorithm, find each intersection and test whether It is inside the polyhedra is O(n^2). In all these examples need to be careful that the intersection is in the positive half-interval of the ray

    24. Ray-Triangle Intersection 1 These are areas in 2D This diagram applies in 2D. These are areas in 2D This diagram applies in 2D.

    25. 2D Homogeneous Coordinates

    26. 2D Homogeneous Coordinates

    27. Ray-Triangle Intersection 2 This is a leap to 3D! Not as obvious. First find intersection with plane of support Second test whether point of intersection is inside the triangle In 3D, the determinants are triple products. Triple products correspond to the volume of the parallelpiped formed by the 3 vectors The readings include the Trumbone paper on improvements to this algorithm The readings also include a paper by me on how to interpret this in terms of line coordinates.This is a leap to 3D! Not as obvious. First find intersection with plane of support Second test whether point of intersection is inside the triangle In 3D, the determinants are triple products. Triple products correspond to the volume of the parallelpiped formed by the 3 vectors The readings include the Trumbone paper on improvements to this algorithm The readings also include a paper by me on how to interpret this in terms of line coordinates.

    28. Ray-Triangle Intersection 3 First find intersection with plane of support Second test whether point of intersection is inside the triangle In 3D, the determinants are triple products. Triple products correspond to the volume of the parallelpiped formed by the 3 vectors The readings include the Trumbone paper on improvements to this algorithm The readings also include a paper by me on how to interpret this in terms of line coordinates.First find intersection with plane of support Second test whether point of intersection is inside the triangle In 3D, the determinants are triple products. Triple products correspond to the volume of the parallelpiped formed by the 3 vectors The readings include the Trumbone paper on improvements to this algorithm The readings also include a paper by me on how to interpret this in terms of line coordinates.

    29. Ray-Polygon Intersection 1. Find intersection with plane of support 2. Test whether point is inside 3D polygon Project onto xy plane Test whether point is inside 2D polygon

    30. Point in Polygon inside(vert v[], int n, float x, float y) { int cross=0; float x0, y0, x1, y1; x0 = v[n-1].x - x; y0 = v[n-1].y - y; while( n-- ) { x1 = v->x - x; y1 = v->y - y; if( y0 > 0 ) { if( y1 <= 0 ) if( x1*y0 > y1*x0 ) cross++; } else { if( y1 > 0 ) if( x0*y1 > y0*x1 ) cross++; } x0 = x1; y0 = y1; v++; } return cross & 1; } Didn’t have time to go over this in detail.Didn’t have time to go over this in detail.

    31. Ray-Sphere Intersection Sometimes D is assumed to have unit length; then D^2 is 1. If I right this up, I should go through the precision analysis. There are two ways to solve the quadratic equation. Slusallek pointed this out to me.Sometimes D is assumed to have unit length; then D^2 is 1. If I right this up, I should go through the precision analysis. There are two ways to solve the quadratic equation. Slusallek pointed this out to me.

    32. Geometric Methods Methods Find normal and tangents Find surface parameters e.g. Sphere Normal Parameters

    33. Ray-Implicit Surface Intersection 1. Substitute ray equation 2. Find positive, real roots Univariate root finding Newton’s method Regula-falsi Interval methods Heuristics

    34. Ray-Algebraic Surface Intersection Degree n Linear: Plane Quadric: Spheres, … Quartic: Tori Polynomial root finding Quadratic, cubic, quartic Bezier/Bernoulli basis Descartes’ rule of signs Sturm sequences Add something about patches P(u,v)Add something about patches P(u,v)

    35. History Polygons Appel ‘68 Quadrics, CSG Goldstein & Nagel ‘71 Tori Roth ‘82 Bicubic patches Whitted ‘80, Kajiya ‘82 Superquadrics Edwards & Barr ‘83 Algebraic surfaces Hanrahan ‘82 Swept surfaces Kajiya ‘83, van Wijk ‘84 Fractals Kajiya ‘83 Height fields Coquillart & Gangnet ’84, Musgrave ‘88 Deformations Barr ’86 Subdivision surfs. Kobbelt, Daubert, Siedel, ’98 P. Hanrahan, A survey of ray-surface intersection algorithms

More Related