Ray-tracing Overview
Recursive Ray Tracing Shadow Feelers Snell’s Law for Refraction When to stop!
Overview Recursive Ray Tracing Shadow Feelers Snells Law for - - PDF document
Ray-tracing Overview Recursive Ray Tracing Shadow Feelers Snells Law for Refraction When to stop! Recap: Light Transport Recap: Local Illumination m M ( ) I k = I k ( n l ) k ( ) h n = I + + r a a i , j d j s j j
Recursive Ray Tracing Shadow Feelers Snell’s Law for Refraction When to stop!
Ambient, diffuse & specular components The sum is over the specular and diffuse
M j m j s j d j i a r
1 ,
a
Where Sj is the result of intersecting the
Note consider your intersection points
We can simulate specular-specular
We must obviously chose a termination
Where
E N H L surface R
Where Ilocal is computed as before Ray r' is formed from intersection point
L1 L2 p p’ p’’ R1 R2
Color RayTrace(Point p, Vector direction, int depth) { Point pd /* Intersection point */ Boolean intersection if (depth > MAX) return Black intersect(p,direction, &pd, &intersection) if (!intersection) return Background Ilocal = kaIa + Ip.v.(kd(n.l) + ks.(h.n)m) return Ilocal + kr*RayTrace(pd, R, depth+1) } Normally kr = ks
α
Snell’s Law
refraction
ß
Using this law it is possible to show that: Note that if the root is negative then total
internal reflection has occurred and you just reflect the vector as normal
L1 L2 p p’ p’’ R1 R2 T2 T1
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 Ilocal = kaIa + Ip.v.(kd(n.l) + ks.(h.n)m) return Ilocal + kr*RayTrace(pd, R, depth+1) + kt*RayTrace(pd, T, depth+1) }
A transparent
surface can be illuminated from behind and this should be calculated in Ilocal
N H' L E
Use H‘ instead of H in specular term
Specular and transmission only
Why it’s expensive
How to reduce the cost?
– First check with bounding box of the object – Methods to sort the scene and make it faster
Recursive ray tracing is a good
We’ve seen how the ray-casting can be
However this is a very slow process and