Shadow Map, higher resolution near the camera

I’ve seen tutorials on cascaded shadow maps where you have to render the scene multiple times. Is it possible to render into multiple shadow maps with 1 render pass, by using multiple View and/or projection matrices? Or only use 1 shadow map but tweak the projection matrix somehow so the closer to the camera the higher the shadow resolution?

You could bind the texture as a layered framebuffer, and use the geometry shader to emit each primitive to the correct layer(s). But each primitive may have to be emitted for multiple layers: for each frustum a primitive intersects, it needs to be rendered into the corresponding shadow map.

All things considered, it may be faster to simply render the scene multiple times. Particularly if you have good broad-phase culling so that you can easily limit rendering to the geometry which actually intersects a particular frustum.

[QUOTE=GClements;1285587]You could bind the texture as a layered framebuffer, and use the geometry shader to emit each primitive to the correct layer(s). But each primitive may have to be emitted for multiple layers: for each frustum a primitive intersects, it needs to be rendered into the corresponding shadow map.

All things considered, it may be faster to simply render the scene multiple times. Particularly if you have good broad-phase culling so that you can easily limit rendering to the geometry which actually intersects a particular frustum.[/QUOTE]

Thank you! I didn’t know the geometry shader can do that. Anyway, I will just render it multiple times then. The culling is now nonexistent but will be implemented.