Assignment for Ray Tracing Miscellaneous - Image Computation | CS 510, Assignments of Computer Science

Material Type: Assignment; Professor: Beveridge; Class: Image Computation; Subject: Computer Science; University: Colorado State University; Term: Summer 1999;

Typology: Assignments

Pre 2010

Uploaded on 11/08/2009

koofers-user-fpj
koofers-user-fpj 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
J. Ross Beveridge, Februa ry 9, 1999CS510 - Computer Graphics, Spring 1999CS510 - Computer Graphics, Spring 1999 Page:7-1
Ray Tracing Miscellaneous
wRefraction
wFace Normals
wRay Intersection with a Cone
wRay Intersection with an Axis Aligned Box
wLoading and Retrieving from a Grid
wExamples
J. Ross Beveridge, February 9, 1999CS510 - Computer Graphics, Spring 1999CS510 - Computer Graphics, Spring 1999 Page:7-2
Refraction
wKey is snellÕs law:
wWhere:
sin sin
θη
ηθ
r
i
r
i
()
=
()
θ
θ
η
η
i
r
i
r
efraction
angleof incidence
angleof r
indexof refractionoutside
indexof refractioninside
L
N
R
θ
i
θ
i
θ
r
T
TNL
i
r
ir
i
r
=
()
()
η
ηθθ
η
η
cos cos
wThe refraction ray is:
J. Ross Beveridge, February 9, 1999CS510 - Computer Graphics, Spring 1999CS510 - Computer Graphics, Spring 1999 Page:7-3
SnellÕs Law Example
J. Ross Beveridge, Februar y 9, 1999CS510 - Computer Graphics, Spring 1999CS510 - Computer Graphics, Spring 1999 Page:7-4
Issues with Refraction
wUsing the CS510 File Format É
ŸRefraction only possible with spheres.
ŸNeed faces tied to solids to do polygons.
Vertex Vertex VertexVertex Vertex Vertex Vertex Vertex
Face Face Face Face
Solid
Face Face
J. Ross Beveridge, Februar y 9, 1999CS510 - Computer Graphics, Spring 1999CS510 - Computer Graphics, Spring 1999 Page:7-5
Face Normals
wComputing the Face Normal.
ŸRule one: pick successive vertices
V1
V2
V3
V4
V5
wThe normal is the cross product of two vectors:
wProblems??
NVV VV
VV VV
=
()
×−
()
()
×−
()
21 31
21 31
J. Ross Beveridge, February 9, 1999CS510 - Computer Graphics, Spring 1999CS510 - Computer Graphics, Spring 1999 Page:7-6
Ray Cylinder Intersection
wTake the intersection of the cylinder and ray equations:
wThis is best done in Maple - so we will ...
pf2

Partial preview of the text

Download Assignment for Ray Tracing Miscellaneous - Image Computation | CS 510 and more Assignments Computer Science in PDF only on Docsity!

CS510 - Computer Graphics, Spring 1999CS510 - Computer Graphics, Spring 1999  J. Ross Beveridge, February 9, 1999 Page:7-

Ray Tracing Miscellaneous

w Refraction w Face Normals w Ray Intersection with a Cone w Ray Intersection with an Axis Aligned Box w Loading and Retrieving from a Grid w Examples

CS510 - Computer Graphics, Spring 1999CS510 - Computer Graphics, Spring 1999  J. Ross Beveridge, February 9, 1999 Page:7-

Refraction

w Key is snell’s law: w Where:

sin θ (^) r ηη i sinθ r

( )= ( i )

θ θ η η

i r i r

efraction

angle of incidence angle of r index of refraction outside index of refraction inside

L

N

R

θ i θ i

θ r T T i N L r

i r i r

^

^

η − η

θ θ η η

cos cos

w The refraction ray is:

CS510 - Computer Graphics, Spring 1999CS510 - Computer Graphics, Spring 1999  J. Ross Beveridge, February 9, 1999 Page:7-

Snell’s Law Example

CS510 - Computer Graphics, Spring 1999CS510 - Computer Graphics, Spring 1999  J. Ross Beveridge, February 9, 1999 Page:7-

Issues with Refraction

w Using the CS510 File Format … ü Refraction only possible with spheres. ü Need faces tied to solids to do polygons.

Vertex Vertex Vertex Vertex Vertex Vertex Vertex Vertex

Face Face Face Face

Solid

Face Face

CS510 - Computer Graphics, Spring 1999CS510 - Computer Graphics, Spring 1999  J. Ross Beveridge, February 9, 1999 Page:7-

Face Normals

w Computing the Face Normal. ü Rule one: pick successive vertices

V 2 V 1

V 3

V 4

V 5

w The normal is the cross product of two vectors:

w Problems??

N V^ V^ V^ V

V V V V

= (^ − ) ×^ (^ − )

( − ) × ( − )

2 1 3 1 2 1 3 1

CS510 - Computer Graphics, Spring 1999CS510 - Computer Graphics, Spring 1999  J. Ross Beveridge, February 9, 1999 Page:7-

Ray Cylinder Intersection

w Take the intersection of the cylinder and ray equations: w This is best done in Maple - so we will ...

CS510 - Computer Graphics, Spring 1999CS510 - Computer Graphics, Spring 1999  J. Ross Beveridge, February 9, 1999 Page:7-

Ray Cone Intersection

w Again, this is actually very simple, although the result below does not make it seem so. w Step through the Maple worksheet to see how this is done.

CS510 - Computer Graphics, Spring 1999CS510 - Computer Graphics, Spring 1999  J. Ross Beveridge, February 9, 1999 Page:7-

Accessing Grids Cells is Scan

Conversion

w Recall that a ray is just a parameterized line segment. w Breshenham’s algorithm enumerates cells (pixels). w So, to list out the cells through which the ray passes. w Use Breshenham’s algorithm with the following changes. ü Find the axis of greatest travel ü Without loss of generality, assume it is the z axis. ü Use z as the independent variable (x in standard alg.) ü Enumerate the x and y values in parallel to get 3D cell coordinates. w This approach is very efficient and does not intersections.

CS510 - Computer Graphics, Spring 1999CS510 - Computer Graphics, Spring 1999  J. Ross Beveridge, February 9, 1999 Page:7-

Ray Tracing Examples

w Let’s do some interactive experimentation with ray tracing. w Here is the first example from the assignment.