Find if pixel is in shadow

Hi there,

I’m trying to control the look of my shadows (different shadow colors for different materials for example) and I’m struggling to access the shadow map.

I was using the following process (forward shading + LightAttenuationTexture) in 4.18 :

But since 4.19 the LightAttenuationTexture appears to be black and no longer contains shadows from the engine. Is there a way to achieve the same effect with recent version of the engine ? Looking through the .ush files I’ve found the following function :

float ShadowDepth = Texture2DSampleLevel(ForwardLightData.DirectionalLightShadowmapAtlas, ForwardLightData.ShadowmapSampler, ShadowUVs, 0).x;

But trying to access it from a custom node in the material editor crash the engine.
Maybe there is a way with SceneCapture to generate my own shadow map but I don’t know if that’s possible to compute it for a point light ?

Any help appreciated !

edit : found this related issue : Unreal Engine Issues and Bug Tracker (UE-61513)

Three year is a long period and I also wonder if there is a solution in the recent version engine.

Just a note from 2024: UE5.3 is still crashing if trying access ForwardLightData from a Custom material node.