Interactive Ray Tracing CS 851 David Luebke University of Virginia
Admin Exchange names Decide on meeting times –Goal: two minute sessions/week Go over syllabus (oops) Note: next week we will crash Greg Humphrey’s Image Synthesis course –MEC 339 –Tue, Thu 3:30-4:45 –Videotaped if you can’t get there –No meetings otherwise.
Interactive Ray Tracing Long considered an oxymoron, or a joke –“Field of VAX” “Field of Cray” Has quickly become a generally accepted part of the future of interactive graphics The big questions: –How? –Why?
Interactive Ray Tracing: Why do it? Ray tracing has some definite advantages over traditional “forward” rendering –Name some of them
Interactive Ray Tracing: Advantages Cliché, attributed to Jim Kajiya(?): “For a complex enough scene, ray tracing will always be faster” –Why would he say this? –When is it not true?
Interactive Ray Tracing: Advantages Efficient: –Asymptotically efficient: Depth complexity & early termination –“Just makes sense” efficient Triangles are a vehicle for hardware to efficiently interpolate pixels But triangles are getting smaller than pixels…
Interactive Ray Tracing: Advantages Elegant! –Whitted’s recursive ray tracing nicely addressed several problems at once: Visible surface determination Shadows Reflection/refraction –Its successors have addressed many more: Global illumination/indirect illumination Motion blur, depth of field Etc
Interactive Ray Tracing: Advantages Lends itself to sophisticated shading –Effects: motion blur, shadows, reflection, etc –Nice model for programmable shading –Antialiasing Stochastic sampling Adaptive supersampling Easy to add support for new primitives –Height field –NURBS –Volumes, implicit surfaces, metaballs, etc.
Interactive Ray Tracing: Advantages Scales well! –The term is “embarrassingly parallel” –Under what conditions? –What is a limiting factor in interactive use?
Interactive Ray Tracing: Advantages: Presents prospect for wacky new rendering algorithms and acceleration schemes –Decouples spatial sampling from raster grid Gaze-directed rendering Increased sampling near silhouettes, etc –Decouples spatial from temporal sampling Frameless rendering Interruptible rendering
Interactive Ray Tracing: Disadvantages Time complexity grows linearly with the number of pixels –And there’s a lot of pixels on today’s displays We rarely (?) want to render a million polygons at interactive rates We often want to render a million pixels at interactive rates –However, displays are growing more slowly than models
Interactive Ray Tracing: Disadvantages Recursive ray tracing is an elegant and simple algorithm It’s also poorly suited to efficient hardware implementation –Recursion == bad –Poor memory coherence (especially for naive depth-first algorithm)
Interactive Ray Tracing: Disadvantages As a result there’s no real ray tracing hardware –Some entrepreneurial stabs –Some special markets Volume-rendering hardware Accelerated offline rendering hardware –But nothing to compare with maturity and size of polygon rendering hardware market
Related Work: Parker et al First demonstrated interactive ray tracing system: Parker et al, U. of Utah, 1999 –Brute force… Straightforward implementation Explicitly traces rays through every pixel Simple acceleration structure (uniform grid) Careful attention to optimizing system resources – …on a $2.5 million supercomputer 64 node SGI Origin “Reality Monster” CC-NUMA shared-memory multicomputer Fast interconnect Fine-grained message passing
Related Work: Parker et al Parker et al demonstrated several advantages of ray tracing: –Big data –Sophisticated shading –Direct rendering of multiple primitives –Frameless rendering Other contributions –A clever soft shadows hack –A clever ambient lighting hack Show the movie
Related Work: Utah Since then, the Utah group has done research on: –Ray tracing dynamic scenes: incrementally updating acceleration data structures –Ray tracing volumes: lots of acceleration techniques for volumes, e.g. MRI data –A cute trick for improving the appearance of antialiased ray-traced images during motion Some images and movies at:
Related Work: Wald & Slusallek Ingo Wald, Philip Slusallek: the next big contributors; lots of publications Basic idea: ray trace on standard PC hardware, scale to clusters –On dual-PIII 800 MHz, report fps on models from 40K-8M tris –A cluster of 7 PCs achieves 5-10 fps on the 13 million triangle UNC Powerplant
Related Work: Wald & Slusallek Big ideas: –Coherence: Restructure ray tracing computation to increase coherence “Partial breadth-first evaluation” Ray trace small bundles of rays Intersect all rays in bundle with every triangle, even if some have already terminated Good cache coherence, can use SIMD instructions –Scalability: use cluster of PCs with client- server architecture Hand out bundles to be rendered Clients cache geometry (don’t replicate scene)
Related Work: The Render Cache Work by Bruce Walters, currently at Cornell; also by Reinhard et al (Utah) Basic idea: –Cache ray “hits” as shaded 3D points –Reproject points for new viewpoint –Now many pixels already have (possibly stale) color! Web page w/ good examples, source:
Related Work: The Ray Engine Nathan Carr, Jesse Hall, John Hart (University of Illinois) Basic idea: Put ray-tracing intersection on the fragment hardware –Ray intersection is a crossbar: Intersect a bunch of rays with a bunch of triangles, keep closest hit on each ray –Triangle rasterization is a crossbar: Intersect a bunch of pixels with a bunch of triangles, keep closest hit at each pixel
Related Work: Ray Tracing on Prog. Gfx Hdwr Tim Purcell, Ian Buck, Bill Mark, Pat Hanrahan (Stanford, NVIDIA) Idea: put all aspects of ray tracing computation into fragment hardware –Formulate ray tracing as a stream computation –Map streams to textures, kernels to fragment programs
Upcoming Topics Ray Tracing fundamentals (Humphreys) –Read Whitted (1980), any other readings Ray Tracing acceleration follow-up (Luebke, if necessary) Modern graphics hardware (Luebke) Papers to follow…
Projects A semester-long project related to interactive ray tracing –Code up an IRT –Do something interesting with an existing one –Novel sampling/reconstruction algorithms –Use the hypothetical cluster Project proposals due Mar 1 Can work in pairs
Questions?