CS480 / CS680 Program Assignment 4  2004
http://www.cs.bu.edu/fac/sclaroff/courses/cs480/p4/
1 of 6
4/7/2008 12:55 AM
Programming Assignment 4: Ray Tracing
Due Monday April 28 at 11:59pm
Write a ray tracer that implements at least the following capabilities:
ray tracing of quadric surfaces of the form
x
T
Qx
= 0
spheres
ellipsoids
cylinders (with two planar endcaps)
boxes (formed by 6 planes)
support for up to 5 RGB color light sources:
point light sources (with radial attenuation)
spot light sources (wiht angular attenuation)
infinite light sources
ambient light sources
RGB color lighting model that includes: ambient, diffuse and specular terms
shadows
reflections
The corresponding lighting model equations in the textbook are:
(102) radial attenuation
(105) angular attenuation
(109) for diffuse reflection
(1013) for specular reflection
(1019) for combined lighting
Quadric Surfaces
In this assignment, your ray tracer will only need to support quadric surfaces of the form:
F(x,y,z) = Ax
2
+ 2Bxy + 2Cxz + 2Dx + Ey
2
+ 2Fyz + 2Gy + Hz
2
+ 2Iz + J = 0
This general equation can be written in matrix notation as
x
T
Qx
= 0,
where
Q
is the 4x4 matrix:
Q =  A B C D 
 B E F G 
 C F H I 
 D G I J 
and
x
T
= [x y z 1].
To intersect a ray
x
=
p
+ t
u
with the quadric surface, we simply substitute
x
into the matrix equation above.
Expanding out we get
0 =
x
T
Qx
=
(p +
t
u)
T
Q(p +
t
u) = (u
T
Qu
)t
2
+
(2u
T
Qp)
t
+
(p
T
Qp
)
which is a quadratic equation in
t
.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
CS480 / CS680 Program Assignment 4  2004
http://www.cs.bu.edu/fac/sclaroff/courses/cs480/p4/
2 of 6
4/7/2008 12:55 AM
A vector in the direction of the normal to the surface at any point
x
on the surface is simply
n = Qx.
Objects Composed of Multiple Surfaces
In your implementation, solid objects should be defined in terms of a collection of surfaces of the form
x
T
Qx
=
0.
Each surface's implicit equation defines two halfspaces: any point
x
is
inside
if
x
T
Qx
°
0
, or
outside
This is the end of the preview.
Sign up
to
access the rest of the document.
 File format, Specular reflection, Bump mapping, Quadric

Click to edit the document details