Using the example Phong-shader applet test2.java that I implemented in class, replace the fake sphere by a sphere made from an actual polygonal mesh.

For this first step, don't need to do any matrix transformations before you do the shading calculation. In other words, keep your unit sphere as a unit sphere. Before shading, your sphere mesh should look something like the one in the figure below.

Note that when you scan-convert this mesh, you will end up with two triangles for each polygon that is not at the north pole, so your scan-converter will need to split any four-sided polygon into two triangles, and separately render each triangle. The figure below shows one way to split each four-sided polygon into two triangles:

The sequence of your algorithm should be as follows:

• For each vertex: • Use the Phong algorithm and thenormal vectorat that vertex to computer,g,b• For each polygon: • Split the polygon into triangles as needed. • For each triangle: • Scan convert, while interpolating r,g,b from each of the three vertices.

In the special case of the unit sphere, the *normal vector* is very simple -
it's just the same as the (x,y,z) coordinates of the vertex itself.

Notice that scan-conversion of a full-color triangle is very much the same as what you did last week - split your triangle into two trapezoids, and then interpolate values from the four corners of a trapezoid down to each pixel. The only difference is that in addition to linearly interpolating x and y, you also linearly interpolate each of r,g,b.

For the assignment, I'd like you to try your own combinations
of surface material and lights.
*Do not duplicate*
the surface materials or lights I use in test2.java -
come up with your own.

This assignment will be due **Wednesday April 1.**