


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A lecture note from cs510 - computer graphics course, spring 2009 at carnegie mellon university. It covers the topic of ray tracing intersections, focusing on recursive ray tracing and sphere intersection calculations. The note explains the general idea of ray tracing, the importance of ray-to-surface intersection calculations, and the algorithms tied to different surface types such as spheres. It also discusses representing a ray, sphere intersection calculations using brute force and optimized codes, and the actual sphere intersection points.
Typology: Study notes
1 / 4
This page cannot be seen from the preview
Don't miss anything!



CS510CS510 -- Computer Graphics, Spring 2009Computer Graphics, Spring 2009 © Bruce A. Draper & J. Ross Beveridge, January 26, 2009
z How do we see objects?
retina (or film).
another, and onto our retina.
…., and onto our retina.
z We want to emulate this process, starting at the camera (or
retina) and working backwards….
CS510 -CS510- Computer Graphics, Spring 2009Computer Graphics, Spring 2009 © Bruce A. Draper & J. Ross Beveridge, January 26, 2009
z Ray-to-Surface Intersection Calculations are Key.
z Algorithms tied to surface type.
z First pass: General Mathematics
z Second pass: Highly Optimized Codes
CS510CS510 -- Computer Graphics, Spring 2009Computer Graphics, Spring 2009 © Bruce A. Draper & J. Ross Beveridge, January 26, 2009
R s ( )= L + sU
z Consider a sphere centered at P c with radius r.
c
2
2
c
2
2
c
(^ sU^ −^ T ) ⋅^ ( sU^ −^ T ) −^ r
2
L
x c − x 0
y (^) c − y 0
zc − z 0
s −
u (^) x
u (^) y
u z
t (^) x
t (^) y
t z
s −
u (^) x
u (^) y
u z
t (^) x
t (^) y
t z
r
2 0
W ⋅ W − r
2 = (^0) W=
s u x − t x
s u (^) y − t (^) y
s uz − t (^) z
( s ux − t (^) x )+ + − =
2 ( s uy − t (^) y )
2 ( s u (^) z − t (^) z )
2 r
2 0
CS510 -CS510- Computer Graphics, Spring 2009Computer Graphics, Spring 2009 © Bruce A. Draper & J. Ross Beveridge, January 26, 2009
z After multiplying out, expand and collect s terms.
( u x + + ) +
2 u (^) z
2 u (^) y
2 s
2
( (^) − 2 t (^) y u (^) y − 2 t (^) x ux − 2 t (^) z uz ) s +
t x − + + =
2 r
2 t (^) z
2 t (^) y
2 0
z U is a unit vector, so (u x
2
2
2 ) = 1
z So the equation may be written as:
2
2
CS510CS510 -- Computer Graphics, Spring 2009Computer Graphics, Spring 2009 © Bruce A. Draper & J. Ross Beveridge, January 26, 2009
Consider that we now have a simple quadratic equation.
2 2
2
2 2 2
2 2 2
2
Therefore:
s UT UT T r
UT UT T r s
a
b b ac s
CS510 -CS510- Computer Graphics, Spring 2009Computer Graphics, Spring 2009 © Bruce A. Draper & J. Ross Beveridge, January 26, 2009
z Compute the two s values for the
two intersections:
(^222) 2
(^222) 1
s UT UT T r
s UT UT T r
8 multiplies/squares
(caching results; r 2
previously stored)
8 additions
1 square root
z Compute the actual positions along the ray for the smallest
positive s:
s
= min( s 1 , s 2
= P 0 + s
U
3 multiplies
3 additions
1 min
CS510CS510 -- Computer Graphics, Spring 2009Computer Graphics, Spring 2009 © Bruce A. Draper & J. Ross Beveridge, January 26, 2009
z The proceeding follows naturally from parametric
approach to intersecting objects.
z But is it smart?
z Might there be a more efficient way?
z Yes.
z Let’s see it …
v d
b r
C
v
2
2 = c
2
d
2
2 = r
2
d
2 = r
2 − c
2 − v
2
d = r
2 − c
2 − v
2
E
O
R
2
Q
z Assume R is given - unit length ray direction.
z Need to compute v: v = (O-E)•R
z Both r 2 and c 2 are already computed.
z Test if r
2 is greater than (c
2
2 )
z Only if intersection, Q = E+(v-d)R.
z Another reference on this approach:
(overconstrained)
z 0 ≤ T (^) IPRay
z 0 ≤ T edge < 1
intersecting polygons.