是否有一个背面可见度相当于three.js? [英] Is there a backface-visibility equivalent for three.js?
本文介绍了是否有一个背面可见度相当于three.js?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个对象与使用半透明PNG纹理的网格。
I have an object with a mesh that uses a semi-transparent png texture.
是否有一个标志或选项为MeshBasicMaterial使得物体后面是可见的通过前
Is there a flag or option for the MeshBasicMaterial so that the back of the object is visible through the front?
下面是一些示例code:
Here is some sample code:
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
})
]);
这将准确呈现球体但后面仍然是不可见的。
This will accurately render the sphere but the back remains invisible.
推荐答案
新的方式做,这是使用侧
属性材料
。
The new way to do this is by using the side
property of material
.
示例:
new THREE.MeshPhongMaterial( { map: texture, side: THREE.BackSide } )
可能的值 THREE.FrontSide
, THREE.BackSide
和 THREE.DoubleSide
。
请参阅:<一href="https://github.com/mrdoob/three.js/wiki/Migration">https://github.com/mrdoob/three.js/wiki/Migration
这篇关于是否有一个背面可见度相当于three.js?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文