The shadow does not work with object .babylon
I have a problem, I have a scene with an exported .babylon file, I can not make all objects shadow and the ground receives shadows, I need help with this, please someone has an idea?
sorry for my english, is bit bad.
and her the code
Babylon - Getting Started !-- Babylon.js --> html, body { overflow: hidden; width : 100%; height : 100%; margin : 0; padding : 0; }Blockquote
#renderCanvas {
width : 100%;
height : 100%;
touch-action: none;
}
</style>
var canvas = document.getElementById("renderCanvas");
// <reference path="../../dist/preview release/babylon.d.ts"/>
// <reference path="../../dist/preview release/materialsLibrary/babylon.cellMaterial.d.ts"/>
var createScene = function() {
var scene = new BABYLON.Scene(engine);
scene.clearColor = new BABYLON.Color4(0, 0, 0, 0)
scene.ambientColor = new BABYLON.Color3(0.4, 0.4, 0.4)
var camera = new BABYLON.ArcRotateCamera("Camera", 0, Math.PI / 2, 12, BABYLON.Vector3.Zero(), scene);
camera.attachControl(canvas, true, true);
var light = new BABYLON.DirectionalLight('light', new BABYLON.Vector3(0, -1, 1), scene)
var SphereTexture = new BABYLON.StandardMaterial("ground", scene);
SphereTexture.diffuseTexture = new BABYLON.Texture("textures/amiga.jpg", scene);
SphereTexture.diffuseTexture.uScale = 1;
SphereTexture.diffuseTexture.vScale = 1;
SphereTexture.specularColor = new BABYLON.Color3(0, 0, 0);
var shadowGenerator = new BABYLON.ShadowGenerator(1024, light);
shadowGenerator.useExponentialShadowMap = true;
shadowGenerator.useBlurExponentialShadowMap = true;
shadowGenerator.useKernelBlur = true;
shadowGenerator.blurKernel = 500;
shadowGenerator.setDarkness(0.5);
//var knot = BABYLON.Mesh.CreateTorusKnot("knot", 2, 0.5, 128, 64, 2, 3, scene);
BABYLON.SceneLoader.Append("./", "bobermaneditor1.babylon", scene, function (newMeshes) {
shadowGenerator.addShadowCaster(newMeshes[1]);
});
var cell = new BABYLON.CellMaterial("cell", scene);
cell.diffuseTexture = new BABYLON.Texture("textures/amiga.jpg", scene);
cell.diffuseTexture.uScale = cell.diffuseTexture.vScale = 3;
cell.computeHighLevel = true;
return scene;
};
var engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });
var scene = createScene();
engine.runRenderLoop(function () {
if (scene) {
scene.render();
}
});
// Resize
window.addEventListener("resize", function () {
engine.resize();
});
</script>