ray tracing
play

Ray Tracing Recursive rays Reflection Refraction Thanks to - PDF document

Outline Ray Tracing Recursive rays Reflection Refraction Thanks to UDel and MIT Ray Tracing Reflections Model: Perceived color at point p is an additive combination of local illumination (e.g., Phong), reflection, and


  1. Outline Ray Tracing • Recursive rays – Reflection – Refraction Thanks to UDel and MIT Ray Tracing Reflections Model: Perceived color at point p is an additive combination of local • illumination (e.g., Phong), reflection, and refraction effects incident ray v reflected ray r • Compute reflection, refraction contributions by tracing respective rays back from p to surfaces they came from and evaluating local illumination at those locations • Apply operation recursively to some maximum depth to get: – Reflections of reflections of ... – Refractions of refractions of ... – And of course mixtures of the two from Hill Reflection Reflection • Reflection angle = view angle • Reflection angle = view angle MIT EECS 6.837, Cutler and Durand MIT EECS 6.837, Cutler and Durand 25 26 1

  2. Mirror Reflection Mirror Reflection • Compute mirror contribution • Cast ray • Cast ray –In direction symmetric wrtnormal –In direction symmetric wrtnormal • Don’t forget to add epsilon • Multiply by reflection coefficient (color) to the ray Without epsilon With epsilon MIT EECS 6.837, Cutler and Durand MIT EECS 6.837, Cutler and Durand 23 24 Amount of Reflection Amount of Reflection • More realistic : • Traditional (hacky) ray tracing –Fresnelreflection term –Constant coefficient –More reflection at grazing angle reflectionColor –Schlick’sapproximation: R( θ )= R0+ (1-R0)(1-cos θ ) 5 – Component per component multiplication MIT EECS 6.837, Cutler and Durand MIT EECS 6.837, Cutler and Durand 27 28 Example: Reflections at depth = 0 2

  3. Example: Reflections at depth = 1 Example: Reflections at depth = 2 Transparency Example: Reflections at depth = 3 • Compute transmitted contribution • Cast ray –In refracted direction • Multiply by transparency coefficient (color) 31 Refraction Qualitative refraction Snell-Descartes Law • From “Color and Light in Nature” by Lynch and Livingston n i sin  i = n t sin  t MATERIAL INDEX OF REFRACTION air/vacuum 1 water 1.33 glass about 1.5 diamond 2.4 Note that I is the negative of the incoming ray MIT EECS 6.837, Cutler and Durand MIT EECS 6.837, Cutler and Durand 33 32 3

  4. Refraction Refraction n i sin  i = n t sin  t Snell-Descartes Law Snell-Descartes Law Note that I is the negative of the incoming ray Note that I is the negative of the incoming ray MIT EECS 6.837, Cutler and Durand 34 MIT EECS 6.837, Cutler and Durand 35 Refraction Refraction Snell-Descartes Law Note that I is the negative of the incoming ray Use: sin 2  + cos 2  = 1 MIT EECS 6.837, Cutler and Durand MIT EECS 6.837, Cutler and Durand 36 37 Total internal reflection Refraction • From “Color and Light in Nature” by Lynch and Livingstone MIT EECS 6.837, Cutler and Durand MIT EECS 6.837, Cutler and Durand 38 39 4

  5. Example: Refraction Ray Tracing Example (with texture mapping) courtesy of J. Lee The Ray Tree Refraction and the lifeguard problem • Running is faster than swimming Ni surface normal Ri reflected ray Li shadow ray Ti transmitted (refracted) ray MIT EECS 6.837, Cutler and Durand MIT EECS 6.837, Cutler and Durand 42 51 Ray Tree Basic Ray Tracing: Notes Draw the ray-tree to depth 3 for the following initial ray (boxes are solid plastic, sphere is glass): • Intersection calculations are expensive, and even more so for more complex objects – Not currently suitable for real-time (i.e., games) N • Only global illumination effect is purely specular reflection/transmission – No “diffuse reflection” from other objects ! Still using ambient term – One remedy is radiosity (slow, offline, precompute – Ambient Occlusion • Shadows have sharp edges, which is unrealistic – next lecture 5

  6. Phong shading Ambient Occlusion Ambient Occlusion Ambient Occlusion Ambient Occlusion Ray Tracing: Improvements • Image quality: Anti-aliasing – Supersampling: Shoot multiple rays per pixel (grid or jittered) • Adaptive: More rays in areas where image is changing more quickly • Efficiency: Bounding extents – Idea: Enclose complex objects in shapes (e.g., sphere, box) that are less expensive to test for intersection – Next lecture 6

  7. Supersampling Adaptive Supersampling (Whitted’s method) • Rasterize at higher resolution • Shoot rays through 4 pixel corners – Regular grid pattern around each and collect colors “normal” image pixel • Provisional color for entire pixel is – Irregular jittered sampling pattern average of corner contributions reduces artifacts • Combine multiple samples into – If you stop here, the only overhead one pixel via weighted average vs. center-of-pixel ray-tracing is – “Box” filter: All samples associated another row, column of rays with a pixel have equal weight (i.e., • If any corner’s color is too directly take their average) different, subdivide pixel into from Hill – Gaussian/cone filter: Sample weights Regular inversely proportional to distance supersampling Jittered quadrants and recurse on from associated pixel from Hill with 2x supersampling quadrants frequency Adaptive Supersampling: Details OK Must subdivide 7

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend