Search code examples
javascriptbabylonjs

Shadow map in Babylon JS


Im somewhat new to Babylon JS but I created a scene and filled it with some cubes, added a light and a shadow map using:

new BABYLON.ShadowGenerator(4096, light);

Im getting really aliased shadow edges. I would like to know how I can get the aliasing to be smaller without bumping up the shadow map size.

enter image description here

Its already at 4096 which is already fairly large. Am I missing something? Thanks!


Solution

  • It turns out that how spread out shadow casting objects are makes a difference in the shadow quality. For example, go here and change the "distance_range" var to 10:

    https://playground.babylonjs.com/#ZSB485#3

    I ended up just using shadowGenerator.useBlurExponentialShadowMap = true and that seemed to be good enough for me.