Ambient, Diffuse, Specular

Published December 30, 2005
Advertisement
I guess to be complete I should start out with a basic ambient diffuse and specular effect. It's not the most exciting, but there is still value in going back over older material to see if you gain any new insights into the various techniques. So here we go...

The effect that I am implementing will be interacting with a single point light set at (500, 500, -500) (right, up, back). The application sets the light color and camera position, while each object sets it own properties including:

1) Ka : ambient coefficient
2) Kd : diffuse coefficient
3) Ks : specular coefficient
4) Material color
5) Specular power

Here are the results from a little experimentation:



I decided to use the Blinn half-angle version of the specular term out of personal preference. The diffuse component will cancel out the specular component if it is less than zero (in other words the face is facing away from the light source). Other than that, it is a pretty standard Blinn-Phong lighting model.

There is one thing that I want to mention about using this Blinn-Phong lighting equation though. When adjusting the object's lighting parameters mentioned above, it is rather easy to allow saturation of the lighting due to the specular term.

This happens when the material color is relatively bright to begin with, then the specular highlights can make large splotches of the object to appear completely white and actually removing detail instead of adding it. So, I try to keep all of the coefficients set to manageable values - typically they should not add to more than 1, but for different effects and the expected number of lights affecting each object this can be changed higher or lower.
0 likes 2 comments

Comments

TANSTAAFL
mmmmm.... green chocolate rabbit.....
December 31, 2005 09:44 AM
Jason Z
[grin]
December 31, 2005 10:27 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement