Title: Advanced Ray Tracing
1Advanced Ray Tracing
- Mani Thomas
- CISC 440/640
- Computer Graphics
2Review
- Ray tracing
- Compute 3D ray into the scene for each 2D image
pixel - Compute 3D intersection point of ray with nearest
object in scene - Test each primitive in the scene for intersection
- Find nearest intersection
- Recursively spawn rays from the point of
intersection - Shadow Rays
- Reflected rays
- Transmitted rays
- Accumulate the color from each of the spawned
rays at the point of intersection
3Review
- Ray object intersection
- Intersection with a plane
- Implicit form
- Intersection
- Intersection with a sphere
- Implicit form
- Intersection
4Review
- Shadow feelers
- 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 - Reflection
- Angle of incidence angle of Reflection
5Review
- Refraction
- Ray passing through media of different refractive
indices bend towards/away from the normal - Snells Law
- ni and nr are the refractive indices of the two
media - Transmitted ray
6Review
- Using Extents
- Ray tracing is slow, performing the same
functions. - Most of the time is spent in computing
intersections - 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
7Review
- Extent of an object is a shape that encloses the
object - Compute complicated intersections if and only if
the ray hits the extent - Two shapes most commonly used as extents
- Sphere specified by a center and radius (C , r)
- Box specified by sides aligned to the
coordinate axis
8Review
- Super-sampling
- Instead of shooting one ray per pixel, shoot four
rays through the corners of a pixel - Adaptive super-sampling (Whitteds approach)
- Shoot more rays through corners with higher
intensity variation - Compute final color as a weighted average rather
than the regular average
9Road map
- Monte Carlo methods
- Distributed ray tracing
- Bidirectional ray tracing
- Caustics
- POV-ray
10Distributed Ray Tracing
- 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
/cs563/talks/dist_ray/dist.html)
11Distributed Ray Tracing
- Developed by Cook, et. al. (Distributed Ray
Tracing, Computer Graphics, vol. 18, no. 3, pp
137-145, 1984) - Stochastic Oversampling (http//www.cs.virginia.ed
u/cs551dl/lecture11/sld016.htm) - Pixel for antialiasing
- Light source for soft shadows
- Reflection function for soft (glossy) reflections
- Time for motion blur
- Lens for depth of field
12Distributed Ray tracing
- Gloss (fuzzy reflections)
- Partially reflecting surfaces
- Traditional ray tracing
- reflections look identical to the scene they are
reflecting - reflections are always sharp
- Randomly distributing the rays reflected by the
surface - 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
13Distributed Ray tracing
- 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.
taken from http//www.cs.wpi.edu/emmanuel/courses
/cs563/write_ups/zackw/realistic_raytracing.html
14Distributed Ray tracing
- first image is from the traditional ray tracer
- second one uses 16 rays in place of the single
reflected ray - third image uses 64 rays
taken from http//www.uwm.edu/People/dtstrock/grap
hics/mcrt.html
15Distributed Ray tracing
taken from http//www.cs.wpi.edu/emmanuel/courses
/cs563/write_ups/zackw/realistic_raytracing.html
16Distributed Ray tracing
- Fuzzy translucency
- Same as glossy reflections, but you jitter the
refracted ray - Analytical function similar to the shading
- A transmission function is used instead of a
reflectance function - 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. - The average value computed from each of these
rays the true translucent component.
17Distributed Ray tracing
- first image is obtained from a traditional ray
tracer - Second image uses 10 rays for the transmitted ray
- third image uses 20 rays
taken from http//www.cs.wpi.edu/matt/courses/cs5
63/talks/dist_ray/dist_trans_fuzzy_20.html
18Distributed Ray tracing
- first image is from the traditional ray tracer
- second one uses 16 rays in place of the single
reflected ray - third images uses 64 rays
taken from http//www.uwm.edu/People/dtstrock/grap
hics/mcrt.html
19Distributed Ray tracing
- Penumbras (soft shadows)
- Traditional ray tracing shadows are discrete
- 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 - 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
20Distributed Ray tracing
- Penumbras (soft shadows)
- 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 amount of light transmitted by the ratio of
the number of rays that hit the source to the
number of rays cast
21Distributed Ray tracing
- 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 - Creation of a 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
22taken from http//www.cs.wpi.edu/emmanuel/courses
/cs563/write_ups/zackw/realistic_raytracing.html
23Distributed Ray tracing
taken from http//www.cs.unc.edu/andrewz/comp238/
hw2/
24Distributed Ray tracing
- Depth of field - the distance that objects appear
in focus - 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 assumed to be infinitely small
- Changing focal length change field of view but
does not change focus
25Distributed Ray tracing
- 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. - The first ray cast is not modified by the lens.
- 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 - 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
26taken from http//www-courses.cs.uiuc.edu/cs419/m
p2/gallery-sp04/
27Distributed Ray tracing
taken from http//www-courses.cs.uiuc.edu/cs419/m
p2/mp2-gallery-sp05/
28Distributed Ray tracing
- Motion blur
- Temporal sampling rather than spatial sampling
- 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. - The rays are averaged to give the actual value.
- Objects with the most motion will have the most
blurring in the rendered image.
29Distributed Ray tracing
taken from http//www-courses.cs.uiuc.edu/cs419/m
p2/mp2-gallery-sp05/
30Distributed Ray tracing
taken from http//www-courses.cs.uiuc.edu/cs419/m
p2/mp2-gallery-sp05/
31Bidirectional Ray tracing
caustic
Created by H. Wann Jensen
32Bidirectional Ray tracing
- Caustic - (Concentrated) specular
reflection/refraction onto a diffuse surface - Standard ray tracing cannot handle caustics
caustic
Created by H. Wann Jensen
33Light Paths
- Interactions of the light ray can be expressed
using regular expressions - L is the light source
- E is the eye/camera
- D is a diffuse surface
- S is a specular surface
from Sillion Puech
34Light Paths
- Direct visualization of the light LE
- Local illumination LDE, LSE
- Ray tracing LSE, LDSE
- Caustics LSDE
from Sillion Puech
Taken from cisc 440/640 Fall 2005
35Diffuse 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 - We can predict the direction of the outgoing
photon - For an ideal diffuse surfaces, the BRDF would be
spherical - The photon can travel along any of the direction
with equal probability
from Sillion Puech
36Bidirectional Ray tracing
from P. Heckbert
- 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.
Paul S. Heckbert, Adaptive radiosity textures
for bidirectional ray tracing , SIGGRAPH 1990
37Radiosity
- Handling cases such as LDE
- Color Bleeding
courtesy of Cornell
38Softwares
- Two beautiful rendering/modelling softwares
- POV-ray (http//www.povray.org/)
- Persistence of Vision - ray tracer
- A free rendering tool (not a modeling tool)
- Uses a text based scene description language
(SDL) - Available on Windows/linux/MAC OS
- Blender (http//www.blender3d.org)
- Modeling, Animation, rendering tool
- Especially useful in 3D game creation
- Available for Windows, Linux, Irix, Sun Solaris,
FreeBSD or Mac OS X under GPL
39POV-ray
created using POV-ray, http//www.povray.org/
40POV-ray
created using POV-ray, http//www.povray.org/
41POV-ray
created using POV-ray, http//www.povray.org/
42POV-ray
created using POV-ray, http//www.povray.org/
43Conclusion
- Traditional Ray tracing
- Shadow feelers
- Reflection
- Refraction
- Distributed Ray tracing
- Jittered sampling
- Bidirectional Ray tracing
- Caustics
44Thank you