View Full Version : problem with multiple lights

09-18-2003, 06:28 AM
Hello! I have implemented a lighting pass and a shadow pass(shadow maps)...and i can combine them fine (using DST_COLOR,ZERO) but ive been tinkering and I cant seem to get them to combine in a way that would allow multiple lights! Ive tried using a combination of the alpha buffer and stencil buffer but i cant get the settings right. Any suggestions?

(btw....the lighting pass has no room left in it, hence the multi pass method).

Tom Nuydens
09-18-2003, 06:56 AM
For each light source:
- Disable RGB writes; render shadowing to destination alpha without blending.
- Enable RGB writes; render lighting with (GL_DST_ALPHA, GL_ONE) blending.

Also, for everything except the very first pass (the shadow pass of the first light, or possibly an ambient pass), use a GL_EQUAL depthfunc.

-- Tom

09-18-2003, 07:24 AM
dude, i love u!!
...hehe. I think I should sleep more, then I wont have to ask such stupid questions at this time of night...cheers!