# How to use the shadow value provided by the light node in NME?

**URL:** <https://forum.babylonjs.com/t/how-to-use-the-shadow-value-provided-by-the-light-node-in-nme/12811>\
**Category:** Questions\
**Tags:** lighting, material\
**Created:** [July 24, 2020, 10:38am UTC](https://forum.babylonjs.com/t/how-to-use-the-shadow-value-provided-by-the-light-node-in-nme/12811 "2020-07-24T10:38:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![J.C](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/j.c/32/6574_2.png) [@J.C](https://forum.babylonjs.com/u/J.C)\
**Post date:** [July 24, 2020, 10:38am UTC](https://forum.babylonjs.com/t/how-to-use-the-shadow-value-provided-by-the-light-node-in-nme/12811/1 "2020-07-24T10:38:47Z")

</div>

Hi, can anyone tell me how to handle shadow in NME?

I created a PG: [Babylon.js Playground](https://playground.babylonjs.com/#8KWW79)  
please uncomment the line 25 to use the built-int material which will show shadow properly.

and the node material being used: [https://nme.babylonjs.com/#57K0R9#1](https://nme.babylonjs.com/#57K0R9#1)  
I scale the diffuse color using the shadow value provided by the light node directly, but not sure if it’s the correct usage or not. anyway it seems this usage is wrong because there is no shadow on the ground plane…

thanks.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [July 24, 2020, 10:58am UTC](https://forum.babylonjs.com/t/how-to-use-the-shadow-value-provided-by-the-light-node-in-nme/12811/2 "2020-07-24T10:58:08Z")

</div>

You don’t need to use the `shadow` output of the lights block: it is already factored into the diffuse and specular outputs. The `shadow` output can be used for special effects when you need to know the shadow value itself.

You made a mistake in your shader: you need to wire the world position to the `worldPosition` input of the Lights block, not the projected world position:

[https://nme.babylonjs.com/#57K0R9#3](https://nme.babylonjs.com/#57K0R9#3)  
[https://playground.babylonjs.com/#8KWW79#1](https://playground.babylonjs.com/#8KWW79#1)

---

<div class="post-metadata">

**Author:** ![J.C](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/j.c/32/6574_2.png) [@J.C](https://forum.babylonjs.com/u/J.C)\
**Post date:** [July 24, 2020, 12:27pm UTC](https://forum.babylonjs.com/t/how-to-use-the-shadow-value-provided-by-the-light-node-in-nme/12811/3 "2020-07-24T12:27:47Z")

</div>

oh… right, sorry a big mistake… ☹

but still curious what the shadow value is. is it the final occlusion value fetched from the shadowMap or something else? could you please help to elaborate? thank you.

---

<div class="post-metadata">

**Author:** ![J.C](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/j.c/32/6574_2.png) [@J.C](https://forum.babylonjs.com/u/J.C)\
**Post date:** [July 24, 2020, 12:58pm UTC](https://forum.babylonjs.com/t/how-to-use-the-shadow-value-provided-by-the-light-node-in-nme/12811/4 "2020-07-24T12:58:51Z")

</div>

I tested and found it’s actually the occlusion value! so cool!!  
thanks so much! @Evgeni_Popov

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/f/fc932be748d8e2892c899fe3ccd9a9dead864770.png)
