I think I’ve discovered what the issue is but Im not sure what to do about it. It seems that the more objects you add to the to the shadow caster with “addShadowCaster”, the more jagged the shadows become. I created a playground here: Babylon.js Playground
It seems like you really dont need that many to start getting jaggies. Is there anything that can be done? Thanks!
https://playground.babylonjs.com/#ZSB485#1
Added animation to the light, moved some spheres upwards.
With shadowGenerator.useBlurExponentialShadowMap = true; shadowGenerator.useKernelBlur = true; shadowGenerator.blurKernel = 64;
results are much better.
Why is it that the meshes close to the ground dont cast a shadow? Also btw, it seems that the range of distance that the meshes are spread out seems to matter as far as shadow quality. Go to this playground and adjust the “distance_range” var to 10.
A shadow map must englobe every mesh set as parameter. If the meshes are spread across a large surface, the shadow map texels will have less density.
A possibility is to add/remove meshes based on distance to the camera.
Thanks, that makes sense . I think setting useBlurExponentialShadowMap should work good enough for my purpose. Although I have a question that is somewhat adjacent. When using “useBlurExponentialShadowMap”, it seems that when a mesh is half under the ground, a shadow is being drawn for that portion of the mesh below the ground. here is a playground: https://playground.babylonjs.com/#ZSB485#5
Is there a way to account for this other than just not doing that? Thanks!