Shader access shadow depth map for each light source

@bgolus Hi !
Is it possible inside builtin render pipeline shader code to access shadow maps for each light source, without using additional scripts ?

Intended target is to read shadow map from each light source, pairing the two should provide information on making shadows in volume (ie not just surface) of a transparent queue shader. And its using raymarching to boot.

I have constructed a transparent queue shader from various bits of code i found from unity forum and github, even managed to add shadow receiving (thanks to code examples by user negativeinfinity). As it works now, all i can do is determine if pixel is shadowed or not, there is no information on how many different shadows are covering it.

If it sounds like a (yet another) attempt at making some kind of volumetric shader, then you’re right. :slight_smile:

I know this shader pipeline is quite old, but i like working within its confines.

I wouldn’t bother you, but i’m out of ideas.

Cheers !

The short answer: No.

Longer answer is to get access to the shadow maps from multiple lights, the only reliable way to get the shadow maps for each light is to attach a command buffer to them that runs while the shadow map is the current render target. There’s no other option. Which is why all volumetric lighting / fog systems I’m aware of do that or render their own.

2 Likes

Thank you for the concise answer !