Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Advanced Ray Tracing Mani Thomas CISC 440/640 Computer Graphics.

Similar presentations


Presentation on theme: "1 Advanced Ray Tracing Mani Thomas CISC 440/640 Computer Graphics."— Presentation transcript:

1 1 Advanced Ray Tracing Mani Thomas CISC 440/640 Computer Graphics

2 2 Review Ray tracing Ray tracing Compute 3D ray into the scene for each 2D image pixel Compute 3D ray into the scene for each 2D image pixel Compute 3D intersection point of ray with nearest object in scene Compute 3D intersection point of ray with nearest object in scene Test each primitive in the scene for intersection Test each primitive in the scene for intersection Find nearest intersection Find nearest intersection Recursively spawn rays from the point of intersection Recursively spawn rays from the point of intersection Shadow Rays Shadow Rays Reflected rays Reflected rays Transmitted rays Transmitted rays Accumulate the color from each of the spawned rays at the point of intersection Accumulate the color from each of the spawned rays at the point of intersection

3 3 Review Ray object intersection Ray object intersection Intersection with a plane Intersection with a plane Implicit form Implicit form Intersection Intersection Intersection with a sphere Intersection with a sphere Implicit form Implicit form Intersection Intersection

4 4 Review “Shadow feelers” “Shadow feelers” Spawn a ray from P to the light sources Spawn a ray from P to the light sources If there is an intersection of the shadow ray with any object then P is in shadow If there is an intersection of the shadow ray with any object then P is in shadow Reflection Reflection Angle of incidence = angle of Reflection Angle of incidence = angle of Reflection

5 5 Review Refraction Refraction Ray passing through media of different refractive indices bend towards/away from the normal Ray passing through media of different refractive indices bend towards/away from the normal Snell’s Law Snell’s Law n i and n r are the refractive indices of the two media n i and n r are the refractive indices of the two media Transmitted ray Transmitted ray

6 6 Road map Super sampling Super sampling Acceleration techniques Acceleration techniques Monte Carlo methods Monte Carlo methods Distributed ray tracing Distributed ray tracing Bidirectional ray tracing Bidirectional ray tracing Caustics Caustics POV-ray POV-ray

7 7 Anti aliasing Ray tracing gives a color for every possible point in the image But a square pixel contains an infinite number of points These points may not all have the same color Sampling: choose the color of one point (center of pixel) This leads to aliasing jaggies moire patterns Aliasing means one frequency (high) masquerading as another (low) e.g. wagon wheel effect

8 8 Super-sampling Ray tracing is a point-sampling process Ray tracing is a point-sampling process Take discrete looks at the scene along individual rays passing through each pixel Take discrete looks at the scene along individual rays passing through each pixel Reduce aliasing due to this discrete signal sampling Reduce aliasing due to this discrete signal sampling Courtesy F.S. Hill, “Computer Graphics using OpenGL”

9 9 Adaptive Super-sampling Instead of shooting one ray per pixel, shoot four rays through the corners of a pixel Instead of shooting one ray per pixel, shoot four rays through the corners of a pixel Color at the pixel is the average of the colors at each corners Color at the pixel is the average of the colors at each corners Adaptive super-sampling (Whitted’s approach) Adaptive super-sampling (Whitted’s approach) Compute the intensity variation between the four corners with the average Compute the intensity variation between the four corners with the average Shoot more rays through corners with higher intensity variation Shoot more rays through corners with higher intensity variation Compute final color as a weighted average rather than the regular average Compute final color as a weighted average rather than the regular average Courtesy of C. Rasmussen, CISC 640

10 10 Stochastic Super sampling Visible aliasing is possible even with adaptive super-sampling Visible aliasing is possible even with adaptive super-sampling sampling grid interacts with regular structures sampling grid interacts with regular structures objects aligned with sampling grid objects aligned with sampling grid Stochastic sampling Stochastic sampling instead of a regular grid, subsample randomly instead of a regular grid, subsample randomly keep taking samples until the color estimates converge keep taking samples until the color estimates converge jittering: perturb a regular grid jittering: perturb a regular grid Courtesy of C. Rasmussen, CISC 640

11 11 Using Extents Ray tracing is slow, performing the same functions. Ray tracing is slow, performing the same functions. Most of the time is spent in computing intersections Most of the time is spent in computing intersections Each ray should be intersected with every object in the scene Each ray should be intersected with every object in the scene Each ray, spawns out reflected/transmitted rays which have to be interested with the objects in the scene Each ray, spawns out reflected/transmitted rays which have to be interested with the objects in the scene

