Custom Cube Shadow Map

I want to create a Cube Shadow Map from a Top Down Viewed Character location, so I can occlude the things that the character can’t see like enemies and rooms.
The attached image shows the character in red and wall in blue. The white area is the character vision.
But the Scene Cube Capture won’t allow me to get the Depth Buffer.

Any solution?

I once hacked around this by using a material function on all my world materials that had a Lerp to set the basecolor, spec and emissive to 0 and then add in scene depth into the scene via emissive. If you use a material parameter collection, you can specify the cube capture location there in order to compute the depth.

I like the idea.
I think that the ideal solution would be messing around with the shaders and source files and make the shadow ‘clip’ the hidden areas for performance purposes, but that’s beyond my capabilities.
I going to test your idea.
Thank you.