Jump to content

Shadow on decalMesh


snot224
 Share

Recommended Posts

Hi again,

 

here an over problem I don't understand.
In my projet (a strategy game) when I construct a new building I put on the floor a decal, but this decal look's like very dark when normal vector is positive, and when is negative no shadow cast on it...

Here the code :

 

// Material

    this.tabMateriaux['solChateau']                                                    = new BABYLON.StandardMaterial("solChateau",scene);
    this.tabMateriaux['solChateau'].diffuseTexture                          = new BABYLON.Texture("3d/terrain/images/solChateau.png",scene);
    this.tabMateriaux['solChateau'].diffuseColor                             = new BABYLON.Color3(1, 1, 1);
    this.tabMateriaux['solChateau'].diffuseTexture.hasAlpha        = true;       



// Placement décal
        var taille             = new BABYLON.Vector3((this.maxX-this.minX)*_CONST_TAILLE_CARREAU__,(this.maxZ-this.minZ)*_CONST_TAILLE_CARREAU__,(this.maxZ-this.minZ)*_CONST_TAILLE_CARREAU__);
       
        var sol                = BABYLON.Mesh.CreateDecal("decal", ground, new BABYLON.Vector3(this.mesh[0].position.x,this.mesh[0].position.y,this.mesh[0].position.z),new BABYLON.Vector3(0,-1,0), taille);
        sol.position.y  += 1;
        sol.receiveShadows     = true;
        sol.material         = controleurObjet.tabMateriaux['floor'].getSubMaterial(this.indexSubMatSol);
        
        shadowGenerator.getShadowMap().renderList.push(sol);


I put in attachment a picture to be more clear.

 

have a nice day :)

post-18113-0-82992800-1451568259_thumb.j

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.

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

Loading...
 Share

  • Recently Browsing   0 members

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