what i`m trying to do, is to draw multiple ppa lights.
so far it works exactly like in the basic tutorial for ppa light from Ron Frazier, except the tex coords are generated in the texture matrix and not evaluated per vertex.
depthfunc is lequal.
first pass accumulates the lights with blend(1,1).
second pass draws the geomtry with blend(dst,0).
this works if you only have ONE room to draw.
and now the prob -> i
m drawing multiple rooms with multiple lights. so if you stand in room A and look at the wall which neighbors room B. the wall is not blended correctly. its half transparent! this is really anoying.
i`ve tried various blending modes, nothing works.
if i change the light blend mode then transparency is gone, but the lights are not more accumulated, thus overlapping each other.
any help,comment or solution is welcome.
If you want to accumulate lights, you have to fill the zbuffer/clear first. this can be done in two ways:
a first pass, with color set to the ambient color, and depthbuffer writes/tests eneabled.
or, when accumulating your lights, draw your first pass without blending.
You are correct to use the GL_ONE, GL_ONE blend for accumulating lights, but on the VERY FIRST LIGHT you need GL_ONE, GL_ZERO. This is the root of why stuff looks transparent. The first light which initially passes the depth test in the far room, get’s overwritten when drawing the near room, but when you draw the near room the destination color is not overwritten but blended.
After the first light, once you have the depth buffer filled all fragments will pass or fail the test appropriately and you can afford the GL_ONE, GL_ONE blend.
A first depth write pass would do this but you might as well use it for a light unless you intend to progress to stencil tests. If you cull to your light volumes then don’t cull for the first light. Just draw your first light source pass unculled with depthwrites and the usual depth test and a 1,0 blend.
P.S. sorry Adrian, I see that this is pretty much what you said :-).
[This message has been edited by dorbie (edited 06-09-2002).]