面临着无形的使用Three.js一面 [英] Faces invisible from one side using Three.js
本文介绍了面临着无形的使用Three.js一面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有JPG纹理加载到页面的OBJ文件 - 从一个侧面脸是可见的,但是从其他的就什么也看不见
I have an OBJ file with JPG texture loaded into a page - from one side the faces are visible, but from the other they are invisible.
面可见的(有点暗 - !对不起)
Faces visible (a little dark - sorry!)
另一面 - 面不可见
我尝试添加 model.doubleSided = TRUE;
但是这似乎并没有改变任何东西。
I tried adding model.doubleSided = true;
but that doesn't seem to change anything.
推荐答案
添加双面国旗的材料。假设你有这样的:
Add the double sided flag on the material. Assuming you have something like:
material = new THREE.MeshLambertMaterial ({ color: 0xFF00FF });
地址:
material.side = THREE.DoubleSide;
或当您创建的材料做的:
or when you create the material do:
material = new THREE.MeshLambertMaterial ({ color: 0xFF00FF, side: THREE.DoubleSide });
编辑:对于OBJMTL加载器返回Object3D我们会再需要遍历设置相应的标志物:
For the OBJMTL loader that returns an Object3D we would then need to traverse the object to set the appropriate flag:
if (object instanceof THREE.Object3D)
{
object.traverse (function (mesh)
{
if (! (mesh instanceof THREE.Mesh)) return;
mesh.material.side = THREE.DoubleSide;
});
}
这篇关于面临着无形的使用Three.js一面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文