Week 8 Solution
Question 1
We have to normalize the surface normal, so N = (0,0.6,0.8). N.L= 0.8.
Result is 0.8x(0.4×0.2, 0×0.7, 1×0.9) = (0.064,0,0.72)
Question 2
This is a diamond in the x-y plane. Drawing a diagram may help students understand the solution better.
(a) The centre of the polygon is the average of all the vertices, hence. (-1+0+1+0,0-1+0+1,0+0+0+0)/4 = (0,0,0).
(b) Normal is:

Normalise = (0,0,1)
(c) From the centre = (5,5,5)-(0,0,0) = (5,5,5).
Normalised = 
From D = (5,5,5)-(0,1,0) = (5,4,5)
Normalised =
(d) From the centre = (5,0,10)-(0,0,0) = (5, 0, 10).
Normalised = 
From D = (5,0,10)-(0,1,0) = (5,-1,10)
Normalised =
(e) Note, all RGB values are the same so we can just do it once for all three
From centre: (don’t forget, we have to use normalised N and L).

Hence colour is (0.33,0.33,0.33)
From D:

Hence colour is (0.35,0.35,0.35)
[i.e. there is very little difference between the two. The top point
is slightly brighter, but not by much.]
(f)
From centre:

From D:
(g)
From centre:

- really insignificant.
From D:

Hence it doesn’t make too much difference.
(h) Pretty much the same as the ambient and diffuse parts.
(i) This is a situation where it hardly makes any difference at all.
(j) To work this out, take the dot product of N and V. In this case, this is the same as the z value of V. IF it’s > 0, then it is NOT culled, if it is <= 0 it is culled. Answers: not culled, not culled, culled, tricky ... it's on the border, but it's so thin, so it wouldn't be rendered anyway so cull.
Question 3
a=(-1,1,1) b=(-4,2,1) c=(4,1,0)
normal to plane =
You can get the same answer by taking 
The equation of plane
so D = 7
(check that each point satisfies this equation.)
Direction to first light source is (roughly) (1,1,1) so

The - sign means that the light source is behind the triangle — we can ignore it because it will illuminate the other side of the triangle if we are not lighting up back sides of polygons.
However, if we are lighting up boths sides of a polygon, then we take the absolute value of the colour. Thus the colour from first light is 0.88x(0.9×1.0,0.2×0,0.5×0.2) = (0.79,0,0.08)
Direction to second light source is roughly (2,1,0) so

Similarly here. If we are only rendering one side of the polygon, then we would do nothing here. However, if we are lighting both sides of the polygon, then: Colour from second light is 0.38x(0.9×0.5,0.2×0.2,0.5×0) = (0.17,0.02,0)
Hence, the answer to part (b) is the sum of the two components: (0.96,0.02,0.08) (i.e almost pure red). However, since there are no light sources directly incident on it in part (a), then the polygon is black.
Question 4
For this question, we only worry about one value, since we’re only doing greyscale.
The Phong Illumination equation:

where

So, for, say, the left (-1,0,0) corner …

This means that the ray is reflected along the negative x axis!
So if we work out V.R now …
(0,0,1).(-1,0,0) = 0 !!
Why is this? This is because the light is reflected in a direction perpendicular to the direction to the viewer. Because V.R = 0, there is no specular component!
Hence the brightness of the top corner is:
I = 0.8×0.3×0.707 = 0.17
Further calculations will show that the other corners are exactly the same colour (I wonder why that would be
).
(b) As mentioned above, there is no specular component, because the light is reflected perpendicular to the viewer.
(c) In Gouraud shading, we interpolate the colours of the corners. In this case, however, since the three corners are the same intensity, then interpolation of the same intensity will lead to the whole triangle being the same intensity - 0.17. If they were different colours, we would have to interpolate linearly.
(d) In Phong shading, we interpolate the normals along a polygon. Since the point (0,0,0) is exactly midway along the bottom edge of the polygon, then we would be interpolating between the normals at (-1,0,0) and (1,0,0). Since (0,0,0) is exactly in the middle between these two points, the normal would be the average of the two, i.e.
![[(-1/\sqrt 2,0,1/\sqrt 2) + (1/\sqrt 2, 0, 1/\sqrt 2)]/2 = (0,0,1/\sqrt 2) [(-1/\sqrt 2,0,1/\sqrt 2) + (1/\sqrt 2, 0, 1/\sqrt 2)]/2 = (0,0,1/\sqrt 2)](/~cs3421/latexrender/pictures/be4b2333ffec68d1a73a518e2f0a6dd5.gif)
But now we have to normalise, since we need N to be normal …

Hold on … this means that the normal would be pointing straight at the viewer!! Hence we would expect maximum intensity at this point. Let’s see if the maths bears this out.
(e)

And now … substituting into the equation.

This is a lot brighter than what Gouraud shading would have led to. It is also more correct. Hence this is an example of the superiority of Phong shading over Gouraud shading.