# Artifacting on shadows

**URL:** <https://forum.babylonjs.com/t/artifacting-on-shadows/5923>\
**Category:** Questions\
**Tags:** lighting\
**Created:** [September 27, 2019, 8:10am UTC](https://forum.babylonjs.com/t/artifacting-on-shadows/5923 "2019-09-27T08:10:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaileshiyer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/shaileshiyer/32/2125_2.png) [@shaileshiyer](https://forum.babylonjs.com/u/shaileshiyer)\
**Post date:** [September 27, 2019, 8:10am UTC](https://forum.babylonjs.com/t/artifacting-on-shadows/5923/1 "2019-09-27T08:10:50Z")

</div>

So whenever I use shadow Generator to create shadows on my floor mesh. There appears to be some artifacting.

 ![Screenshot_20190927_133349](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/9/920110aeb1a6262006fd6506eb3f33f158a23ac9.jpeg)  
It does not seem to happen on the walls. I am unable to explain it. These are my shadowGenerator and light settings.

```auto
const dlight2 = new BABYLON.DirectionalLight('DirectionalLight2', new BABYLON.Vector3(-0.3, -0.5, -1), scene);
dlight2.position = new BABYLON.Vector3(80, 100, 600);
dlight2.intensity = 2.5;
dlight2.shadowMinZ = 0.1;
dlight2.shadowMaxZ = 2000;

const shadowGenerator = new BABYLON.ShadowGenerator(1024, dlight2);
shadowGenerator.filter = BABYLON.ShadowGenerator.FILTER_PCF;

shadowGenerator.setDarkness(0);
// Toggling backfaces does nothing 
shadowGenerator.forceBackFacesOnly = true;
shadowGenerator.filteringQuality = BABYLON.ShadowGenerator.QUALITY_LOW;

shadowGenerator.getShadowMap().refreshRate = BABYLON.RenderTargetTexture.REFRESHRATE_RENDER_ONCE;

```

If someone can explain why it is happening and any solutions to remove the artifacting that be great.

---

<div class="post-metadata">

**Author:** ![shaileshiyer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/shaileshiyer/32/2125_2.png) [@shaileshiyer](https://forum.babylonjs.com/u/shaileshiyer)\
**Post date:** [September 27, 2019, 8:13am UTC](https://forum.babylonjs.com/t/artifacting-on-shadows/5923/2 "2019-09-27T08:13:22Z")

</div>

Turns out that changing the minimum shadow z on the light affects the artifacting.  
Changing it to 1 in the inspector solved the issue but on a refresh with the new value the artifacting still exists.

---

<div class="post-metadata">

**Author:** ![shaileshiyer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/shaileshiyer/32/2125_2.png) [@shaileshiyer](https://forum.babylonjs.com/u/shaileshiyer)\
**Post date:** [September 28, 2019, 7:58pm UTC](https://forum.babylonjs.com/t/artifacting-on-shadows/5923/3 "2019-09-28T19:58:37Z")

</div>

Changing the shadow bias removes the shadow acnea altogether. The documentation writers of babylonjs have done a really good job about writing about the code and explaining the concepts of 3d behind it. For others who might be facing the issue of shadow artifacting or acnea you can take a look at the troubleshooting section of this page.  
[https://doc.babylonjs.com/babylon101/shadows#troubleshooting](https://doc.babylonjs.com/babylon101/shadows#troubleshooting)

You can also take a look at this opengl article that is linked in that page that talks about shadows and shadowmaps and removing shadow acnea  
[http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/#shadow-acne](http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/#shadow-acne)

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [September 30, 2019, 3:41pm UTC](https://forum.babylonjs.com/t/artifacting-on-shadows/5923/4 "2019-09-30T15:41:03Z")

</div>

> [@shaileshiyer](#):
>
> The documentation writers of babylonjs have done a really good job about writing about the code and explaining the concepts of 3d behind it

THANKS A MILLION!
