|
Notes for February 19 -- Phong shading
Note:
I am not going to assign any homework on Tuesday Feb 19, because
I think we need one more lecture before you are prepared
to implement ray tracing to a sphere.
The next homework assignment will be given this Thursday, Feb 21.
Meanwhile, make sure you read through the notes for
both ray tracing to a sphere and Phong shading
very carefully, and that you understand everything.
We will be building on these notes in what follows next.
The first really interesting model for surface reflection was developed by Bui-Tong Phong in 1973.
Before that, computer graphics surfaces were rendered using
the simpler model of Gouraud shading, which used
only diffuse lambert reflection, so it could not properly render shiny surfaces.
Phong's was the first model that accounted for specular highlights.
The Phong model begins by defining a reflection vector R, which is a reflection of the
direction to the light source L about the surface normal N.
As we showed in class, and as you can see from the diagram on the right,
it is given by:
R = 2 (N • L) N - L
|
|
|
Once R has been defined, then the Phong model
approximates the specular component of surface reflectance
as:
Srgb max(0, E • R)p )
where Srgb is the color of specular reflection, p is a specular power,
and E is the direction to the eye (in our case, E = -W, the
reverse of the ray direction).
The larger the specular power p, the "shinier" the surface will appear.
We can have more than one light.
To get the complete Phong reflectance, we sum over the lights in the scene:
Argb +
∑i
lightColori
(
Drgb max(0, N • Li) +
Srgb max(0, E • R) p
)
where
Argb,
Drgb and
Srgb
are the ambient, diffuse and specular color,
respectively, and p is the specular power.
|
|
|
At the end of the lecture we watched
WORLD BUILDER by Bruce Branit
|
| |