surreal5335 Posted January 26, 2016 Share Posted January 26, 2016 I am trying to develop a shadow on the ground but after following the tutorial and going over other examples I could find, still its not working for me. Here is the code I have: var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); var scene = new BABYLON.Scene(engine); var light = new BABYLON.PointLight("light01", new BABYLON.Vector3(0.5, 3, -1.5), scene); var sphere = BABYLON.Mesh.CreateSphere("sphere", 16, 1, scene); var ground = BABYLON.Mesh.CreateGround("ground1", 6, 6, 2, scene); ground.position.y = -0.5; // Shadows var shadowGenerator = new BABYLON.ShadowGenerator(1024, light); shadowGenerator.getShadowMap().renderList.push(sphere); shadowGenerator.useVarianceShadowMap = true; // throws an error says light.supportsVSM is not a function ground.receiveShadows = true; var camera = new BABYLON.FreeCamera("camera01", new BABYLON.Vector3(0, 2, -3), scene); camera.setTarget(new BABYLON.Vector3(0, 0, 0)); camera.attachControl(canvas); scene.beginAnimation(sphere, 0, 100, true); // Render engine.runRenderLoop(function() { scene.render(); }); This scene does setup and run no problem with a ground plane, sphere which reacts to the light, its just that the ground does not receive shadows from the sphere. I am using babylon v2.2 currently Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 26, 2016 Share Posted January 26, 2016 Hello to use point light with shadows you hva to use bjs 2.3 as this is a new feature Quote Link to comment Share on other sites More sharing options...
surreal5335 Posted January 26, 2016 Author Share Posted January 26, 2016 Thanks a lot, that did it. I was thinking my light may have something to do with the problem Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.