Search the Community
Showing results for tags 'receiveshadows'.
-
Hello! How receive shadow actually works? i'v been trying to get it work on imported meshes without success. the weird part is that it works on plain plane just well :S I'v been trying something like this for hours and just can't get it work. EDIT: the plan was to get the mesh to receive shadows from itself. var light = new BABYLON.DirectionalLight("dir01", new BABYLON.Vector3(-1, -2, -1), scene); light.position = new BABYLON.Vector3(20, 40, 20); light.intensity = 1; var shadowGenerator = new BABYLON.ShadowGenerator(2048, light); shadowGenerator.useVarianceShadowMap = true; shadowGenerator.usePoissonSampling = true; shadowGenerator.bias = 0.01; BABYLON.SceneLoader.ImportMesh("", "assets/models/sample/", "house1.babylon", scene, function (newMesh){ newMesh[0].material.specularPower = 0; newMesh[0].material.specularColor = new BABYLON.Color3(0, 0, 0); newMesh[0].material.diffuseColor = new BABYLON.Color3(1, 1, 1); newMesh[0].material.emissiveColor = new BABYLON.Color3(1, 1, 1); newMesh[0].position.x = -4; newMesh[0].position.z = 6; newMesh[0].position.y = -0.05; newMesh[0].rotation.y = Math.random()*(2*Math.PI); shadowGenerator.getShadowMap().renderList.push(newMesh[0]); newMesh[0].receiveShadows = true; }); var material1 = new BABYLON.StandardMaterial("texture1", scene); material1.emissiveColor = new BABYLON.Color3(0,0,0) material1.diffuseTexture = new BABYLON.Texture("assets/models/sample/sand.png", scene); material1.diffuseTexture.uScale = 500.0; material1.diffuseTexture.vScale = 500.0; var plane = BABYLON.Mesh.CreatePlane("plane", 1000.0, scene); plane.rotation.x += Math.PI / 2; plane.material = material1; plane.receiveShadows = true; Anyone knows what i'm doing wrong? - regards, eljuko