DOC PREVIEW
CMU CS 15462 - lecture

This preview shows page 1-2-24-25 out of 25 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Ray TracingForward & Backward Ray TracingRay TracingRay-Surface Intersection TestingShadowsReflectionsTransmissionNext time: efficient ray tracingForward & Backward Ray TracingRay TracingRay-Surface Intersection TestingShadowsReflectionsTransmissionNext time: efficient ray tracingShirley Chapter 103Computer Graphics 15-462Global vs. Local Rendering ModelsLocal rendering models: the color of one object is independent of its neighbors (except for shadows)Missing scattering of light between objects, real shadowingGlobal Rendering ModelsRaytracing—specular highlightsRadiosity—diffuse surfaces, closed environments4Computer Graphics 15-462Object-oriented vs. Pixel-oriented RenderingOpenGL rendering:walk through objects, transforming and then drawing each one unless the z buffer says that it is not in frontRay tracingwalk through each pixel looking for what object (if any) should be shown there5Computer Graphics 15-462Light is Bouncing PhotonsLight sources send off photons in all directionsModel these as particles that bounce off objects in the sceneEach photon has a wavelength and energy (color and intensity)When photons bounce, some energy is absorbed, some reflected, some transmittedIf we can model photon bounces we can generate imagesTechnique: follow each photon from the light source until:All of its energy is absorbed (after too many bounces)It departs the known universe (not just the part of the world that is within the viewing volume!)It strikes the image and its contribution is added to appropriate pixel6Computer Graphics 15-462Forward Ray TracingRays are the paths of these photonsThis method of rendering by following photon paths is called ray tracingForward ray tracing follows the photon in direction that light travels (from the source)BIG problem with this approach:Only a tiny fraction of rays reach the imageMany, many rays are required to get a value for each pixelIdeal Scenario:We'd like to magically know which rays will eventually contribute to the image, and trace only those7Computer Graphics 15-462Backward Ray TracingThe solution is to start from the image and trace backwards—backward ray tracingStart from the image and follow the ray until the ray finds (or fails to find) a light source8Computer Graphics 15-462Backward Ray TracingBasic idea:Each pixel gets light from just one direction—the line through the image point and focal pointAny photon contributing to that pixel’s color has to come from this directionSo head in that direction and see what is sending lightIf we hit a light source—done If we find nothing—done If we hit a surface—see where that surface is lit from At the end we’ve done forward ray tracing, but ONLY for the rays that contribute to the image9Computer Graphics 15-462Ray TracingThe basic algorithm iscompute u, v, w basis vectorsfor each pixel doshoot ray from eye point through pixel (x,y) into sceneintersect with all surfaces, find first one the ray hitsshade that point to compute pixel (x,y)’s color10Computer Graphics 15-462Ray Tracing11Computer Graphics 15-462Computing Rays)p( than eye thecloser to is )p(eye thebehind is )p( then 0ray ofdirection positivein 0ray theoforigin 0e)(se)p(2121tttttttttt!"!"#$%&$12Computer Graphics 15-462Computing RaysWhere is s? (x,y of image)Intersection of ray with image planeDetails in book.Derived using viewing transformations13Computer Graphics 15-462Ray Object IntersectionblackboardSphereTrianglePolygon14Computer Graphics 15-462Ray Object IntersectionblackboardSphereTrianglePolygon15Computer Graphics 15-462Ray Object IntersectionSphereTrianglePolygonRay-polygon—in bookIntersection with plane of polygonin/outside of polygon determinationRay-triangle—3D models composed of trianglesRay-sphere—early models for raytracing, and now bounding volumesThought Experiment•Ray tracing an implicit surface...•How would you do it?•What accelerations are possible?http://www.cc.gatech.edu/~turk/vimp/scene.jpg16Computer Graphics 15-462Recursive Ray TracingFour ray types:Eye rays: originate at the eyeShadow rays: from surface point toward light sourceReflection rays: from surface point in mirror directionTransmission rays: from surface point in refracted direction17Computer Graphics 15-462Writing a Simple Ray Caster (no bounces)Raycast() // generate a picturefor each pixel x,ycolor(pixel) = Trace(ray_through_pixel(x,y))Trace(ray) // fire a ray, return RGB radiance// of light traveling backward along itobject_point = Closest_intersection(ray)if object_point return Shade(object_point, ray)else return Background_ColorClosest_intersection(ray)for each surface in scenecalc_intersection(ray, surface)return the closest point of intersection to viewer (also return other info about that point, e.g., surface normal, material properties, etc.)Shade(point, ray) // return radiance of light leaving// point in opposite of ray directioncalculate surface normal vectoruse Phong illumination formula (or something similar)to calculate contributions of each light source18Computer Graphics 15-462Shadow Raysshadowed is andobject an hit does lqobjectsany hit not does lptt!!l the same for both points because this is a directional light (infinitely far away)19Computer Graphics 15-462From Last time: Recursive Ray TracingFour ray types:Eye rays: originate at the eyeShadow rays: from surface point toward light sourceReflection rays: from surface point in mirror directionTransmission rays: from surface point in refracted direction20Computer Graphics 15-462Specular Reflection Raysblackboard21Computer Graphics 15-462Dielelectrics—transparent material that refracts (and filters) light. Diamonds, glass, water, and air. Light bends by the physics principle of least timelight travels from point A to point B by the fastest pathwhen passing from a material of one index to another Snell’s law gives the angle of refractionWhen traveling into a denser material (larger n), light bends to be more perpendicular (eg air to water) and vice versaTransmission RaysMATERIAL INDEX OF REFRACTIONair/vacuum 1water 1.33glass about 1.5diamond 2.422Computer Graphics 15-462Transmission RaysDielelectrics—transparent material that refracts (and filters) light. Diamonds, glass, water, and air.Snell’s law:material second theof index refractive theis material.first theof index refractive theis sinsinttnnnn!"#blackboard23Computer Graphics 15-462Transmission RaysDielelectrics—transparent material that refracts (and filters)


View Full Document

CMU CS 15462 - lecture

Download lecture
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view lecture and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view lecture 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?