Specular mapping

//draw stuff

glBlendFunc(sfSrcAlpha, dfSrcColor); //blending used to achieve the specular effect

//copy colors from SpecularColor to tmpColor w/ modifications (only use this if not using specular maps! may be done per-vertex, but be sure to do all of this too)
tmpColor[0] = 1 - ((1 - SpecularColor[0]) * SpecularColor[3]);
tmpColor[1] = 1 - ((1 - SpecularColor[1]) * SpecularColor[3]);
tmpColor[2] = 1 - ((1 - SpecularColor[2]) * SpecularColor[3]);
tmpColor[3] = SpecularColor[3];
//load er’ up!

//draw stuff again, but use specular maps instead of tmaps

Just something I decided to do. I did this out of my IDE, so I don’t know if I can get away with doing it w/o array indices, and thusly did it with them instead. This really works though, and you could texture the specular polygon with a colored specular map if you’d like. But when you load the texture, make sure you tweak the colors according to the alpha or it’ll act like a specular map AND a light map.

If you know of a better way to do this, tell me.

And because I’m relatively new to this, how do you get the angle from the viewer to the light when bounced off of a surface? I think I have something of an idea, but I need angle-proportionate sin and cosine functions to do it :stuck_out_tongue: