1Need for Ray TracingIce Sculptures, Fairbanks, AK, 2002(Slides adapted from Amitabh Varshney)Ray-TracingTrace rays of light (assume geometric optics)A very powerful general rendering modelCan be used for:Scan-conversionVisibility determinationGlobal illumination Anti-aliasing2Ray TracingUsed in pre-rendered imagesMoviesBlue Moon Rendering Tools (bmrt.org) has a ray tracer that has been used in several films: A Bug’s Life, Stuart Little, Hollow Man, Swordfish,…Morning by Horvatth SzabolcsRay Traced ImagesInternet Ray Tracing Competition (irtc.org)Small World by Stephen M. Farrell3Forward Ray-TracingBackward Ray-TracingPrimary Rays4First-Order ReflectionsSecondary Rays: One bounce• Intensity drops off with distance.• With square of distance: • To simulate effects of non-point sources: 22101dadaa21d5Second-Order ReflectionsTertiary RaysRecursive Ray-TracingDepth of the ray-tracing tree is arbitraryNeed some termination criteria, say depth 6Can introduce several global illumination effects:Reflection, Refraction, Shadows, Transparency, …6ReflectionsSpecular Diffuse / GeneralRefraction7Reflections and RefractionRay-TracingMost common ray-tracers have three new rays per intersection point:Reflection rayRefraction rayShadow rayMost of the time is spent in intersection computationsThis models many effects, but fails to capture some interreflections.8Ray-Sphere IntersectionsEquation of the ray (parametric form):p(t) = po+ t(p1– po)Equation of the sphere (implicit form):(x – cx)2+ (y – cy)2+ (z – cz)2= r2Substitute parametric equation into implicit equation:(xo+ t(x1– xo) – cx)2+ (yo+ t(y1– yo) – cy)2+ (zo+ t(z1– zo) – cz)2= r2t2+ t + = 0Solving the quadratic equation:Imaginary solution: no ray-sphere intersectionUnique solution: tangential ray-sphere intersectionTwo real solutions: ray shoots through the sphere Similarly for most implicit surfaces: torus, cylinder, heart, …A Ray-traced Implicit Heart ! ! Image courtesy, Dan Skarda and Tomas Bily9Ray-Triangle IntersectionsEquation of the ray (parametric form):p(t) = po+ t(p1– po)Equation of the plane (implicit form):ax + by + cz + d = 0Substitute parametric equation into implicit equation:a (xo+ t(x1– xo)) + b(yo+ t(y1– yo)) + c(zo+ t(z1– zo)) + d = 0t + = 0On getting the intersection point, need to check whether it lies inside the triangleProject to the principal plane (x = 0 or y = 0 or z = 0) based on direction of the triangle normal and use any of the point in polygon tests discussed in the polygon scan conversion lecture.Implicit Visibility Determination10Antialiasing and Ray TracingSingle-sample per pixelMay cause aliasing artifacts Reflections/refractions can cause high frequencies even if objects are smooth and low frequencySuper SamplingShoot multiple rays per pixel: regular grid, jittering, Poisson disk samplingAverage them: weighted/unweightedAdaptive: If high variation amongst supersampledrays per pixel, shoot moreDistribution Ray TracingAlso called distributed ray tracing (Cook 1986)Take multiple samples and average them for:Blurred reflections (distribute reflected rays)Convincing translucency (distribute refracted rays)Soft shadows (distribute shadow rays)Stochastic anti-aliasing (distribute primary rays over image)Motion blur (distribute primary rays over time)Depth of field effects (distribute primary rays across a lens)Area light sources (distribute samples from area lights)11Accelerating Ray-TracingReduce ray-object intersection testsEfficiently leap empty spaceSpatial HierarchiesBinary Trees, Quad Trees, OctreesBSP TreesBounding Volume HierarchiesAABBs (axis-aligned bounding boxes)OBBs (oriented bounding boxes)Bounding spheresEllipsoid
View Full Document