Introduction of ray tracing: Ray tracing Because ofits effectiveness, ray tracing is awidely used and very powerful rendering(drawing) technique Why we see objects?. Light can be interpreted as a collection of raysthat begin at the light sources and bounce aroundthe objects in the scenes..We see objects become rays finally come into oureyes
Introduction of ray tracing • Ray tracing – Because of its effectiveness, ray tracing is a widely used and very powerful rendering (drawing) technique – Why we see objects? • Light can be interpreted as a collection of rays that begin at the light sources and bounce around the objects in the scenes. • We see objects become rays finally come into our eyes
Basic Idea of ray tracingThink of the frame buffer as a simple array ofpixels, with eye looking through it into the sceneFor each pixel, what can we “see"?a ray casting from the eye through the center of thepixel and out into the scene, its path is traced to seewhich object the ray hits firstcalculate the shading value of the pointby the Phong modelcontinue to trace the rayin the scene to achievereflection, refraction
Basic Idea of ray tracing • Think of the frame buffer as a simple array of pixels, with eye looking through it into the scene • For each pixel, what can we “see”? • a ray casting from the eye through the center of the pixel and out into the scene, its path is traced to see which object the ray hits first • calculate the shading value of the point by the Phong model • continue to trace the ray in the scene to achieve reflection, refraction
Introduction of ray tracing: Features- Easy to incorporate interesting visual effectssuch as shadowing, reflection and refraction,since the path of a ray is traced through thescene- Besides geometric primitives(such as spheres, cones, cubes)easy to work with a richerclass of objects, includingpolygonal meshes, compoundobjects
Introduction of ray tracing • Features – Easy to incorporate interesting visual effects, such as shadowing, reflection and refraction, since the path of a ray is traced through the scene – Besides geometric primitives (such as spheres, cones, cubes), easy to work with a richer class of objects, including polygonal meshes, compound objects
Recursive Ray Tracing
Recursive Ray Tracing
Recursive Ray TracingIntersectcolor( vBeginPoint, vDirection){Determine IntersectPoint;Color = ambient color;for each lightColor += local shading term;if(surface is reflective)color += reflect Coefficient *IntersectColor(IntersecPoint, Reflect Ray);else if ( surface is refractive)refract Coefficient *color +=IntersectColor(IntersecPoint, Refract Ray);return color;1
Recursive Ray Tracing IntersectColor( vBeginPoint, vDirection) { Determine IntersectPoint; Color = ambient color; for each light Color += local shading term; if(surface is reflective) color += reflect Coefficient * IntersectColor(IntersecPoint, Reflect Ray); else if ( surface is refractive) color += refract Coefficient * IntersectColor(IntersecPoint, Refract Ray); return color; }