Ambient reflection is designed to capture the effect of a certain amount of light hitting the object from all directions equally (for example, after the light has bounced off many surfaces). It is constant over an object surface, and does not vary with surface normal or viewpoint.
Diffuse reflection captures the effect of the energy from a point or directional light being reflected back from the surface equally in all directions. A rough surface would scatter light in this way. Diffuse reflection differs from ambient reflection because its intensity depends on the relative directions of the light and the surface normal. A diffuse reflection has greater intensity on parts of the surface where the surface normal points more toward the light.
Specular reflection captures the highlights we see from reflections of light on smooth surfaces. It captures the effect that light bouncing off a smooth surface will be primarily reflected about the surface normal. In the limit, we have a perfect mirror, and light is *only* reflected in this direction. Specular reflection differs from ambient and diffuse reflection because it depends on the location of the viewer, as well as on the surface normal and light source vectors.
You are given a triangle with endpoints:
This triangle is a fully saturated red (Od,R = 1), and the
specular color is white. The triangle has the following material
properties:
You have the following light sources:
The viewer is at point [1 2 5 1]T
(A) Compute the intensity of the ambient reflection at the interior point [0.5 1 1 1]T.
Use IakaOd
(B) Compute the intensity of the diffuse reflection at the same point.
Use IpkdOd(nHat . LHat)
For this triangle, normal nHat = [0 0 1 0]T
Light vector L = (light_position - sample_position) = [1 1 5 1]T - [0.5 1 1 1]T = [0.5 0 4 0]T
Normalizing, LHat = [0.124 0 0.992 0]T
Taking the dot product: (nHat . LHat) = 0.992
(C) Compute the intensity of the specular reflection at this point.
Use IpksOs(rHat . VHat)n
From the construction below, rHat = 2(LHat . nHat)nHat - LHat

In this case, rHat = [-0.124 0 0.992 0]T
Viewer vector V = (viewer_position - sample_position) = [1 2 5 1]T - [0.5 1 1 1]T = [0.5 1 4 0]T
Normalizing, VHat = [0.120 0.241 0.963 0]T
Taking the dot product: (rHat . VHat) = 0.940
To the nth power: 0.94010 = 0.539
(D) Given this intensity information, what color should a pixel at this point be drawn?
Sum the ambient, diffuse, and specular terms:
Color = (0.678, 0.162, 0.162)
(E) Describe the contribution of the two different light sources.
The ambient light contributes a small amount of red at this point. Most of the color comes from the point light source.
Flat shading means to choose a single color for each polygon in an image.
Phong shading does a better job than Gouraud shading of capturing specular highlights, especially when the specular highlights vary substantially over single polygons. Phong shading would be a good choice if the necessary computational time is available and sharp specular highlights are needed.
An alternative would be to use one of the smooth shading techniques.
Assume that good estimates for outward pointing unit normal vectors at
the vertices P1, P2, and P3 are as follows:
(A) Compute the new color values at each of the three vertices.
Compute the vectors at point 1:
From these vectors:
Summing, the COLOR at point1 = (0.527, 0.029, 0.029)
Compute the vectors at point 2:
From these vectors:
Summing, the COLOR at point2 = (0.386, 0, 0)
Compute the vectors at point 3:
From these vectors:
Summing, the COLOR at point3 = (0.469, 0, 0)
(B) Use Gouraud shading to compute the color of the point [0.5 1 1 1]T. Assume that the triangle projects onto the display without distortion, so that linear interpolation along the triangle surface gives the same results as linear interpolation in the space of the display.
Referring to the diagram below:

(C) Use Phong shading to compute the color of the point [0.5 1 1 1]T.
Interpolate normals:
From the previous calculation of color at this point, we can get
vectors LHat and VHat. From LHat and nHat, we calculate a new rHat:
From these vectors:
Summing, the COLOR at point p = (0.817, 0.30, 030)
(D) How do the diffuse and specular components of intensity differ for flat shading, Gouraud shading, and Phong shading?
Looking at just the red color component:
The diffuse component comes out very close in all three cases. For
this polygon, linear interpolation of either colors or normals will
produce a reasonable value for the diffuse component.
The estimate of the specular component varies a great deal, however.
In this case, linear interpolation of colors provides an especially
poor approximation to the specular color component.
(E) Compare the amount of computation required for each type of shading.
The difference in computation required is dramatic. For this case, assuming that color has already been computed for the three vertices:
Gouraud shading:
Phong shading:
A curve Q(t) is C2 continuous if the curve itself is continuous, and its first and second derivatives with respect to t are also continuous.
(B)Suppose that we want to draw a C2 continuous curve to
connect points A and B shown below:

