Hello,

I’m working on a bit of code that does an approximated deep shadow lookup using world-space distance information. I’ve got this all working fine for all other types of shadows, but am having trouble finding the right parameters to reconstruct this information for directionals.

As an example of what I’m looking for, assuming I have 2 planes next to each other in the shadow map, spaced 300 cm apart from one another. In the shadow map, their depth will look something like 0.32148 and 0.32950 (for example). I need the parameters necessary to take the delta (0.00802), and get back 300.

I’ve tried looking at the InvDeviceZToWorldZTransforms (which are supposed to work for perspective and orthographic projections), as well as using the DepthBias and InvMaxSubjectDepth information, but neither really give me what I’m expecting. Similarly, I had a look at most of the matrices available in the FProjectedShadowInfo data set, but can’t seem to find anything that would fit the bill.

Does anyone know what the proper way of calculating a world-space distance from the directional cascade map is?

Any advice is greatly appreciated.

Thanks,

J