Tyler
Tyler

Reputation: 264

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!

Upvotes: 1

Views: 1012

Answers (2)

Tyler
Tyler

Reputation: 264

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.

Upvotes: 1

Raanan W
Raanan W

Reputation: 1295

you can try using one of the soft shadows flag, while reducing the shadow map size, because as you say - 4096 is way too large.

You can read more about it here, and try the following

shadowGenerator.useExponentialShadowMap = true;
// or!
shadowGenerator.usePoissonSampling = true;

Upvotes: 1

Related Questions