1 / 70

CS 431/636 Advanced Rendering Techniques

CS 431/636 Advanced Rendering Techniques. Dr. David Breen University Crossings 149 Tuesday 6PM  8:50PM. Presentation 4 4/22/08. Questions from Last Week?. Color models Light models Phong shading model Assignment 2. Slide Credits.

rlangley
Download Presentation

CS 431/636 Advanced Rendering Techniques

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. CS 431/636 Advanced Rendering Techniques Dr. David Breen University Crossings 149 Tuesday 6PM  8:50PM Presentation 4 4/22/08

  2. Questions from Last Week? • Color models • Light models • Phong shading model • Assignment 2

  3. Slide Credits • Leonard McMillan, Seth Teller, Fredo Durand, Barb Cutler - MIT • David Luebke - University of Virginia • Matt Pharr - Stanford University • Jonathan Cohen - Johns Hopkins U. • Kevin Suffern -University of Technology, Sydney, Australia

  4. Motivation

  5. Extra rays needed for these effects • Distributed Ray Tracing • Soft shadows • Anti-aliasing (getting rid of jaggies) • Glossy reflection • Motion blur • Depth of field (focus)

  6. Shadows • one shadow ray per intersection per point light source no shadow rays one shadow ray

  7. Soft Shadows • multiple shadow rays to sample area light source one shadow ray lots of shadow rays

  8. jaggies w/ antialiasing Antialiasing – Supersampling • multiple rays per pixel point light area light

  9. Reflection • one reflection ray per intersection perfect mirror θ θ

  10. θ θ Glossy Reflection • multiple reflection rays Justin Legakis polished surface

  11. Motion Blur • Sample objects temporally Rob Cook

  12. Depth of Field • multiple rays per pixel film focal length Justin Legakis

  13. can we reduce this? Algorithm Analysis • Ray casting • Lots of primitives • Recursive • Distributed Ray Tracing Effects • Soft shadows • Anti-aliasing • Glossy reflection • Motion blur • Depth of field • cost ≤ height * width * • num primitives * • intersection cost * • num shadow rays * • supersampling * • num glossy rays * • num temporal samples * • max recursion depth * • . . .

  14. Bounding Regions

  15. Acceleration of Ray Casting • Goal: Reduce the number of ray/primitive intersection tests

  16. Conservative Bounding Region • First check for an intersection with a conservative bounding region • Early reject

  17. bounding sphere non-aligned bounding box axis-aligned bounding box arbitrary convex region (bounding half-spaces) Conservative Bounding Regions • tight avoid false positives • fast to intersect

  18. Bounding Volumes • What makes a “good” bounding volume? • Tightness of fit (expressed how?) • Simplicity of intersection Total cost = b*B + i*I • b: # times volume tested for intersection • B: cost of ray-volume intersection test • i: # times item is tested for intersection • I: cost of ray-item intersection test

  19. bounding sphere Bounding Volumes • Spheres • Cheap intersection test • Poor fit • Somewhat expensive to fit to data

  20. axis-aligned bounding box Bounding Volumes • Axis-aligned bounding boxes (AABBs) • Relatively cheap intersection test • Usually better fit • Trivial to fit to data

  21. oriented bounding box Bounding Volumes • Oriented bounding boxes (OBBs) • Medium-expensive intersection test • Very good fit (asymptotically better) • Medium-difficult to fit to data

  22. arbitrary convex region (bounding half-spaces) Bounding Volumes • Slabs (parallel planes) • Comparatively expensive • Very good fit • Very difficult to fit to data

  23. Intersection with Axis-Aligned Box From Lecture 2 • For all 3 axes, calculate the intersection distances t1 and t2 • tnear= max (t1x, t1y, t1z)tfar= min (t2x, t2y, t2z) • If tnear> tfar, box is missed • If tfar< 0, box is behind • If box survived tests, report intersection at tnear t2x tfar y=Y2 t2y tnear t1x y=Y1 t1y x=X2 x=X1

  24. (xmax, ymax, zmax) (x0, y0, z0) = (max(x0,x1,x2),max(y0,y1,y2),max(z0,z1,z2)) (x1, y1, z1) (x2, y2, z2) Bounding Box of a Triangle (xmin, ymin, zmin) = (min(x0,x1,x2), min(y0,y1,y2),min(z0,z1,z2))

  25. (xmax, ymax, zmax) = (x+r, y+r, z+r) r (x, y, z) (xmin, ymin, zmin) = (x-r, y-r, z-r) Bounding Box of a Sphere

  26. (xmax, ymax, zmax) (xmax_a, ymax_a, zmax_a) = (max(xmax_a,xmax_b), max(ymax_a,ymax_b),max(zmax_a,zmax_b)) (xmax_b, ymax_b, zmax_b) (xmin_b, ymin_b, zmin_b) (xmin_a, ymin_a, zmin_a) (xmin, ymin, zmin) = (min(xmin_a,xmin_b), min(ymin_a,ymin_b),min(zmin_a,zmin_b)) Bounding Box of a Group

  27. Acceleration Spatial Data Structures

  28. Spatial Data Structures • Spatialpartitioning techniques classify all space into non-overlapping portions • Easier to generate automatically • Can “walk” ray from partition to partition • Hierarchical bounding volumes surround objects in the scene with (possibly overlapping) volumes • Often tightest fit

  29. Spatial Partitioning • Some spatial partitioning schemes: • Regular grid (2-D or 3-D) • Octree • k-D tree • BSP-tree

  30. Acceleration Spatial Data Structures Regular Grid

  31. Regular Grid

  32. Cell (i, j) gridy gridx Create grid • Find bounding box of scene • Choose grid spacing • gridx need not = gridy

  33. Insert primitives into grid • Primitives that overlap multiple cells? • Insert into multiple cells (use pointers)

  34. For each cell along a ray • Does the cell contain an intersection? • Yes: return closestintersection • No: continue

  35. Preventing repeated computation • Perform the computation once, "mark" the object • Don't re-intersect marked objects

  36. Don't return distant intersections • If intersection t is not within the cell range, continue (there may be something closer)

  37. Cell (i, j) tnext_h tnext_v tnext_v tmin tnext_h tmin Where do we start? • Intersect ray with scene bounding box • Ray origin may be inside the scene bounding box

  38. dtv = gridy / diry gridy dth = gridx / dirx (dirx, diry) gridx Is there a pattern to cell crossings? • Yes, the horizontal and vertical crossings have regular spacing

  39. Cell (i+1, j) Cell (i, j) tnext_h tnext_v tmin dth dtv (dirx, diry) What's the next cell? if tnext_v < tnext_h i += signx tmin = tnext_v tnext_v += dtv else j += signy tmin = tnext_h tnext_h += dth if (dirx > 0) signx = 1 else signx = -1 if (diry > 0) signy = 1 else signy = -1

  40. What's the next cell? • 3DDDA – Three Dimensional Digital Difference Analyzer • 3D Bresenham Algorithm

  41. Pseudo-code create grid insert primitives into grid for each ray r find initial cell c(i,j), tmin, tnext_v & tnext_h compute dtv, dth, signx and signy while c != NULL for each primitive p in c intersect r with p if intersection in range found return c = find next cell

  42. Regular Grid Discussion • Advantages? • easy to construct • easy to traverse • Disadvantages? • may be only sparsely filled • geometry may still be clumped

  43. Acceleration Spatial Data Structures Adaptive Grids

  44. Nested Grids Octree/(Quadtree) Adaptive Grids • Subdivide until each cell contains no more than n elements, or maximum depth d is reached

  45. Octree/(Quadtree) Primitives in an Adaptive Grid • Can live at intermediate levels, orbe pushed to lowest level of grid

  46. Adaptive Grid Discussion • Advantages? • grid complexity matches geometric density • Disadvantages? • more expensive to traverse (especially octree)

  47. k-D Trees • k-D tree pros: • Moderately simple to generate • More adaptive than octrees • k-D tree cons: • Less efficient to trace rays across • Moderately complex data structure

More Related