Download
ray tracing n.
Skip this Video
Loading SlideShow in 5 Seconds..
Ray Tracing PowerPoint Presentation
Download Presentation
Ray Tracing

Ray Tracing

278 Vues Download Presentation
Télécharger la présentation

Ray Tracing

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Ray Tracing Chemakura , Baba Kumar Reddy

  2. Introduction to Ray-Tracing • Ray Tracing. global illumination. • purpose of Ray Tracing?

  3. Introduction to Ray- Tracing • Basic Setup

  4. Introduction to Ray-tracing Modeling Rendering

  5. Properties of Light Rays • Light Travels in Straight Lines. • Two Light rays do not interfere with each other if they cross. • Light rays travel from light source to the eye, but physics for path reversal is same.

  6. Light Object Intersection • Reflection v/s Transmission

  7. Light Object Intersection • Specular v/s Diffusion

  8. Types of Ray Tracing • Forward Ray Tracing

  9. Types of Ray Tracing • Backward Ray Tracing

  10. Types of Ray Tracing • Hybrid ray tracing Whitted(1980) Backward Ray tracing + rays to light source

  11. Types of Ray Tracing • Hybrid ray tracing. • Heckbert (1990). backward ray tracing + forward ray tracing + storage on surface. • Veach (1995). backward ray tracing + forward ray tracing + connecting lines.

  12. Ray Tracing Algorithm For( every pixel in the view port) { for(every object in the model world) { if(ray-object intersection) { select the front most intersection; recursively trace the reflection and refraction rays; calculate color; } } }

  13. Practical Considerations in writing a Ray Tracer • Creating Model • Generate primary rays and test for object ray interaction • Shadow Ray • Output file

  14. Intersections • One of the basic routine needed by the ray tracer is an intersection routine for each type of object in the scene: one for spheres, one for cubes , one for cones, one for polygons and so forth. • If ray-object intersections occur, objects intersection routine returns the distance of intersection point from the origin of the ray, the normal vector at the point of intersection and if texture mapping is used , a coordinate mapping between the intersection point and textured image. • Distance is used to choose the closest intersection point. • Normal vector is used to determine the shade at the point, since it describes which direction the surface is faced and therefore how much light the point receives, called cosine shading.

  15. Intersection With Sphere P=point of intersection

  16. Intersection With Sphere V2 + b2 = c2 and d2 + b2 = r2 by simple geometry. And so d = sqrt(r2 – ( c2 - v2 )). If d >= 0 then a valid intersection occurs , if ray does not intersect d < 0. The distance from point of intersection to the origin of ray is v-d, can be found by the following pseudo code. V=dot_product(EO, V). disc=r2 – ((dot_product(EO, EO) -V2 ). If (disc < 0). no intersection. Else. d=sqrt(disc); p=E+(V-d)*V.

  17. Color and Shading and Texture Mapping • Flat Shading. • Cook-Torrance method. • Lambertian Shading / Cosine Shading. computes the angle between the intersection point and the normal vector of the surface, to determine the shading of the surface at that point. Ambient Coefficient, Diffuse Coefficient their importance. • Assigning an entire image to an object instead of a single color is Texture mapping.

  18. Rendering Effects Created by Ray Tracing Shadowing

  19. Rendering Effects Created by Ray Tracing Reflection

  20. Rendering Effects Created by Ray Tracing Transparency

  21. Rendering Effects Created by Ray Tracing Refraction

  22. Precision Problem-the Self Shadowing Problem Passing a flag to the recursive routine to tell a point is on the surface or not. Assuming that all rays start with a tolerance(say 0.000001 inches) of the surface of the primitive shape.

  23. Aliasing • What is Aliasing. • Types of Aliasing. Temporal Aliasing. Due to limitations of eye. Spatial Aliasing. Missing of object falling between two rays. • Anti Aliasing.

  24. Types of Anti-Aliasing Techniques • Super Sampling • Adaptive Super Sampling / Monte-Carlo Sampling • Stochastic Ray Tracing/ Distributed Ray Tracing • Statistical Super sampling

  25. Optimization • Need for Optimization Ray Tracing is computationally intensive process. Eg: The film ToyStory with 110,000 frames, took 46 days to render on 117 Sun Sparc 20’s. • Time taken for Ray tracing Number of Objects x number of rays.

  26. Accelerating Ray Tracing • Use faster machines. • Use specialized hardware, especially parallel processors. • Reduce the total number of rays that need to intersect with the world. • Reduce the number of Ray-Object intersections.

  27. Accelerating Ray Tracing • Reducing the number of rays that hit the world. eg: backward ray tracing, reduces the total number of rays by not considering those that are not captured by the camera.

  28. Acceleration Techniques Overview Ray Tracing Accelerating Techniques Fewer Rays Faster Intersections Generalized Rays Faster Ray Object Intersections Fewer Ray Object Intersections Adaptive Tree Depth Beam Tracing Cone Tracing Pencil Tracing Object Bounding Volumes Efficient intersection routines Bounding volume hierarchies Space sub division Directional techniques

  29. Bounding Volumes Enclosing Groups of objects in sets of bounding volumes and first test for intersection with the bounding volume.

  30. Spatial Subdivision Uniform Non uniform

  31. Spatial Subdivision K-d Tree BSP Tree

  32. Spatial Subdivision • Uniform v/s Non uniform Uniform easier to traverse Non uniform can be faster Non uniform more memory efficient Non Uniform good for scenes where object density varies circle= volumes, squares = objects Uniform spatial subdivision Bounding volume Non uniform spatial subdivision

  33. Issues in Spatial Subdivision • The same ray may test the same object for intersection multiple times.Mailbox? • Need to make sure the intersection occurs in that voxel.

  34. Directional Techniques • Directional Cube : Axis aligned cube with side length=2. (±1 , ±1 , ± 1)

  35. Directional Techniques-Light Buffer • Preprocessing Step to ray tracing, to speed up calculations of shadows. • Form a directional cube around point light. • Candidate lists for each window are formed. • Check for shadows using distance t0

  36. Adaptive Depth Control • Rays are attenuated as they pass through the scene. • Uses properties of materials like reflection coefficient , refraction coefficient and global property like distance attenuation factor.

  37. Generalized Rays • Uses an entire family of rays bundled as beams, cones or pencils • Uses of using these rays are effective antialiasing additional optical effects • Some sacrifices needed are types of primitive objects may need to be restricted the computation of exact intersection needed to be abandoned

  38. Limitations of Ray Tracing • Slow. • Good for ideal environment. • View Dependent. • Not good at rendering in real time. • Alternatives to ray tracing. Ray casting. Radiosity.

  39. Conclusion • Any optimization technique is scene bounded, eg: bounding volumes technique depends upon the density of objects, if more than some threshold use some other method.