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

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

I created a PG: Babylon.js Playground
please uncomment the line 25 to use the built-int material which will show shadow properly.

and the node material being used:
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…


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:

1 Like

oh… right, sorry a big mistake… :frowning:

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.

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

1 Like