lecture 2 whitted
play

Lecture 2 - Whitted Welcome! , = (, ) , - PowerPoint PPT Presentation

INFOMAGR Advanced Graphics Jacco Bikker - November 2019 - February 2020 Lecture 2 - Whitted Welcome! , = (, ) , + , , ,


  1. INFOMAGR – Advanced Graphics Jacco Bikker - November 2019 - February 2020 Lecture 2 - “ Whitted ” Welcome! 𝑱 𝒚, 𝒚 ′ = 𝒉(𝒚, 𝒚 ′ ) 𝝑 𝒚, 𝒚 ′ + න 𝝇 𝒚, 𝒚 ′ , 𝒚 ′′ 𝑱 𝒚 ′ , 𝒚 ′′ 𝒆𝒚′′ 𝑻

  2. Today’s Agenda: ▪ Introduction: Appel ▪ Whitted ▪ Cook ▪ Assignment 1

  3. Advanced Graphics – Whitted 3 Appel Some Techniques for Shading Machine Renderings of Solids, Arthur Appel, 1964. Idea: use rays to find geometry and shadows.

  4. Advanced Graphics – Whitted 4 Appel Plane: 𝑄 ∙ 𝑂 + 𝑒 = 0 Ray: 𝑄(𝑢) = 𝑃 + 𝑢𝐸 Recap Substituting for 𝑄(𝑢) , we get 𝑃 + 𝑢𝐸 ∙ 𝑂 + 𝑒 = 0 𝑄 1 𝑢 = −(𝑃 ∙ 𝑂 + 𝑒)/(𝐸 ∙ 𝑂) u 𝑄 0 𝑄 = 𝑃 + 𝑢𝐸 v 𝐹 𝑄 2

  5. Advanced Graphics – Whitted 5 Appel Ray: 𝑄(𝑢) = 𝑃 + 𝑢𝐸 𝒖

  6. Advanced Graphics – Whitted 6 Appel

  7. Today’s Agenda: ▪ Introduction: Appel ▪ Whitted ▪ Cook ▪ Assignment 1

  8. Advanced Graphics – Whitted 8 Whitted An Improved Illumination Model for Shaded Display In 1980, “State of the Art” consisted of: ▪ Rasterization ▪ Shading: either diffuse (N · L) or specular ((N · H) n ), both not taking into account fall-off (Phong) ▪ Reflection, using environment maps (Blinn & Newell *) ▪ Stencil shadows (Williams **) * : Blinn, J. and Newell, M. 1976. Texture and Reflection in Computer Generated Images. ** : Williams, L. 1978. Casting curved shadows on curved surfaces..

  9. Advanced Graphics – Whitted 9 Whitted An Improved Illumination Model for Shaded Display In 1980, “State of the Art” consisted of: ▪ Rasterization ▪ Shading: either diffuse (N · L) or specular ((N · H) n ), both not taking into account fall-off (Phong) ▪ Reflection, using environment maps (Blinn & Newell) ▪ Stencil shadows (Williams) Goal: ▪ Solve reflection and refraction Improved model: ▪ Based on classical ray optics

  10. Advanced Graphics – Whitted 10 Whitted An Improved Illumination Model for Shaded Display* Physical basis of Whitted-style ray tracing: Light paths are generated (backwards) from the camera to the light sources, using rays to simulate optics. Color Trace( ray r ) I, N, mat = NearestIntersection( scene, r ) return mat.color * DirectIllumination( I, N ) * : T. Whitted. An Improved Illumination Model for Shaded Display. Commun. ACM, 23(6):343 – 349, 1980.

  11. Advanced Graphics – Whitted 11 Whitted An Improved Illumination Model for Shaded Display Color Trace( ray r ) I, 𝑂 , mat = NearestIntersection( scene, r ) return mat.color * DirectIllumination( I, 𝑂 ) Direct illumination: Summed contribution of unoccluded point light sources, taking into account: ▪ Distance to I ▪ Angle between 𝑀 and 𝑂 ▪ Intensity of light source Note that this requires a ray per light source.

  12. Advanced Graphics – Whitted 12 Whitted An Improved Illumination Model for Shaded Display Color Trace( ray r ) I, 𝑂 , mat = NearestIntersection( scene, r ) if (mat == DIFFUSE) return mat.color * DirectIllumination( I, 𝑂 ) if (mat == MIRROR) return mat.color * Trace( I, reflect( r. 𝐸 , 𝑂 ) Indirect illumination: For perfect specular object (mirrors) we extend the primary ray with an extension ray: ▪ We still modulate transport with the material color ▪ We do not apply 𝑂 ∙ 𝑀 ▪ We do not calculate direct illumination

  13. Advanced Graphics – Whitted 13 Whitted Reflection Given a ray direction 𝐸 and a normalized surface normal 𝑂 , the reflected vector 𝑆 = 𝐸 − 2(𝐸 ∙ 𝑂)𝑂 . Derivation: 𝑊 = 𝑂(𝐸 ∙ 𝑂) 𝑆 𝐸 𝑉 𝑉 = 𝐸 − Ԧ 𝑤 𝑆 = 𝑉 + (−𝑊) 𝑶 𝑆 = 𝐸 − 𝑂 𝐸 ∙ 𝑂 − 𝑂(𝐸 ∙ 𝑂) 𝑊 𝑆 = 𝐸 − 2(𝐸 ∙ 𝑂)𝑂

  14. Advanced Graphics – Whitted 14 Whitted Question 1: For direct illumination, we take into account: ▪ Material color ▪ Distance to light source ▪ 𝑂 ∙ 𝑀 Why? Question 2: We use the summed contribution of all light sources. Is this correct? Question 3: Why do we not sample the light sources for a pure specular surface? (can you cast a shadow on a bathroom mirror?) Question 4: Prove geometrically that, for normalized vectors 𝐸 and 𝑂 , 𝑆 = 𝐸 − 2 𝐸 ∙ 𝑂 𝑂 yields a normalized vector.

  15. Advanced Graphics – Whitted 15 Whitted An Improved Illumination Model for Shaded Display Handling partially reflective materials: Color Trace( ray r ) I, 𝑂 , mat = NearestIntersection( scene, r ) s = mat.specularity d = 1 – mat.specularity return mat.color * ( s * Trace( ray( I, reflect( r. 𝐸 , 𝑂 ) ) ) + d * DirectIllumination( I, 𝑂 ) ) Note: this is not efficient. (why not?)

  16. Advanced Graphics – Whitted 16 Whitted An Improved Illumination Model for Shaded Display Dielectrics Color Trace( ray r ) I, 𝑂 , mat = NearestIntersection( scene, r ) if (mat == DIFFUSE) return mat.color * DirectIllumination( I, 𝑂 ) if (mat == MIRROR) return mat.color * Trace( I, reflect( r. 𝐸 , 𝑂 ) if (mat == GLASS) return mat.color * ?

  17. Advanced Graphics – Whitted 17 Whitted Dielectrics 𝑶 𝐸 The direction of the transmitted vector 𝑈 depends on 𝜄 1 the refraction indices 𝑜 1 , 𝑜 2 of the media separated by the surface. According to Snell’s Law: 𝑜 1 𝑜 1 𝑡𝑗𝑜𝜄 1 = 𝑜 2 𝑡𝑗𝑜𝜄 2 𝑜 2 or 𝑜 1 𝜄 2 𝑡𝑗𝑜𝜄 1 = 𝑡𝑗𝑜𝜄 2 𝑜 2 𝑈 Note: left term may exceed 1, in which case 𝜄 2 cannot be computed. Therefore: 𝑜 2 𝑡𝑗𝑜𝜄 1 = 𝑡𝑗𝑜𝜄 2 ⟺ 𝑡𝑗𝑜𝜄 1 ≤ 𝑜2 𝑜 1 𝑜 2 𝑜1 ➔ 𝜄 𝑑𝑠𝑗𝑢𝑗𝑑𝑏𝑚 = arcsin 𝑜 1 sin 𝜄 2

  18. Advanced Graphics – Whitted 18 Whitted Dielectrics 𝑶 𝐸 𝑜 1 𝑜2 𝑜 2 𝑡𝑗𝑜𝜄 1 = 𝑡𝑗𝑜𝜄 2 ⟺ 𝑡𝑗𝑜𝜄 1 ≤ 𝜄 1 𝑜1 𝑜 1 2 𝑜 1 2 𝑙 = 1 − 1 − 𝑑𝑝𝑡𝜄 1 𝑜 2 𝑜 2 𝑈𝐽𝑆, 𝑔𝑝𝑠 𝑙 < 0 𝜄 2 𝑜 1 𝐸 + 𝑂 𝑜 1 𝑈 = ൞ 𝑈 𝑑𝑝𝑡𝜄 1 − 𝑙 , 𝑔𝑝𝑠 𝑙 ≥ 0 𝑜 2 𝑜 2 Note: 𝑑𝑝𝑡𝜄 1 = 𝑂 ∙ −𝐸 , and 𝑜 1 𝑜 2 should be calculated only once. * For a full derivation, see http://www.flipcode.com/archives/reflection_transmission.pdf

  19. Advanced Graphics – Whitted 19 Whitted Dielectrics 𝑆 𝑶 𝐸 A typical dielectric transmits and reflects light. 𝑈

  20. Advanced Graphics – Whitted 20 Whitted Dielectrics A typical dielectric transmits and reflects light. Based on the Fresnel equations, the reflectivity of the surface for non-polarized light is formulated as: 2 2 𝑠 = 1 𝑜 1 𝑑𝑝𝑡𝜄 𝑗 − 𝑜 2 cos 𝜄 𝑢 + 𝑜 1 cos 𝜄 𝑢 − 𝑜 2 cos 𝜄 𝑗 𝐺 2 𝑜 1 𝑑𝑝𝑡𝜄 𝑗 + 𝑜 2 cos 𝜄 𝑢 𝑜 1 cos 𝜄 𝑢 + 𝑜 2 cos 𝜄 𝑗 Reflectance for s-polarized light Reflectance for p-polarized light Reflectance for unpolarized light 2 𝑜 1 Where: cos 𝜄 𝑢 = 1 − 𝑜 2 sin 𝜄 𝑗

  21. Advanced Graphics – Whitted 21 Whitted Dielectrics 𝑆 𝑶 𝐸 𝐺 𝑠 = ⋯ Based on the law of conservation of energy: 𝐺 𝑢 = 1 − 𝐺 𝑠 𝑈

  22. Advanced Graphics – Whitted 22 Whitted Ray Tracing World space ▪ Geometry ▪ Eye ▪ Screen plane ▪ Screen pixels ▪ Primary rays ▪ Intersections ▪ Point light ▪ Shadow rays Light transport ▪ Extension rays Light transport

  23. Advanced Graphics – Whitted 23 Whitted Ray Tree Using Whitted-style ray tracing, hitting a surface point may spawn: ▪ a shadow ray for each light source; ▪ a reflection ray; ▪ a ray transmitted into the material. The reflected and transmitted rays may hit another object with the same material. ➔ A single primary ray may lead to a very large number of ray queries.

  24. Advanced Graphics – Whitted 24 Whitted Question 5: imagine a scene with several point lights and dielectric materials. Considering the law of conservation of energy, what can you say about the energy transported by each individual ray?

  25. Advanced Graphics – Whitted 25 Whitted Beer’s Law

  26. Advanced Graphics – Whitted 26 Whitted Beer’s Law Light travelling through a medium loses intensity due to absorption. The intensity 𝐽(𝑒) that remains after travelling 𝑒 units through a substance with absorption 𝑏 is: 𝐽 𝑒 = 𝐽 0 𝑓 − ln 𝑏 𝑒 In pseudocode: I.r *= exp( -a.r * d ); I.g *= exp( -a.g * d ); I.b *= exp( -a.b * d );

  27. Advanced Graphics – Whitted 27 Whitted Whitted - Summary A Whitted-style ray tracer implements the following optical phenomena: ▪ Direct illumination of multiple light sources, taking into account Visibility Distance attenuation A shading model: N dot L for diffuse ▪ Pure specular reflections, with recursion ▪ Dielectrics, with Fresnel, with recursion ▪ Beer’s Law The ray tracer supports any primitive for which a ray/primitive intersection can be determined.

  28. Today’s Agenda: ▪ Introduction: Appel ▪ Whitted ▪ Cook ▪ Assignment 1

  29. Advanced Graphics – Whitted 29 Cook ’Distributed Ray Tracing’ Whitted-style ray tracing does not handle glossy reflections, depth of field, motion blur.

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