Jump to content

Displaced Shadows


Recommended Posts

Hi guys,

I recently started with some visual fidelity stuff in my scene and I wanted to add shadows.


Now, I load a mesh that I exported from blender and I do this


BABYLON.SceneLoader.ImportMesh("", "lib/orteclbvis/themes/defaulttheme/models/","yard.babylon", this.scene, (newMeshes, ParticleSystem, skeletons ) =>

    newMeshes[0].rotate(BABYLON.Axis.Y, BABYLON.Tools.ToRadians(180), BABYLON.Space.LOCAL);
    newMeshes[0].position.y = this.getEnvironmentHeight();
    newMeshes[0].position.z = 0; 
    newMeshes[0].position.x = 30000; 

        var shadowGenerator = new BABYLON.ShadowGenerator(1024*16, this.sceneObjects.sunLight);                                        

// recursive shadow enabler method code:

static enableMeshShadowsRecursively(meshes : BABYLON.Mesh[], shadowGenerator : BABYLON.ShadowGenerator)
    for(var i = 0; i < meshes.length; i++)
        var m = meshes[i];
        m.receiveShadows = true;
        var childs = m.getChildMeshes();
        if(childs && childs.length > 0)
            this.enableMeshShadowsRecursively(<BABYLON.Mesh[]>childs, shadowGenerator);


And my shadows are weirdly offset. See attached images.


Any idea how that can happen?


My scene scale is quiet big (1 babylon unit = 1mm)





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