Three.js: Bottom of mesh can't be displayed

拥有回忆 提交于 2019-12-24 15:42:58

问题


I have converted a mesh from .obj to json using the official converter (https://github.com/mrdoob/three.js/tree/master/utils/converters/obj). The mesh is displayed correctly from one side, but not from the other. I believe the issue is that it only has one side, basically a plane, and therefore all faces and their normals pointing in one direction.

How could I fix this?

Edit: I could add the mesh twice, and one time using material.side = THREE.BackSide;, but loading it twice doesn't seem like the best option to me.


回答1:


Only front faces of triangle primitives are rendered by default when using WebGLRenderer. You can override that by setting:

material.side = THREE.DoubleSide; // or THREE.BackSide

The front face is determined by the winding order of the vertices.

If the triangle vertices are specified in counter-clockwise order (CCW), the front face will face towards you; if specified in clockwise order (CW), the front face will face away from you.

This behavior can be changed by the WebGLRenderer.setFaceCulling() method, but it is not likely you would find that necessary.

three.js r.75



来源:https://stackoverflow.com/questions/36693850/three-js-bottom-of-mesh-cant-be-displayed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!