1Ray TracingCS 351-50Turner WhittedNo Bounces2One BounceTwo BouncesReflection RayR = ( -I . N) N - I + (-I . N) N = -I - 2 (I . N) NNθ θ -InRθ θ-I( -I . N) N-I - (-I . N) NR( -I . N) N-I + (-I . N) NI = incident ray = -dN = normal vectorR = reflected ray3Adding an object: transparencyRefractionn sin θ = nt sin φIndex of Refraction > 14Index of Refraction < 1totalinternalreflectionAlgorithmTrace (ray){For each object in sceneintersect (ray, object)If no intersectionsreturn background_colorColor = c_a * c_r (Ambient * reflected diffuse color of surface)For each lightfor each object in sceneintersect(shadowRay, object)Accumulate local illuminationTrace (ReflectionRay)Trace (TransmissionRay)Accumulate global illuminationReturn illumination}5SamplingRay Tracing Demoshttp://www.siggraph.org/education/materials/HyperGraph/raytrace/rt_java/raytrace.htmlhttp://www.cs.berkeley.edu/~efros/java/tracer/tracer.htmlSampling DemoTexture & Materials6Links•
View Full Document