Odd ShadowMap rendering

https://www.babylonjs-playground.com/#46MRHC#3

Trying to instantiate some number of meshes (parenting by one mesh) and create shadows from its on the ground.
But it looks odd. Not all meshes cast shadows and it looks like shadow map texture starts form starting position of the parent mesh.
If parent is moving, child meshes starts cast shadows only when it move into some texture I think.

Changing of shadow map size not fix this.

What I did wrong? What I have to read to understand?

Hello F!

For shadows, directional light position and direction are VERY important. The light temporarily “acts” like a camera - to create the shadowMap.

https://www.babylonjs-playground.com/#46MRHC#6

I adjusted many little things, but most important… I added lines 24 and 25.

I hope this helps. Ask questions about this, if you wish. Party on!

Thank you. It works.
For me it is not obvious, that direction light has position. I thought only direction matter.

1 Like

https://doc.babylonjs.com/babylon101/shadows#directional-lights

https://doc.babylonjs.com/api/classes/babylon.directionallight#position

Perhaps not obvious, but discoverable. :slight_smile:

Are you planning/working-on a project/game? Can you tell us a little about it? (if not secret) thx.

Be well.

I mentioned it about 3D graphics in general :smile:

Yes, It is small project just to check babylon up. I’m sometimes write simple games for my friends and check new things for me like technologies, languages, frameworks etc. So previous was in phaser, this one in babylon (because of 3D)

2 Likes