Jump to content

shadowGenerator not generating on ground


Recommended Posts

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.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));

    scene.beginAnimation(sphere, 0, 100, true);

    // Render
    engine.runRenderLoop(function() {


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

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...