Artifacting on shadows

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


It does not seem to happen on the walls. I am unable to explain it. These are my shadowGenerator and light settings.

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.

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.

1 Like

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

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

1 Like

THANKS A MILLION!

1 Like