2016-08-16 9 views
0

2枚の画像を読み込むためにバビロンを使用しています。 1つは標準的なjpg画像で、2番目は透明な背景を持つpng画像です。両方の画像を重ねて読み込むと、jpg画像は透明でなければならない領域に表示されます。誰でも私がこれをどうやってできるか知っている。あなたがここに材料を上書きしているバビロンズは2枚の画像を重ねて表示し、2枚目の画像は透明です。

var createScene = function() { 
    var scene = new BABYLON.Scene(engine); 

    //Create a light 
    var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(-60, 60, 80), scene); 

    //Create an Arc Rotate Camera - aimed negative z this time 
    var camera = new BABYLON.ArcRotateCamera("Camera", Math.PI/2, 1.0, 210, BABYLON.Vector3.Zero(), scene); 
    camera.attachControl(canvas, true); 

    //Creation of a repeated textured material 
    var materialPlane = new BABYLON.StandardMaterial("texturePlane", scene); 
    materialPlane.diffuseTexture = new BABYLON.Texture("images/art.jpg", scene); 
    //materialPlane.emissiveTexture = new BABYLON.Texture('images/scodix1.png', scene); 
    //materialPlane.useAlphaFromDiffuseTexture 
    materialPlane.specularColor = new BABYLON.Color3(0, 0, 0); 
    materialPlane.backFaceCulling = false; //Allways show the front and the back of an element 

    var spotPlain = new BABYLON.StandardMaterial("texture", scene, true); 

    spotPlain.emissiveTexture = new BABYLON.Texture("images/scodix1.png", scene); 
    spotPlain.anisotropicFilteringLevel = 50; 
    //materialPlane.emissiveTexture = new BABYLON.Texture('images/transparent.png', scene); 
    //materialPlane.useAlphaFromDiffuseTexture 
    spotPlain.specularColor = new BABYLON.Color3(0, 0, 0); 
    spotPlain.backFaceCulling = false; //Allways show the front and the back of an element 

    //Creation of a plane 
    //var plane = BABYLON.Mesh.CreatePlane("plane", 120, scene); 
    var plane = BABYLON.MeshBuilder.CreatePlane("plane", { 
    width: 261, 
    height: 153 
    }, scene); 
    plane.rotation.x = Math.PI/2; 
    plane.material = materialPlane; 
    plane.material = spotPlain; 

    return scene; 
}; 

var scene = createScene(); 
engine.runRenderLoop(function() { 
    scene.render(); 
}); 

答えて

0

: plane.material = materialPlane。 plane.material = spotPlain;

2つのプレーンを作成することをお勧めします。

関連する問題