Hello,
Here’s repro code (can’t save to playground, error 500).
The floor will disappear after 2s when the optimizer disables shadows (same effect with scene.disableShadows = true
)
Without PCF the floor will still be there but small dark spots from the shadow are still visible
Switching ground.receiveShadows back & forth in the inspector will have the situation go back to normal
var createScene = function (engine) {
const scene = new BABYLON.Scene(engine);
const camera = new BABYLON.ArcRotateCamera("Camera", -3 * Math.PI / 4, Math.PI / 3, 50, BABYLON.Vector3.Zero(), scene);
camera.attachControl(canvas, true);
const light = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(0, -1, 1), scene);
light.position = new BABYLON.Vector3(0, 15, -30);
var ground = BABYLON.Mesh.CreateGround("ground", 100, 100, 1, scene, false);
ground.receiveShadows = true;
// Shadow generator
const shadowGenerator = new BABYLON.ShadowGenerator(1024, light);
shadowGenerator.usePercentageCloserFiltering = true;
BABYLON.SceneLoader.ImportMesh("him", "/scenes/Dude/", "Dude.babylon", scene, function (newMeshes2, particleSystems2, skeletons2) {
var dude = newMeshes2[0];
dude.scaling = new BABYLON.Vector3(0.2, 0.2, 0.2);
//add dude, true means add children as well
shadowGenerator.addShadowCaster(dude, true);
scene.beginAnimation(skeletons2[0], 0, 100, true);
var options = new BABYLON.SceneOptimizerOptions(70, 2000);
options.addOptimization(new BABYLON.ShadowsOptimization(0));
var optimizer = new BABYLON.SceneOptimizer(scene, options);
optimizer.onNewOptimizationAppliedObservable.add(function (optim) {
console.log(optim.getDescription());
});
optimizer.start();
});
return scene;
};