forward rendering and multiple shadow maps
- by Irbis
I have two light sources on my scene. I created two fbo's which store depth textures for these lights. A render loop looks like this:
bind fbo1
save depth values for first light
unbind fbo1
bind fbo2
save depth values for second light
unbind fbo2
enable additive blending
bind first depth texture
render scene
bind second depth texture
render scene
disable additive blending
For one light source the program works fine. For many light sources I use an additive blending to acumulate lighting results but then some objects become transparent (for example when an object which is further away from the camera is drawn before an object which is closer to the camera). How to resolve that problem ? How should I accumulate lighting effects for many light sources (many shadow maps) ? P.S. I use OpenGL/GLSL 3.3+