Perpixel lighting and transparent surfaces


Is it possible to use perpixel lighting in combination with transparent surfaces? And if yes, how can I do that?

I’m storing the attenuation and (N dot L) result in the alpha buffer. Then I’m multiplying the diffuse texture map with the alpha buffer using this blend equation: glBlendFunc(GL_DST_ALPHA, GL_ONE); but all the surfaces are solid now.

The normal blend equation for transparent surfaces is (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) but I can’t use that equation because it doesn’t include the perpixel lighting results from the alpha buffer.

Thanks in advance

Ok, it is possible…using glBlendFunc(GL_DST_ALPHA, GL_SRC_ALPHA) for example…

Once you understand how the OpenGL blending equation is working, it isn’t that hard any more. For everyone else who has problems with the equation, here is the great tutorial that helped me:


all you need to know in gl is the math… nothing else

btw, it gets difficult to do transparency if you have multiple passes for the perpixellighting…

Yes, the sweet old math

You’re right, transparency with several passes could really become a problem. My idea is to draw already the ambient pass of transparent faces with blending enabled and to add the lighting results using (GL_DST_ALPHA, GL_SRC_ALPHA). I haven’t tested it yet; might be that won’t work at all but it is the only way I can figure out at the moment.


i have an app that explains this well
( u even get to play with sliders + such )
mail me if u want it (i cant upload to geosities )

Thanks for your offer! I’ve tried to write you a mail but the adress “” doesn’t seem to be right


LaBasX2, you should read better: it says NOT THIS, which means you should remove the capital letters.

(antispam thingie)

[This message has been edited by richardve (edited 03-24-2002).]

Oh, now where you tell me…I was already wondering about that strange adress

Thanks richardve!!