View Full Version : Perpixel lighting and transparent surfaces
LaBasX2
03-22-2002, 01:10 PM
Hi!
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
LaBasX2
LaBasX2
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:
http://www.bigpanda.com/trinity/article2.html
LaBasX2
davepermen
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..
LaBasX2
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.
LaBasX2
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 )
sexyNOTTHISbastard@xtra.co.nz
LaBasX2
03-24-2002, 03:39 AM
@zed:
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
LaBasX2
richardve
03-24-2002, 04:09 AM
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).]
LaBasX2
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
Thanks richardve!!
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.