2012-04-23 18 views
5

我有一個使用半透明png紋理的網格對象。是否有與three.js相當的背景能見度?

是否有MeshBasicMaterial的標誌或選項,以便通過前面可以看到對象的背面?

下面是一些示例代碼:

var texture = THREE.ImageUtils.loadTexture('world.png'); 

// create the sphere's material 
var sphereMaterial = new THREE.MeshBasicMaterial({ 
    map: texture, 
    transparent: true, 
    blending: THREE.AdditiveAlpha 
}); 

sphereMaterial.depthTest = false; 

// set up the sphere vars 
var radius = 50, segments = 20, rings = 20; 

// create a new mesh with sphere geometry - 
var sphere = new THREE.SceneUtils.createMultiMaterialObject(
    new THREE.SphereGeometry(radius, segments, rings),[ 
    sphereMaterial, 
    new THREE.MeshBasicMaterial({ 
     color: 0xa7f1ff, 
     opacity: 0.6, 
     wireframe: true 
     }) 
    ]); 

這將準確地渲染球,但後面仍然可見。

sphere.doubleSided = true; 

回答

20

新的方式做,這是使用的materialside屬性:

相關問題