Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Ray-Tracing ©Anthony Steed 2001-2003. 2 Overview n Recursive Ray Tracing n Shadow Feelers n Snell’s Law for Refraction n When to stop!

Similar presentations


Presentation on theme: "1 Ray-Tracing ©Anthony Steed 2001-2003. 2 Overview n Recursive Ray Tracing n Shadow Feelers n Snell’s Law for Refraction n When to stop!"— Presentation transcript:

1 1 Ray-Tracing ©Anthony Steed 2001-2003

2 2 Overview n Recursive Ray Tracing n Shadow Feelers n Snell’s Law for Refraction n When to stop!

3 3 Recap: Light Transport

4 4 Recap: Local Illumination n Ambient, diffuse & specular components n The sum is over the specular and diffuse components for each light

5 5 Recap: Result of Ray Casting

6 6 Correcting for Non-Visible Lights E N H L surface

7 7 n Where Sj is the result of intersecting the ray L with the scene objects n Note consider your intersection points along the ray L carefully Hint – they might be beyond the light!

8 8 Result of Shadow Feeler

9 9 Recursive Ray-Tracing n We can simulate specular-specular transmission elegantly by recursing and casting secondary rays from the intersection points n We must obviously chose a termination depth to cope with multiple reflections

10 10 Introducing Reflection n Where E N H L surface R

11 11 Computing Reflectance n Where I local is computed as before n Ray r' is formed from intersection point and the direction R and is cast into the scene as before

12 12 Psuedo Code Color RayTrace(Point p, Vector D, int depth) { Point pd /* Intersection point */ Boolean intersection if (depth > MAX) return Black intersect(p,direction, &pd, &intersection) if (!intersection) return Background I local = k a I a + I p.v.(k d (n.l) + k s.(h.n) m ) return I local + k r *RayTrace(pd, R, depth+1) } Normally k r = k s

13 13 Result of Recursion

14 14 Perfect Specular Transmission N H L E T R α Snell’s Law η is index of refraction β

15 15 Using Snell’s Law n Using this law it is possible to show that: n Note that if the root is negative then total internal reflection has occurred and you just reflect the vector as normal

16 16 New Psuedo Code Color RayTrace(Point p, Vector D, int depth) { Point pd /* Intersection point */ Boolean intersection if (depth > MAX) return Black intersect(p,direction, &pd, &intersection) if (!intersection) return Background I local = k a I a + I p.v.(k d (n.l) + k s.(h.n) m ) return I local + k r *RayTrace(pd, R, depth+1) + k t *RayTrace(pd, T, depth+1) }

17 17 Direct Specular Transmission n A transparent surface can be illuminated from behind and this should be calculated in I local N H'H' L E

18 18 Calculating H' n Use H‘ instead of H in specular term

19 19 Putting Everything Together

20 20 Discussion – What Can’t We Simulate?

21 21 Summary n Recursive ray tracing is a good simulation of specular reflections n We’ve seen how the ray-casting can be extended to include shadows, reflections and transparent surfaces n However this is a very slow process and still misses some types of effect!


Download ppt "1 Ray-Tracing ©Anthony Steed 2001-2003. 2 Overview n Recursive Ray Tracing n Shadow Feelers n Snell’s Law for Refraction n When to stop!"

Similar presentations


Ads by Google