How does the render select meshes for shadow depth pass cascades?

Hey, I’m currently having problems getting shadows cast from a custom mesh whose mesh buffers I dynamically fill with compute shaders.
What’s confusing me is that the mesh renders correctly in the base & depth pass and receives shadows correctly, it just doesn’t cast them and therefore is not properly rendered in the light’s depth passes.

So my question is: How is the selection of meshes to be included in the depth pass different when rendering the light/shadow passes compared to the base pass?
I would have suspected that the only difference is that (obviously) the mesh has to be enabled to cast shadows but I checked that GetViewRelevance() on my proxy does so and still get no shadows…

Where I’m currently at:
I have an empty test scene with nothing but a single moveable directional light, a movable cube and my GPU-Mesh (with dynamic relevance).
I’m now trying to debug step through the shadow rendering code and looked into the Deferred Renderer’s call to RenderShadowDepthMaps() in the early shadow depth rendering (before the base pass) which calls RenderShadowDepthMapAtlases() and from there RenderDepth() on the projected shadow info for each Parallel Shadow Pass.
With my single light source I’m getting 3 of those shadow passes which I suspect account for the different cascaded shadow maps generated by the light as the passes differ mainly in the cascade settings.
I found that when the draw gets dispatched from there on, my mesh actually is NOT included in the TaskContext’s “MeshDrawCommands” as I expected and therefore not casting any shadow.
Well, that is for cascade 0 and 1…
For cascade 2 it actually is included which really confuses me because the cube and my mesh basically intersect and are right in front of the camera which means my mesh should also qualify to be included in the closer cascades…
I also checked that my meshes bounds are reasonable so that should not influence the weird selection.

I’m not sure how many people on this forum have a good understanding of this part of the engine but I’d very much appreciate any input on what could be the reason for the problem or generally on how mesh selection for the shadow passes works beyond the “Cast Shadow” checkmark (if there actually is more)…

Lol my bad, that was probably the most annoyingly simple fix I ever had, for a problem that cost me that much time.
So… If anyone has a similar problem, make sure that you check the result of GetViewRelevance() really closely. If your mesh is neither Opaque nor Masked it obviously does not cast a shadow and I missed that “MaterialRelevance.SetPrimitiveViewRelevance(Result)” sets those values (I marked my mesh as opaque above that and then it got overriden… So yeah everything’s functioning as it should now.

Hint: If anyone tries to debug missing shadows and the above does not solve it - stepping through “FProjectedShadowInfo::AddSubjectPrimitive_AnyThread(…)” in ShadowSetup.cpp can be really useful to ensure that you actually return a non-zero value there. If not, you’ve (likely) found the problem