ray tracing
play

Ray Tracing CS 148: Summer 2016 Introduction of Graphics and - PowerPoint PPT Presentation

Ray Tracing CS 148: Summer 2016 Introduction of Graphics and Imaging Zahid Hossain https://en.wikipedia.org/wiki/Ray_tracing_%28graphics%29 Paths of Light http://software.intel.com/file/37491 2 CS 148: Introduction to Computer Graphics and


  1. Ray Tracing CS 148: Summer 2016 Introduction of Graphics and Imaging Zahid Hossain https://en.wikipedia.org/wiki/Ray_tracing_%28graphics%29

  2. Paths of Light http://software.intel.com/file/37491 2 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  3. Paths of Light Light source http://software.intel.com/file/37491 3 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  4. Paths of Light Light interacts with objects in scene http://software.intel.com/file/37491 4 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  5. Paths of Light Image plane http://software.intel.com/file/37491 5 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  6. Problem ?? Most light do not reach the camera http://software.intel.com/file/37491 6 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  7. Forward Ray Tracing Trace rays from light to camera 7 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  8. Backward Ray Tracing Trace rays from light to camera 8 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  9. Ray Tracing Algorithm Trace a ray through each pixel • Intersect with geometry • Trace a shadow ray to the light • Shade the pixel • http://www.scratchapixel.com/lessons/3d-basic-rendering/introduction-to-ray-tracing/implementing-the-raytracing-algorithm 9 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  10. Ray Tracing Algorithm Trace a ray through each pixel • Intersect with geometry • Trace a shadow ray to the light • Shade the pixel • Shadow if light not visible • http://www.scratchapixel.com 10 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  11. Simple to implement • For a simple case: • http://www.scratchapixel.com/code.php?id=3&origin=/l essons/3d-basic-rendering/introduction-to-ray-tracing Few lines of code; already impressive 11 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  12. Recursive Ray Tracing http://www.scratchapixel.com/images/upload/ray-tracing-refresher/rt-whitted-example.png? 12 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  13. Whitted Ray Tracing T. Whitted, Communications of ACM, 1980 Render Time: 74 minutes 13 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  14. Today: nVidia OptiX Render Time: 16 ms ! (60 fps): my Macbook Pro nVidia GTX M750 14 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  15. Today: Realism http://images.povcomp.com/entries/images/105_main.jpg 15 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  16. Today: Realism http://images.povcomp.com/entries/images/105_main.jpg 16 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  17. Rasterizer Vs Ray-Tracing Rasterization for (each object in scene) drawObject(); 17 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  18. Rasterizer Vs Ray-Tracing Rasterization for (each object in scene) drawObject(); Ray Tracing for (each pixel in image) sendRay(); 18 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  19. Rasterization Vs Ray Tracing Rasterization for (each object in scene) drawObject(); Ray Tracing for (each pixel in image) sendRay(); 19 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  20. Math for Ray Tracing 20 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  21. Ray 21 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  22. Ray 22 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  23. Ray 23 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  24. Generating a Ray No perspective transformation needed! 24 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  25. Ray Intersection With a Sphere 25 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  26. Ray Intersection With a Sphere 26 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  27. Ray Intersection with a Sphere 27 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  28. Ray Intersection with a Sphere 28 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  29. Ray Intersection With a Sphere 29 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  30. Ray Intersection With a Sphere 30 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  31. Ray Intersection With a Sphere If t* < 0 then what ? 31 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  32. Sphere Surface Normal 32 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  33. Surface Normal http://designjk.files.wordpress.com/2011/12/teapot-decorated.png 33 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  34. Shadow Ray / Light Ray 34 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  35. Reflection Vector (Recap) ~ v i Note the directions ! http://graphics.stanford.edu/courses/cs148-10-summer/docs/2006--degreve--reflection_refraction.pdf 35 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  36. Refraction Vector (Extra) ~ v i http://graphics.stanford.edu/courses/cs148-10-summer/docs/2006--degreve--reflection_refraction.pdf 36 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  37. Shadows http://2.bp.blogspot.com/-2CpxoSdtNE8/T5nMClgobpI/AAAAAAAAAJ4/XgaZ168HpKg/s1600/P0008_I004.png 37 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  38. Shadow Acne / Peter Panning Real life issues ! 38 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  39. Object-Oriented Ray Tracing abstract class surface virtual hit-record hit(ray, t0, t1) virtual box bounding-box() struct hit-record vector3d position, normal surface hit-surface … abstract class material color evaluate(in-ray, normal, pos) … 39 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  40. Recursive Ray Tracing color ray-trace(ray r) hit-record record = intersect(r); … if (record.hit-surface.is-reflective) ray reflected-ray = reflect(r,record.normal); color reflected-color = ray-trace(reflected-ray); compute-spectral-component( reflected-color); … 40 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  41. Recursion Depth Lots of bounces Fewer bounces Avoid infinite recursion: stop after nth depth (typically n=5) 41 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  42. Aliasing: Still Problematic! 42 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain http://www.hackification.com/2008/08/31/experiments-in-ray-tracing-part-8-anti-aliasing/

  43. Distribution Ray Tracing Scatter rays to make ray tracing less crisp. 43 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  44. Distribution Antialiasing Multiple rays per pixel 44 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  45. Distribution Antialiasing Moiré pattern Patterned Noise http://upload.wikimedia.org/wikipedia/commons/f/fb/Moire_pattern_of_bricks_small.jpg 45 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  46. Random Sampling We are less sensitive to granular noise http://en.wikipedia.org/wiki/File:Moire_pattern_of_bricks.jpg 46 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  47. Not Enough Samples! ? ? ? 47 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  48. Stratified (Jittered) Sampling One ray per box 48 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  49. Accelerated Ray Tracing Bounding Volume Hierarchy (BVH) http://sopra.le-gousteau.de/images/2/2e/Bv_bvh_bspheres.jpg http://graphics.ucsd.edu/courses/rendering/2004/ssaha/index_files/finalbvh.jfif 49 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

  50. Accelerated Ray Tracing Bounding Volume Hierarchy (BVH) http://sopra.le-gousteau.de/images/2/2e/Bv_bvh_bspheres.jpg http://graphics.ucsd.edu/courses/rendering/2004/ssaha/index_files/finalbvh.jfif 50 CS 148: Introduction to Computer Graphics and Imaging (Summer 2016) – Zahid Hossain

Recommend


More recommend