# Find if pixel is in shadow

**URL:** <https://forums.unrealengine.com/t/find-if-pixel-is-in-shadow/439655>\
**Category:** Rendering\
**Tags:** shadow, Shadows, unreal-engine, question\
**Created:** [December 17, 2018, 3:57pm UTC](https://forums.unrealengine.com/t/find-if-pixel-is-in-shadow/439655 "2018-12-17T15:57:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trex\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Trex\_1](https://forums.unrealengine.com/u/Trex_1)\
**Post date:** [December 17, 2018, 3:57pm UTC](https://forums.unrealengine.com/t/find-if-pixel-is-in-shadow/439655/1 "2018-12-17T15:57:38Z")

</div>

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 :

> **[Textured Shadows Trick in Unreal Engine](https://www.tomlooman.com/unreal-engine-textured-shadow/)**
>
> This weekend I stumbled upon a reddit post about Dr. Facilier’s interesting shadow in The Princess and the Frog and it inspired me to experiment with Forward shading in Unreal Engine 4 to re-create a...

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)](https://issues.unrealengine.com/issue/UE-61513)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_5870dbc61](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5870dbc61](https://forums.unrealengine.com/u/anonymous_user_5870dbc61)\
**Post date:** [July 20, 2020, 11:42am UTC](https://forums.unrealengine.com/t/find-if-pixel-is-in-shadow/439655/2 "2020-07-20T11:42:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![NorlinGames](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/norlingames/32/495614_2.png) [@NorlinGames](https://forums.unrealengine.com/u/NorlinGames)\
**Post date:** [April 18, 2024, 4:39pm UTC](https://forums.unrealengine.com/t/find-if-pixel-is-in-shadow/439655/3 "2024-04-18T16:39:32Z")

</div>

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