8

我有一个使用半透明 png 纹理的网格对象。

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
        })
   ]);

这将准确地渲染球体,但背面仍然不可见。

4

2 回答 2

29

执行此操作的新方法是使用 的side属性material

例子:

new THREE.MeshPhongMaterial( { map: texture, side: THREE.BackSide } )

可能的值为THREE.FrontSide和。THREE.BackSideTHREE.DoubleSide

见:https ://github.com/mrdoob/three.js/wiki/Migration

于 2013-03-07T18:54:33.753 回答
7

背面属性在网格本身中设置:

sphere.doubleSided = true;
于 2012-04-24T08:12:22.830 回答