We know that the endpoints of the curve we wish to draw are A and B.
Suppose that we also know all of the derivatives of the curve at those
endpoints. In general, can we produce a C2 continuous splice between
A and B with a cubic polynomial curve? Why or why not?
We cannot, in general, produce a C2 continuous splice between A and B
using a cubic polynomial curve, because we do not have enough free
parameters to meet all of the constraints. If we consider only the x
component of the curve over time, x(t), then
We have four unknowns a,b,c, and d. We have 6 constraint equations,
however, because we need to match x, x', and x'' to the existing curve
segments at both points A and B in order to create a C2 continuous
curve. (Parameters x' and x'' are the first and second derivatives of
the curve with respect to t).
(C)What type of curve would you choose to draw a C1 continuous splice between A and B? Give the value of the geometry vector for this curve.
Since we know the endpoints and the derivatives of the curve at
points A and B, a good choice would be a hermite spline. The geometry
vector for the hermite spline would be
where A' is the tangent to the existing curve at
point A, and B' is the tangent to the existing curve at point B.
Suppose that these equations were of the form:
For some unknown value b. Now, consider the four equally spaced
Bezier points (forming a line segment along the x-axis):
Show that, for parametric curve Q(t) to have constant velocity from P1 to P4, b must equal 3.
Consider the x(t) component only. Use the equation x(t) =
TMHGH, x. Taking the derivative with respect to
t, we have
Looking up MH in the text and multiplying with T':
In this case, we have endpoints at x=0 and x=3, and the tangent
vectors are both b, so the geometry vector is:
Multiplying and collecting terms:
For constant velocity, the t and t2 terms above must be
zero. This means that b must be 3.

This would require some amount of extra computation because the geometry vector of the B-spline curve does not express endpoints of the spline directly. (The endpoints of the spline are not control points of the curve.) A better choice might be a Hermite or Bezier curve.
Use this expression for Qi(t) to show that two adjacent curves i and i+1 have C2 continuity at the join point.
To show that the curve has C2 continuity at the join point, we need to
check that the curve and its first and second derivatives are
continuous at the join point. In other words:
where Qi'(t) is the first derivative of Q with
respect to t, and Qi''(t) is the second
derivative of Q with respect to t.
This example walks through the third of these tests. The other two
can be done in a similar fashion.
Curve i has the geometry vector GBs, i = [Pi-3
Pi-2 Pi-1 Pi]T
Curve i+1 has the geometry vector GBs, i+1 =
[Pi-2 Pi-1 Pi
Pi+1]T
To test whether the second derivative is continuous at the join point,
we test whether:
Qi''(t) = T''MBsGBs,
i
Evaluating T'':
Multiplying T'' by MBs:
Simplifying:
Evaluate the second derivative at the end of the first curve:
Evaluate the second derivative at the beginning of the second curve:
Since Qi''(1) =
Qi+1''(0), the second derivative of the curve is
continuous at the join point.
Qi''(t) = [6t 2 0 0] MBsGBs,
i
Qi''(t) = 1/6[(-6t+6) (18t-12) (-18t+6)
(6t)]GBs, i
Qi''(t) = [(-t+1) (3t-2) (-3t+1) (t)]GBs,
i
Qi''(1) = [0 1 -2 1]GBs, i =
Pi-2 - 2Pi-1 + Pi
Qi+1''(0) = [1 -2 1 0]GBs, i+1 =
Pi-2 - 2Pi-1 + Pi
(A)Derive the geometry vector to construct this patch as a Hermite surface patch. Align parameter s with the x-axis and parameter t with the y-axis.
For a Hermite surface patch, we have:
In this case:
The geometry vector is:
(B)What is the geometry vector if we make this a Bezier surface patch?
For a Bezier surface patch, we have:
In this case:
The geometry vector is:
An octree data structure can be used to represent the portions of
3D space occupied by an object. It can be constructed in a top-down
fashion, starting with a set containing a single cell enclosing the
entire object. Cells in the set are recursively subdivided into 8
parts. Subdivision stops when one of the follow is true:
An octree representation differs from a spatial occupancy grid because
it provides a mechanism for grouping cells, rather than representing
all cells at the maximum level of subdivision. In general, the number
of cells in an octree will vary with the surface area of an object
rather than with its volume.
(A)Describe an algorithm for doing the union operation for two quadtrees. Be careful to compress nodes when possible to maintain a compact representation of the object.
Trace through the two trees in parallel, depth-first, starting at their roots. Take the following actions based on the values found in the two trees:
If we have one of (FF, EF, FE, PF, FP)
If we have (EE)
If we have (PP)
If we have (EP)
In a second pass, once the tree is constructed, trace through the new tree depth-first, grouping any P node with 4 F children into an F node, and any P node with 4 E children into an E node.
(B)Trace the operation of the union algorithm on the two
quadtrees below. Draw a sketch of the two objects and their union to
test your algorithm.



Sketch:

Trace the first few generations of branching structures using the
following rewrite rule:
