PDA

View Full Version : Shadow Map, higher resolution near the camera



AdyAdy
01-19-2017, 02:17 AM
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?

GClements
01-20-2017, 11:43 AM
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.

AdyAdy
01-21-2017, 05:41 PM
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.

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.