我有一个带有使用半透明 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
})
]);
这将准确地渲染球体,但背面仍然不可见。
最佳答案
执行此操作的新方法是使用 material
的 side
属性。
示例:
new THREE.MeshPhongMaterial( { map: texture, side: THREE.BackSide } )
可能的值为 THREE.FrontSide
、THREE.BackSide
和 THREE.DoubleSide
。
关于javascript - three.js 是否有等效的背面可见性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10287186/