Specular Reflection in Phong Lighting Model

Specular Reflection in Phong Lighting Model

When implemting the Phong Light Equation

I = (Ka * Ia) +( Kd * I * NdotL) + (Ks * I * (VdotR)^n),

the specular coefficient Ks is usually not the same as the diffuse
coefficient Kd. The assumption is often made that specular highlights
are determined by the color of the light source, not the material, e.g.
for white light, Ksr=Ksg=Ksb=1.0 (this is true of plastic).

By making this assumption, however, lowering the sharpness value (n) to
mimic a dull surface such as cardboard has the effect of broadening the
range of specular visibility (which is good) but the specular highlight
is too bright (with white light).

The fact is, specular highlights are determined by both the light and
the material. Thus what appears to be needed is an array of specular
coefficients, which vary with the light intensity, for various surfaces.

Do such arrays exists anywhere?

Gord

Merry xmas and happy new year to all :)

I'm doing Phong interpolating the X/Y/Z normals. Ok, thats normal :)
And  for each pixel I'm doing:

len = cx*cx+cy*cy+cz*cz; len = sqrt(ilen);
out = (cx*Light.outnml.x + cy*Light.outnml.y + cz*Light.outnml.z) / len;

out = 0+out*256; //where it starts, colors of the ramp;
if (out < 0)   out = 0;    else
if (out > 255) out = 255;

putpixel (x, y, out);

from where the cx, cy, cz are the interpolated normals, Light.outnml is
the normal of the light source that has been precalced, and out is the
color value of the pixel to plot.

Now my question is how can I control the specular light/intensity? I tried
to play with the out variable, but didnt get me anywhere.

And if anyone knows how to speed up this leaving out the "standard" optimizes
like unrolling, fixfloat & integer square, I'd like to know (but this is
secondary:)

Any help is greatly greatly appreciated                       MARAUDER *Synergy
...............................................................................
There only can be one, and I'll be him   <!Anonymous>  Eat my steel!
Uhh, wouldn't be that a bit boring?  <Ragnar H0jland>  Mmm.. Tasty. More please