面临着无形的使用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 t...

我有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;
    });
}
阅读全文

相关推荐

最新文章