Why does CSM have this effect on meshes?
var dir = new BABYLON.Vector3(1, -2, 1);
var light = new BABYLON.DirectionalLight("DirectionalLight", dir, scene);
light.position.x = -12.507
light.position.y = 11.798;
light.position.z = 0.940
light.direction = new BABYLON.Vector3(0.711, -0.703, -0.008)
let shadow = new BABYLON.CascadedShadowGenerator(1024, light);
shadow.lambda = 0.2;
shadow.autoCalcDepthBounds = true;
shadow.darkness = 0;
// shadow.debug = true;
light.intensity = 4;
shadow.splitFrustum();
scene.debugLayer.show({
embedMode: true,
});
//AND THEN FOR EACH MESH - snippet example
sc.meshes.forEach(m=>{
m.receiveShadows = true;
shadow.getShadowMap().renderList.push(m);
})
Code seems fine as shadows do appear, but you also get this dithering