2016-08-16 2 views
0

두 이미지를로드하는 데 바빌론을 사용하고 있습니다. 하나는 표준 jpg 이미지이고 두 번째는 투명한 배경을 가진 png 이미지입니다. 두 이미지로드가 서로 위에로드되지만 jpg 이미지가 투명해야하는 영역을 통해 표시되지 않습니다. 아무도 내가 어떻게 할 수 있는지 안다. 여기에 자료를 덮어 쓰는바빌론은 두 이미지를 서로 겹쳐서 두 번째 이미지를 투명하게 만듭니다.

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;

두 개의 비행기를 만드는 것이 좋습니다.

관련 문제