Quantcast
Channel: Babylon.js
Viewing all articles
Browse latest Browse all 388

Shadow on decalMesh

$
0
0

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 :)

Attached Thumbnails

  • shadow.jpg

Viewing all articles
Browse latest Browse all 388

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>