A long time ago I made an application that used volumetric rendering and I developed some shadowing equations that I felt very happy with, since they have pretty good results.
For these equations to work one needs the object that occludes the light that is closest to the currently-being-shaded fragment (rather than the one closest to the light source)
However, with shadow maps, you invariably get the first point that occludes the light, even if there are points behind it that also occlude the light.
I had originally intended to use volumetric rendering over shadow maps and use clever hashing for optimization.
But 800 triangles consume 90% of a GTX 1070's cpus power. In other words, just 800 triangle checks per fragment are enough to lag the entire pipeline.
I wanted to know if there is a way to get the distance to the closest point occluding the light (from the fragment perspective) using shadow maps. Or if I have to give away with my pretty shadows
Edit:
When I refer to distance I am speaking about distance from the occluded point to the light. So if A is a surface and R is the ray from that surface to the light, then the "closest" point is a point right on A and the "farthest" point is a point right on the light.
Edit:
As per request, a poorly drawn diagram of what I mean. There are 2 walls occluding the light and one is closer to the shadow point than the other