So I’m having a problem that I’m not sure how to get around. Basically, I’m trying to implement dynamic lighting (using the projected texture approach). The problem comes when I start applying extra passes from the (Quake3-style) shaders on top of this. Because the shader layers use a blendfunc of GL_SRC_ALPHA/GL_ONE_MINUS_SRC_ALPHA, they lose the color from the base/lighting pass. Of course, if I use the same blendfunc as regular surfaces (GL_DST_COLOR/GL_ZERO), then it just looks wrong.
The lighting itself looks quite nice, though (I took the algorithm from an old Nate Miller tutorial): http://timmie.squabble.org/screenshots/lights/boris_1.jpg
I don’t suppose there’s a simple way around this, is there?
Oh, so the passes look like this:
- base color pass (GL_ONE/GL_ZERO)
- pass per light to add light to base color (GL_SRC_ALPHA/GL_ONE)
- texture modulation pass (regular surfaces and first shader layer) (GL_DST_COLOR/GL_ZERO)
- n layers (configurable blend func)