View Full Version : Alpha Test w/Lighting Problem

08-12-2003, 07:42 PM
I'm having problems with the Alpha Test when I enable Lighting.
I load a bitmap and add an alpha channel, setting any black pixel to an alpha value of 0, and anything else to 255. I then call glAlphaFunc(GL_GREATER, 0) and everything that is black is not drawn. But when I enable lighting, I can't see anything when it starts rendering.

Does OpenGL lighting have some affect on the pixel alpha value before it is tested with the AlphaFunc? Is there a way to ignore alpha fragments with alpha 0, and THEN do lighting?

08-12-2003, 08:27 PM
Do you see anything rendered if you simply do not turn Alpha test on? ie. Are you sure Alpha test is the problem and not your lighting setup?

08-12-2003, 10:35 PM
it must be lighting setup problem. if your diffuse material color has alpha==0.0 and the ambient parameter of each light have alpha==0.0, then the computed color for the vertex will have alpha==0.0

08-13-2003, 03:41 AM
Yep, it was the fact that I wasn't even passing an alpha value for the diffuse and ambient material properties of the object. I just added in a 1 for the alphas for materials and 1 for the light diffuse and ambient and I see everything just fine. Thanks a lot.