finalreview_answer

advertisement
November 27, Fall 2000
CS 384: Answers of Review Questions
Problem 1. A ray starts from [1, 2, 3] and passes through [4, 2, 0]. Find the intersection between the ray and a
sphere centered at [1,0,0] with a radius of 3. Also find the normalized surface normal of the intersections.
Answer : The ray equation:
 x  1  3t

.
y  2
 z  3  3t

The sphere equation:
( x  1) 2  y 2  z 2  9 .
(2)
Substitute (1) into (2), we get:
9t 2  9t  2  0 .
(3)
(1)
1
2
Equation (3) has two roots: t1  , t 2 
3
3
Thus we get two intersection points: (2, 2, 2) and (3, 2, 1). Since the first root is closer to the viewer than is the
other root, the intersections between the ray and sphere is (2, 2, 2).
The normal at that point is:
 2  1  1 

  
 2  0    2  . After normalized, it becomes
 2  0  2

  
1 / 3 


 2 / 3 .
 2 / 3


Problem 2. A sphere’s center is located at [0, 0, -5] with a radius 1. A ray starts from the eye position [0, 1, 0]
with a [0, -1, -4] direction. The light is at infinity with a [0, 1, -1] direction. Calculate the ambient, diffuse and
specular component of the intersection point.
Answer : Suppose the light has intensity I with ambient component I  .
 Ambient component: K  I  .
 Diffuse component:
First, the intersection point between the ray and the sphere is (0, 0, -4) and the normal N at that
2
(0,1,1) . So
point of the sphere is (0, 0, 1). The light direction L is (0, 1, -1) and normalized to
2
the diffuse component is:
2
Kd I .
K d I ( N  ( L)) =
2
 Specular component:
The direction R of the outgoing (reflected) ray at the intersection point is (0, -1, 4) and
17
(0,1,4) . So the specular component is:
normalized to
17
K s I ( N  ( L))  ( R  ( L)) n =
2 5 34
5 17

KsI =
K s I , where n is a positive integer.
2
34
34
Problem 3. As shown in the picture, A, B, C, D and E are triangle vertices. The length of CE is one third of that
of AC. I denote the shading intensity. I A  0.8 , I B  0.4 , I C  0.2 , I D  0.3 and I E  0.5 . Based on Gouraud
shading, find the intensity of three points P1 , P2 , P3 which are inside different triangle and are very close to E (as
shown in the figure). Why this mesh is bad for visualization?
A
P1
D
P2
P3
E
B
C
Answer : Consider P1 . Since in triangle ADE, the intensity of P1 is determined by:
I( P1 ) = w1 I A  w2 I D  w3 I E , where ( w1 , w2 , w3 ) are the barycentric coordinates of P1 in triangle ADE .
When P1 is very close to E, the barycentric coordinates of P1 is almost (0, 0, 1). So I ( P1 )  I E  0.5 .
Similarly, I ( P2 )  I E  0.5
Consider P3 in triangle ABC. When P3 is very close to E, the barycentric coordinates of P3 is almost
1 2
1
2
( ,0, ) in the order of A-B-C. So I ( P3 )  I A  I C  0.4 .
3 3
3
3
Since at point E, the intensity is not continuously displayed, it’s bad for visualization.
Problem 4. Suppose that we have a sphere of radius 1 centered at the origin, and a world coordinate system
with the z-axis pointing up, and a single point light source (whose location we do not know). A viewer is at the
point with coordinates (2, 0, 2). The viewer observes that brightest diffuse point on the sphere is at its north
pole (the point (0, 0, 1)). Assume a Phong model of illumination, and that the sphere has both diffuse and
specular components. What does the viewer’s observation imply about the possible location of the light source?
Answer : According to the Phong model of illumination, the diffuse component that one can observe is

 
determined by: K d  I  ( N  L) . Therefore, the diffuse component has its brightest intensity if and only if L has

the same direction as N . So the possible location of light source is (0, 0, t), where t  1 .
Problem 5. Consider a new type of light called a spot-light. A spot-light is defined by giving a point P, a

vector v (normalized to unit length) and an angle  . The spot light illuminates any point that lies within an

infinite 3-dimensional cone whose apex is P and whose angular radius about v is  . Write a function which,

given a point Q in 3-space, and P, v , and  , determines whether Q is illuminated by the spot-light.
P


v
Answer: Suppose P  ( Px , Py , Pz ) and Q  (Q x , Q y , Q z ) . The vector from P to Q is

u  (Q x  Px , Q y  Py , Q z  Pz ) .
 
If u  v  cos , then Q is illuminated by the spot-light. Otherwise, Q is not illuminated by the spot-light.
Problem 6. Consider the cone shown in the figure below. Its axis is along the z-axis, its apex is at the
origin, its height is 1, and its base has a radius of 1. Also consider a texture that consists of a quarter circle
of radius 1. The object is to wrap this texture around the cone (like wrapping a cover around an ice cream
cone) so that the texture origin is mapped to the apex of the cone and the circular arc is mapped to the
cone’s circular base. The seam where the texture wraps around on itself lies in the x z-plane.
Cone Base
z
1
1
1
1
1
y1
1
1
x
1 Cone apex
1
(a) Give an implicit function f(x,y,z)=0 that describes1the surface of the cone. (Don’t worry about trimming
the cone at its base. The infinite surface is good enough.)
1
(b) Give the inverse wrapping function, which maps
1 a point (x, y, z) on the surface of the cone to a
corresponding point (s, t) in texture space. (Hint: 1It may be easier to first derive the polar coordinates in
texture space, and then convert to (s, t) coordinates.)
1
1
Answer : (a) The implicit function of cone is: x 2  y12  z 2  0 .
(b) For a point P = (x, y, z) on the cone surface, We
1 first project it onto the base plane of the cone:
1
1
1
T1: ( x, y, z)  ( x, y) z 1 .
Then the projected point P ' on the base plane forms an angle a with the seam line:
T2: ( x, y) z 1  a  [0, 2 ]
If x  0, y  0 , a = arctg (
y
).
x
If x  0, y  0 , a = 2   arctg (
y
y
).
x
P’
y
If x  0 , a =   arctg ( ).
x
a
x
Then we map the polar coordinates on the base plane to the polar
coordinates in the texture space:

T3: a  [0, 2 ]  w  [0, ]
2
a
 .
4
This is because the texture represents only 90o instead of 360o.
Finally we convert the polar coordinates in the texture space to
(s, t) coordinates:

T4: w  [0, ]  ( s, t )
2
s  z  cos( w)

t  z  sin( w)
We use z here to represent the distance between Q and the origin
in the texture space, because both the height of the cone and the radius
of the quarter circle are equal to 1.
t
Q
z
w
s
Download