12 12 Using Extents Extent of an object is a shape that encloses the object Extent of an object is a shape that encloses the object Compute complicated intersections if and only if the ray hits the extent Compute complicated intersections if and only if the ray hits the extent Two shapes most commonly used as extents Two shapes most commonly used as extents Sphere – specified by a center and radius (C, r) Sphere – specified by a center and radius (C, r) Box – specified by sides aligned to the coordinate axis Box – specified by sides aligned to the coordinate axis

13 13 Distributed Ray Tracing Distributed ray tracing is NOT ray tracing on a distributed system. Distributed ray tracing is NOT ray tracing on a distributed system. Distributed ray tracing is a ray tracing method based on randomly distributed oversampling to reduce aliasing artifacts in rendered images (Allen Martin, http://www.cs.wpi.edu/~matt/courses/cs56 3/talks/dist_ray/dist.html) Distributed ray tracing is a ray tracing method based on randomly distributed oversampling to reduce aliasing artifacts in rendered images (Allen Martin, http://www.cs.wpi.edu/~matt/courses/cs56 3/talks/dist_ray/dist.html) http://www.cs.wpi.edu/~matt/courses/cs56 3/talks/dist_ray/dist.html http://www.cs.wpi.edu/~matt/courses/cs56 3/talks/dist_ray/dist.html

14 14 Distributed Ray Tracing Developed by Cook, et. al. (“Distributed Ray Tracing”, Computer Graphics, vol. 18, no. 3, pp 137-145, 1984) Developed by Cook, et. al. (“Distributed Ray Tracing”, Computer Graphics, vol. 18, no. 3, pp 137-145, 1984) Stochastic Oversampling (http://www.cs.virginia.edu/~cs551dl/lecture11/sl d016.htm) Stochastic Oversampling (http://www.cs.virginia.edu/~cs551dl/lecture11/sl d016.htm)http://www.cs.virginia.edu/~cs551dl/lecture11/sl d016.htmhttp://www.cs.virginia.edu/~cs551dl/lecture11/sl d016.htm Pixel for antialiasing Pixel for antialiasing Light source for soft shadows Light source for soft shadows Reflection function for soft (glossy) reflections Reflection function for soft (glossy) reflections Time for motion blur Time for motion blur Lens for depth of field Lens for depth of field

15 15 Distributed Ray tracing Gloss (fuzzy reflections) Gloss (fuzzy reflections) Partially reflecting surfaces Partially reflecting surfaces Traditional ray tracing Traditional ray tracing reflections look identical to the scene they are reflecting reflections look identical to the scene they are reflecting reflections are always sharp reflections are always sharp Randomly distributing the rays reflected by the surface Randomly distributing the rays reflected by the surface Send out a packet of rays around the reflecting direction. Send out a packet of rays around the reflecting direction. The actual value of reflectance is the statistical mean of the values returned by each of these rays The actual value of reflectance is the statistical mean of the values returned by each of these rays

16 16 Distributed Ray tracing Distributing a set of reflection rays by randomly perturbing the ideal specular reflection ray. Distributing a set of reflection rays by randomly perturbing the ideal specular reflection ray. The spread of the distribution determines the glossiness where a wider distribution spread models a rougher surface. The spread of the distribution determines the glossiness where a wider distribution spread models a rougher surface. taken from http://www.cs.wpi.edu/~emmanuel/courses/cs563/write_ups/zackw/realistic_raytracing.html

17 17 Distributed Ray tracing first image is from the traditional ray tracer first image is from the traditional ray tracer second one uses 16 rays in place of the single reflected ray second one uses 16 rays in place of the single reflected ray third image uses 64 rays third image uses 64 rays taken from http://www.uwm.edu/People/dtstrock/graphics/mcrt.html

18 18 Distributed Ray tracing taken from http://www.cs.wpi.edu/~emmanuel/courses/cs563/write_ups/zackw/realistic_raytracing.html

19 19 Distributed Ray tracing Fuzzy translucency Fuzzy translucency Same as glossy reflections, but you jitter the refracted ray Same as glossy reflections, but you jitter the refracted ray Analytical function similar to the shading Analytical function similar to the shading A transmission function is used instead of a reflectance function A transmission function is used instead of a reflectance function Light is gathered from the other side of the surface. Light is gathered from the other side of the surface. Cast randomly distributed rays in the general direction of the transmitted ray from traditional ray tracing. Cast randomly distributed rays in the general direction of the transmitted ray from traditional ray tracing. The average value computed from each of these rays the true translucent component. The average value computed from each of these rays the true translucent component.

20 20 Distributed Ray tracing first image is obtained from a traditional ray tracer first image is obtained from a traditional ray tracer Second image uses 10 rays for the transmitted ray Second image uses 10 rays for the transmitted ray third image uses 20 rays third image uses 20 rays taken from http://www.cs.wpi.edu/~matt/courses/cs563/talks/dist_ray/dist_trans_fuzzy_20.html

21 21 Distributed Ray tracing first image is from the traditional ray tracer first image is from the traditional ray tracer second one uses 16 rays in place of the single reflected ray second one uses 16 rays in place of the single reflected ray third images uses 64 rays third images uses 64 rays taken from http://www.uwm.edu/People/dtstrock/graphics/mcrt.html

22 22 Distributed Ray tracing Penumbras (soft shadows) Penumbras (soft shadows) Traditional ray tracing shadows are discrete Traditional ray tracing shadows are discrete Shadow feelers used to check if a point is in shadow with respect to a point light source Shadow feelers used to check if a point is in shadow with respect to a point light source Incorrect for large light sources and/or light sources that are close to the object Incorrect for large light sources and/or light sources that are close to the object The transition from fully shadowed to partially shadowed is gradual. The transition from fully shadowed to partially shadowed is gradual. Due to the finite area of real light sources, and scattering of light of other surfaces Due to the finite area of real light sources, and scattering of light of other surfaces

23 23 Distributed Ray tracing Penumbras (soft shadows) Penumbras (soft shadows) A set of rays are cast about the projected area of the light source. A set of rays are cast about the projected area of the light source. The projected area helps tackle the large area light source The projected area helps tackle the large area light source The amount of light transmitted by the ratio of the number of rays that hit the source to the number of rays cast The amount of light transmitted by the ratio of the number of rays that hit the source to the number of rays cast

24 24 Distributed Ray tracing In case of a point source, the occluder would create a sharp shadow boundary In case of a point source, the occluder would create a sharp shadow boundary In an area light source or if the light source is closer to the object In an area light source or if the light source is closer to the object Creation of a penumbra region Sending out shadow feelers to capture the penumbra region Sending out shadow feelers to capture the penumbra region taken from http://www.cs.wpi.edu/~emmanuel/courses/cs563/write_ups/zackw/realistic_raytracing.html

25 25 taken from http://www.cs.wpi.edu/~emmanuel/courses/cs563/write_ups/zackw/realistic_raytracing.html

26 26 Distributed Ray tracing taken from http://www.cs.unc.edu/~andrewz/comp238/hw2/

27 27 Distributed Ray tracing Depth of field - the distance that objects appear in focus Depth of field - the distance that objects appear in focus Objects that are too far away or two close will appear unfocused and blurry Objects that are too far away or two close will appear unfocused and blurry pinhole camera model does not truly mimic the real world situation pinhole camera model does not truly mimic the real world situation Pinhole assumed to be infinitely small Pinhole assumed to be infinitely small Changing focal length change field of view but does not change focus Changing focal length change field of view but does not change focus

28 28 Distributed Ray tracing Distributed ray tracing creates depth of field by placing an artificial lens in front of the view plane. Distributed ray tracing creates depth of field by placing an artificial lens in front of the view plane. Randomly distributed rays are used once again to simulate the blurring of depth of field. Randomly distributed rays are used once again to simulate the blurring of depth of field. The first ray cast is not modified by the lens. The first ray cast is not modified by the lens. focal point of the lens is at a fixed distance along this ray focal point of the lens is at a fixed distance along this ray Rest of the rays sent out for the same pixel will be scattered about the surface of the lens Rest of the rays sent out for the same pixel will be scattered about the surface of the lens Points in the scene that are close to the focal point of the lens will be in sharp focus. Points in the scene that are close to the focal point of the lens will be in sharp focus. Points closer or further away will be blurred Points closer or further away will be blurred

29 29 taken from http://www-courses.cs.uiuc.edu/~cs419/mp2/gallery-sp04/

30 30 Distributed Ray tracing taken from http://www-courses.cs.uiuc.edu/~cs419/mp2/mp2-gallery-sp05/

31 31 Distributed Ray tracing Motion blur Motion blur Temporal sampling rather than spatial sampling Temporal sampling rather than spatial sampling A Frame represents an average of the scene during the time that the camera shutter is open A Frame represents an average of the scene during the time that the camera shutter is open Before each ray is cast, objects are translated or rotated to their correct position for that frame. Before each ray is cast, objects are translated or rotated to their correct position for that frame. The rays are averaged to give the actual value. The rays are averaged to give the actual value. Objects with the most motion will have the most blurring in the rendered image. Objects with the most motion will have the most blurring in the rendered image.

32 32 Distributed Ray tracing taken from http://www-courses.cs.uiuc.edu/~cs419/mp2/mp2-gallery-sp05/

33 33 Distributed Ray tracing taken from http://www-courses.cs.uiuc.edu/~cs419/mp2/mp2-gallery-sp05/

34 34 Bidirectional Ray tracing Created by H. Wann Jensen caustic

35 35 Bidirectional Ray tracing Caustic - (Concentrated) specular reflection/refraction onto a diffuse surface Caustic - (Concentrated) specular reflection/refraction onto a diffuse surface Standard ray tracing cannot handle caustics Standard ray tracing cannot handle caustics caustic Created by H. Wann Jensen

36 36 Light Paths Interactions of the light ray can be expressed using regular expressions Interactions of the light ray can be expressed using regular expressions L is the light source L is the light source E is the eye/camera E is the eye/camera D is a diffuse surface D is a diffuse surface S is a specular surface S is a specular surface from Sillion & Puech

37 37 Light Paths Direct visualization of the light: LE Direct visualization of the light: LE Local illumination: LDE, LSE Local illumination: LDE, LSE Ray tracing: LS*E, LDS*E Ray tracing: LS*E, LDS*E Caustics: LS + DE Caustics: LS + DE Taken from cisc 440/640 – Fall 2005 from Sillion & Puech

38 38 Diffuse Surfaces Uncertainty in the direction that a photon will take for diffuse surfaces Uncertainty in the direction that a photon will take for diffuse surfaces For specular surfaces, the BRDF (probability that incoming photon will leave in a particular direction) has a thin profile For specular surfaces, the BRDF (probability that incoming photon will leave in a particular direction) has a thin profile We can predict the direction of the outgoing photon We can predict the direction of the outgoing photon For an ideal diffuse surfaces, the BRDF would be spherical For an ideal diffuse surfaces, the BRDF would be spherical The photon can travel along any of the direction with equal probability The photon can travel along any of the direction with equal probability from Sillion & Puech

39 39 Bidirectional Ray tracing Idea: Trace forward light rays into scene as well as backward eye rays Idea: Trace forward light rays into scene as well as backward eye rays At diffuse surfaces, light rays additively “deposit” photons in radiosity textures, or “rexes”, where they are picked up by eye rays The rays of the forward and backward pass "meet in the middle" to exchange information. The rays of the forward and backward pass "meet in the middle" to exchange information. from P. Heckbert Paul S. Heckbert, “Adaptive radiosity textures for bidirectional ray tracing “, SIGGRAPH 1990

40 40 Radiosity Handling cases such as LD*E Handling cases such as LD*E “Color Bleeding” “Color Bleeding” courtesy of Cornell

41 41 Softwares Two beautiful rendering/modeling softwares Two beautiful rendering/modeling softwares POV-ray (http://www.povray.org/) POV-ray (http://www.povray.org/)http://www.povray.org/ Persistence of Vision - ray tracer Persistence of Vision - ray tracer A free rendering tool (not a modeling tool) A free rendering tool (not a modeling tool) Uses a text based scene description language (SDL) Uses a text based scene description language (SDL) Available on Windows/linux/MAC OS Available on Windows/linux/MAC OS Blender (http://www.blender3d.org) Blender (http://www.blender3d.org)http://www.blender3d.org Modeling, Animation, rendering tool Modeling, Animation, rendering tool Especially useful in 3D game creation Especially useful in 3D game creation Available for Windows, Linux, Irix, Sun Solaris, FreeBSD or Mac OS X under GPL Available for Windows, Linux, Irix, Sun Solaris, FreeBSD or Mac OS X under GPL

42 42 POV-ray created using POV-ray, http://www.povray.org/

43 43 POV-ray created using POV-ray, http://www.povray.org/

44 44 POV-ray created using POV-ray, http://www.povray.org/

45 45 POV-ray created using POV-ray, http://www.povray.org/

46 46 Conclusion Traditional Ray tracing Traditional Ray tracing Shadow feelers Shadow feelers Reflection Reflection Refraction Refraction Distributed Ray tracing Distributed Ray tracing Jittered sampling Jittered sampling Bidirectional Ray tracing Bidirectional Ray tracing Caustics Caustics

47 47 Thank you


Download ppt "1 Advanced Ray Tracing Mani Thomas CISC 440/640 Computer Graphics."

Similar presentations


Ads by Google