# Odd ShadowMap rendering

**URL:** <https://forum.babylonjs.com/t/odd-shadowmap-rendering/706>\
**Category:** Questions\
**Created:** [January 12, 2019, 7:49am UTC](https://forum.babylonjs.com/t/odd-shadowmap-rendering/706 "2019-01-12T07:49:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fregate](https://avatars.discourse-cdn.com/v4/letter/f/97f17d/32.png) [@fregate](https://forum.babylonjs.com/u/fregate)\
**Post date:** [January 12, 2019, 7:49am UTC](https://forum.babylonjs.com/t/odd-shadowmap-rendering/706/1 "2019-01-12T07:49:18Z")

</div>

[https://www.babylonjs-playground.com/#46MRHC#3](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?

---

<div class="post-metadata">

**Author:** ![Wingnut](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wingnut/32/53_2.png) [@Wingnut](https://forum.babylonjs.com/u/Wingnut)\
**Post date:** [January 12, 2019, 9:04am UTC](https://forum.babylonjs.com/t/odd-shadowmap-rendering/706/2 "2019-01-12T09:04:45Z")

</div>

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](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!

---

<div class="post-metadata">

**Author:** ![fregate](https://avatars.discourse-cdn.com/v4/letter/f/97f17d/32.png) [@fregate](https://forum.babylonjs.com/u/fregate)\
**Post date:** [January 12, 2019, 11:41am UTC](https://forum.babylonjs.com/t/odd-shadowmap-rendering/706/3 "2019-01-12T11:41:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wingnut](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/wingnut/32/53_2.png) [@Wingnut](https://forum.babylonjs.com/u/Wingnut)\
**Post date:** [January 12, 2019, 2:14pm UTC](https://forum.babylonjs.com/t/odd-shadowmap-rendering/706/4 "2019-01-12T14:14:04Z")

</div>

> [@fregate](#):
>
> For me it is not obvious, that direction light has position.

[https://doc.babylonjs.com/babylon101/shadows#directional-lights](https://doc.babylonjs.com/babylon101/shadows#directional-lights)

[https://doc.babylonjs.com/api/classes/babylon.directionallight#position](https://doc.babylonjs.com/api/classes/babylon.directionallight#position)

Perhaps not obvious, but discoverable. 🙂

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

Be well.

---

<div class="post-metadata">

**Author:** ![fregate](https://avatars.discourse-cdn.com/v4/letter/f/97f17d/32.png) [@fregate](https://forum.babylonjs.com/u/fregate)\
**Post date:** [January 13, 2019, 4:25am UTC](https://forum.babylonjs.com/t/odd-shadowmap-rendering/706/5 "2019-01-13T04:25:11Z")

</div>

> [@Wingnut](#):
>
> Perhaps not obvious, but discoverable

I mentioned it about 3D graphics in general 😄

> [@Wingnut](#):
>
> Are you planning/working-on a project/game? Can you tell us a little about it? (if not secret) thx.

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)
