# Point light not fully shadowing the mesh

**URL:** <https://forum.babylonjs.com/t/point-light-not-fully-shadowing-the-mesh/35286>\
**Category:** Questions\
**Tags:** shadows, shadowgenerator, pointlight\
**Created:** [October 31, 2022, 3:06pm UTC](https://forum.babylonjs.com/t/point-light-not-fully-shadowing-the-mesh/35286 "2022-10-31T15:06:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Panuchka](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/panuchka/32/12054_2.png) [@Panuchka](https://forum.babylonjs.com/u/Panuchka)\
**Post date:** [October 31, 2022, 3:06pm UTC](https://forum.babylonjs.com/t/point-light-not-fully-shadowing-the-mesh/35286/1 "2022-10-31T15:06:46Z")

</div>

Hi everyone!

A silly shadowing question that I look some insight into. I have a point light set up to my game main character, so I can get cool looking shadows from the corners and when I peek into rooms that are dark! Spooky…

Anyways. Here is a literal “corner case” I have:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/5/95fda8f9765d7a535f7c09abffe9f50d32ad8a4c.jpeg)

As you can see, I’m missing a part of the shadow! The corner model has a baseboard (dark part) that is pretty much not shadowed at all. I think this is just some configuration issue on my part, but I can’t quite grasp on what is going on. More to that, the inspector doesn’t have all the shadow hinges for me to pull around to see where the problem might be 🤔

I kind of feel like that css debug gif with the shadows right now:  
 ![giphy](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/2/72968efd61fab2ecb3996d4622c4deff3e4fb072.gif)

Here is my point light setup (parented to the character of course):

```auto
  const frontSpotLight = new SpotLight(
    'playerLight',
    new Vector3(0, 1.1, 0.1),
    new Vector3(0, 0, 1),
    180,
    1,
    scene
  )
  frontSpotLight.radius = 30
  frontSpotLight.falloffType = PointLight.FALLOFF_GLTF
  frontSpotLight.diffuse = new Color3(1, 1, 1)
  frontSpotLight.intensity = 3
  frontSpotLight.range = 10

```

Shadow generator:

```auto
  const frontGenerator = new ShadowGenerator(1024, frontSpotLight)
  frontGenerator.filteringQuality = ShadowGenerator.QUALITY_LOW
  frontGenerator.darkness = 0

```

---

<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:** [October 31, 2022, 3:22pm UTC](https://forum.babylonjs.com/t/point-light-not-fully-shadowing-the-mesh/35286/2 "2022-10-31T15:22:03Z")

</div>

It’s hard to tell without a repro…

Anyway, the angle parameter to the **SpotLight** constructor is in radians, not degrees. Also, 180 seems a bit too much, try a lower value.

---

<div class="post-metadata">

**Author:** ![Panuchka](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/panuchka/32/12054_2.png) [@Panuchka](https://forum.babylonjs.com/u/Panuchka)\
**Post date:** [October 31, 2022, 3:26pm UTC](https://forum.babylonjs.com/t/point-light-not-fully-shadowing-the-mesh/35286/3 "2022-10-31T15:26:21Z")

</div>

> [@Evgeni\_Popov](#):
>
> Anyway, the angle parameter to the **SpotLight** constructor is in radians, not degrees. Also, 180 seems a bit too much, try a lower value.

Yeah true, changed it to `Math.PI / 2`, but still same result.

Also it seems that the distance from the corner does not change the gap size at all… 🤔

---

<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:** [October 31, 2022, 4:02pm UTC](https://forum.babylonjs.com/t/point-light-not-fully-shadowing-the-mesh/35286/4 "2022-10-31T16:02:29Z")

</div>

Are you able to provide a live link, even if it’s not in the Playground?

---

<div class="post-metadata">

**Author:** ![Panuchka](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/panuchka/32/12054_2.png) [@Panuchka](https://forum.babylonjs.com/u/Panuchka)\
**Post date:** [October 31, 2022, 5:06pm UTC](https://forum.babylonjs.com/t/point-light-not-fully-shadowing-the-mesh/35286/5 "2022-10-31T17:06:34Z")

</div>

Can’t provide a link yet to the full game, I will probably do a playground later on if someone doesn’t have a clue what could be the issue before that 😃

Could this have something to do with the `Mesh.MergeMeshes`? Since I am using that to combine different cloned meshes, the shadow kind of cuts from the end of the corner piece…

---

<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:** [October 31, 2022, 6:18pm UTC](https://forum.babylonjs.com/t/point-light-not-fully-shadowing-the-mesh/35286/6 "2022-10-31T18:18:42Z")

</div>

No, `Mesh.MergeMeshes` should not do that… In any case, maybe you can test without doing this call to rule out this possibility?

---

<div class="post-metadata">

**Author:** ![Panuchka](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/panuchka/32/12054_2.png) [@Panuchka](https://forum.babylonjs.com/u/Panuchka)\
**Post date:** [October 31, 2022, 6:41pm UTC](https://forum.babylonjs.com/t/point-light-not-fully-shadowing-the-mesh/35286/7 "2022-10-31T18:41:11Z")

</div>

I’ll do that later on… I have a hunch that this is a “peter panning” issue, since the floor and the wall are part of the same mesh

---

<div class="post-metadata">

**Author:** ![Panuchka](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/panuchka/32/12054_2.png) [@Panuchka](https://forum.babylonjs.com/u/Panuchka)\
**Post date:** [October 31, 2022, 6:57pm UTC](https://forum.babylonjs.com/t/point-light-not-fully-shadowing-the-mesh/35286/8 "2022-10-31T18:57:18Z")

</div>

Yeap, fine tuning the bias and normalBias have improved the result:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/f/9f7f0a93bcac4f260cf1f1a67cf325d4567e2f37.jpeg)

The values right now are:

```auto
frontGenerator.bias = 0.000002
frontGenerator.normalBias = 0.00001

```

Not quite sure how to set the normalBias here in relation to the bias and how it actually affects the whole thing…

Aaaaand some other artifacts are popping up 😃

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/1/61a770bab8b283302cdab01f8191ec0aef0bc8f0.jpeg)

---

<div class="post-metadata">

**Author:** ![Panuchka](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/panuchka/32/12054_2.png) [@Panuchka](https://forum.babylonjs.com/u/Panuchka)\
**Post date:** [October 31, 2022, 7:17pm UTC](https://forum.babylonjs.com/t/point-light-not-fully-shadowing-the-mesh/35286/9 "2022-10-31T19:17:13Z")

</div>

I think I found the right values now!

```auto
frontGenerator.bias = 0.00001
frontGenerator.normalBias = 0.00002

```

These for now seem to result in the best result in my case.

**The problem was peter panning that was countered by tinkering with bias and normalBias values**. Read more here: [Shadows | Babylon.js Documentation](https://doc.babylonjs.com/features/featuresDeepDive/lights/shadows#self-shadow)
