Hi all!
I’d like to cast shadows on ground (heightmap) of multiple (>10) meshes located all over the scene.
How to?
Hope for help,
. J
Hi all!
I’d like to cast shadows on ground (heightmap) of multiple (>10) meshes located all over the scene.
How to?
Hope for help,
. J
I think this should help:
After reading and playing a bit my concern is as follows:
ShadowGenerator
ShadowGenerator
DirectionalLight.position
has to be moved with the mesh-object to make sure the lights shadow frustrum remains as small as possibleDirectionalLight
can only be used with a single ShadowGenerator
This means I have to have one ShadowGenerator
per mesh-object -> one DirectionalLight
per mesh-object.
AFAIK the number of lights is strictly limited and way less than the number of objects.
Is there a way out?
Can’t there be kind of a DummyDirectionalLight
just used for the shadow casting and not being counted as a light in the scene, not lighting anything?
Still hoping for help,
. J
have a plot of 3000 * 3000 and cascading shadows. My light is quite high and all the objects, characters have shadows all over the ground and a quality shadow.
The cascading shadows are a marvel.
https://doc.babylonjs.com/babylon101/shadows_csm
Here are my current settings :
var light = new BABYLON.DirectionalLight("DirectionalLight", new BABYLON.Vector3(-5, -5, 5), scene);
light.position = new BABYLON.Vector3(1000, 1500, 0);
light.diffuse = BABYLON.Color3.White();
light.specular = new BABYLON.Color3(0.3, 0.3, 0.3);
light.intensity = 1.0;
var csmShadowGenerator = new BABYLON.CascadedShadowGenerator(2048, light);
csmShadowGenerator.stabilizeCascades = true;
csmShadowGenerator.forceBackFacesOnly = true;
csmShadowGenerator.shadowMaxZ = 100;
csmShadowGenerator.autoCalcDepthBounds = true;
csmShadowGenerator.lambda = 0.5;
csmShadowGenerator.depthClamp = true;
csmShadowGenerator.penumbraDarkness = 0.8;
csmShadowGenerator.usePercentageCloserFiltering = true;
csmShadowGenerator.filteringQuality = BABYLON.ShadowGenerator.QUALITY_HIGH;
Thank you @Dad72. I have no idea how it works … but it does. Pretty impressive!
And it does’nt even harm the performance budget too hard.