I’m working on GPU driven rendering for a project and am currently in the process of refining shadow casting. My compute shaders right now cull all instances in the scene which are neither visible in the camera frustum nor can be projected along the directional light onto the bounding box derived from those frustum visible instances. This works fine, but now I want to further cull instances for specific shadow cascades, as there is no need for distant instances to render to cascades near the camera.
I’m hoping for there being some function or parameter that I’m missing where I can target specific cascades for shadow map rendering, so that ideally I’d have four RenderMeshIndirect (or similar) calls, one for each cascade with its own command buffer range.
If this is not possible, what’s the next best way to do this? I’m thinking probably finding the shadow map unity uses, setting it as render texture for a new orthographic camera (if that’s even possible) with the same transform, size and viewport rect settings for a specific cascade as unity and doing four rounds of RenderMeshIndirect this way?
Or could it be done with a custom SRP / by extending URP?
Would greatly appreciate some insight.