What is the proper way to position a directional light?

Hi all:

Originally I was confused as to why my shadows weren’t showing up until I took my local code and turned it into a playground example… I realized that my shadows weren’t showing due to the positioning of my directional light.

I would think that raising the Y val would make the directional light go upwards. But my shadows don’t appear on the street mesh unless I put a negative Y value for the directional light:

dLight = new BABYLON.DirectionalLight(
    new BABYLON.Vector3(0, -20, 0),  // why do I need a negative Y value here???

I have the playground here: https://playground.babylonjs.com/#YNEAUL#4299

Is there something that I am missing or doing incorrectly?

Thanks for taking the time to look and help!!

2nd parameter is not the position but the direction vector.

<0 for Y means light is directed to the ground.


got it thanks!

1 Like

Tip: this function can visualize the shadow calculation area. It helps to get the correct shadow. Create a shadow just get a circle - #2 by Evgeni_Popov