Question about RGBA
Hi all... I''m doing my own lighting, like this:
char light=255;
long reallight=0xFF000000/(light<<16)/(light<<8)/light;
Works nicely. But now I want to add specular light, which
I do in the same way... it works fine too. Except when the light value of the vertex I''m lighting gets darker. Then the specular light starts to ''shine,'' because my light is 0 but my specular light is nonzero.
I fixed this by making a lookup table for my specular light-- it''s 256x256 entries! One for each specular light, and one for each light value. Funny thing is, it doesn''t seem to slow down the program, but the old cycle-counter in me KNOWS it is. So I want a better solution!
I thought I could modify the high byte of the specular light component (alpha value) to dim the specular automatically, like this:
speclight=(light<<24)/(redligh<<16)/(greenlight<<8)/(bluelight);
But... it doesn''t seem to work that way. Damn, because that would have been very easy. Problem is, I don''t know if it doesn''t work just because alpha doesn''t work that way, or if I have some alpha settings turned off.
So, what''s the verdict? If I set an alpha value, is it supposed to ''dim'' the rest of it? If not, what''s it there for?
Yours in expectant anticipation,
Goodlife
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement