EECS101: HOMEWORK #7

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (3 votes)

In this assignment, you will write a program to generate images of a sphere under orthographic
projection using a reflectance model. Consider a representation for a sphere centered on the
optical axis with radius r and center (0, 0, z0)
z(x, y) = z0 +
q
r
2 − (x
2 + y
2
) (x
2 + y
2
) ≤ r
2
(1)
What is the unit surface normal Nc(x, y) to the sphere as a function of x and y? Turn in this
answer with your code.
We will consider only illumination by point sources. Let bS denote a unit vector in the direction
of the source. We assume that the source is distant relative to the size of the sphere so that for a
given source position, the vector bS is constant across the surface of the sphere. We let bV denote
a unit vector in the direction of the camera. We assume that the camera is distant relative to
the size of the sphere so that bV for this geometry is always (0, 0, 1). The scene radiance L for a
Lambertian surface is proportional to cos θ where θ is the angle between bS and Nc. For a more
general surface, we can write
L = aLl + (1 − a)Ls (2)
for a constant a (0 ≤ a ≤ 1) where Ll
is the scene radiance due to Lambertian reflection
Ll = cos θ (3)
and Ls is the scene radiance due to specular reflection. We can model Ls using
Ls = e
−(α/m)
2
(4)
where m is a constant that is related to the roughness of the surface and α is defined as follows.
Let Hc be the unit vector that is the angular bisector of bV and bS, i.e.
Hc =
bV + bS
|
bV + bS|
· (5)
Then α is the angle in radians between Nc and Hc. Hc is the hypothetical normal to a surface
that would give perfect specular reflection in the direction of the camera bV . Thus, α measures
how much Nc deviates from this orientation. If α is small, then Ls will be near 1. Otherwise Ls
will be small.
Note that the maximum value of L is 1. Your program should generate images of the sphere
by evaluating (2) across the surface and scaling the resulting values by 255 to generate numbers
that are appropriate for eight bit pixel values. Note that we are using the fact that image
irradiance is proportional to scene radiance. Each image will have only one source position bS.
For each image, only the vector Nc should change as you compute the image since bS and bV
are assumed constant. Your TA will provide values for bS, m, a, and r to generate images to
submit. You are encouraged to experiment with different values for these parameters and to try
to understand their role in the image formation process. Also submit your code.