Original Post
Hi, I was thinking about how to render more than one shadow map but still leaving at least 3 texture units free and I came up with the following idea: -Render up to 4 shadow maps as usual. -Render the scene in a frame buffer object with a specific shader. The shader will use the 4 shadow maps to compute, foe each pixel, how much that pixel is shadowed. This is the same thing you would usually do, but instead than using the computed values to calculate the lighting equation, I encode those values as RGBA (R = first map, G = second map and so on) and write the resulting vector in the frame buffer object. -Render the scene again binding only the just rendered buffer as texture (so the other 3 are free for other uses). The values from the texture are read by the shader that uses those values to compute the actual lighting equation. This method would let the second pass to use coloured lights and still be able to use 4 shadow maps + 3 textures for other pourpose. My question is: is this method already used? Someone can spot backdraws and weak points, if there are? I already implemented this, and it works. Someone can point me to some references that cover this method, in order to improve them (i.e. using the first pass for early z culling and so on). Thank you!