View Full Version : Perpixel lighting and transparent surfaces
03-22-2002, 01:10 PM
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
03-22-2002, 03:59 PM
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:
03-23-2002, 01:43 AM
all you need to know in gl is the math.. nothing else http://www.opengl.org/discussion_boards/ubb/wink.gif
btw, it gets difficult to do transparency if you have multiple passes for the perpixellighting..
03-23-2002, 02:08 AM
Yes, the sweet old math http://www.opengl.org/discussion_boards/ubb/wink.gif
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 http://www.opengl.org/discussion_boards/ubb/smile.gif )
mail me if u want it (i cant upload to geosities http://www.opengl.org/discussion_boards/ubb/frown.gif )
03-24-2002, 03:39 AM
Thanks for your offer! I've tried to write you a mail but the adress "sexyNOTTHISbastard@xtra.co.nz" doesn't seem to be right http://www.opengl.org/discussion_boards/ubb/frown.gif
03-24-2002, 04:09 AM
LaBasX2, you should read better: it says NOT THIS, which means you should remove the capital letters.
[This message has been edited by richardve (edited 03-24-2002).]
03-24-2002, 08:01 AM
Oh, now where you tell me....I was already wondering about that strange adress http://www.opengl.org/discussion_boards/ubb/wink.gif
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.