I thought that we could re-use the same shadowmap for every light. But I've seen an industry article suggesting that you can't re-use shadowmaps between lights, and have to use separate surfaces.

Do we need one shadowmap per light? Or one for the whole process?

  • \$\begingroup\$ Perhaps. It depends which effect you want to achieve. \$\endgroup\$ Commented Mar 22, 2012 at 23:57

1 Answer 1


By "re-use the same shadowmap" I assume you mean re-use the memory (the render target). Obviously you can't re-use the data since each light has a different view of the world. :)

Anyway, yes, you can re-use the render target if you want. There are a couple of caveats. First, obviously you must design your renderer so that it only needs one shadow map at a time, which can be inconvenient or can require some changes in your pipeline. For instance, if you want to use cascaded shadow mapping for your sun light you may need a screen-space buffer to hold the shadow results, so you can accumulate multiple slices without needing to redraw your scene for each slice.

The other caveat is that you may see reduced performance, because many newer GPUs can work on multiple draw calls in parallel (even to different render targets), but this breaks if one draw call needs the result of a previous one. So if you had several shadow map render targets, the GPU might be able to parallelize (to some extent) the draw calls to draw all the shadow maps, then separately parallelize the draw calls that read the shadow maps and draw the lights. But if you have only one render target, you must serially draw shadow map A, draw light A, draw shadow map B, draw light B, etc. On high-end GPUs these operations may not saturate the GPU individually, so some cores will be left idle.

Given this, for best performance you should probably have at least two shadow map render targets and cycle through them, but it's still not obligatory to have separate render targets for each individual light. Another way is to try to provide the GPU with some other work it can use to fill the gaps---drawing particles into a separate render target, perhaps. (And as with all performance concerns, YMMV, so profile it!)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .