How to Toggle ThreeJS Outer Face Direction

那年仲夏 提交于 2019-12-11 16:44:59

问题


I am trying to make a function that will invert a Three.js Geometry across the xz plane. Scaling the geometry by (1, -1, 1) will effectively do just this, but now the planes that were facing outwards are facing inwards, so I can see through the geometry.

I know there is a way to render both sides of the faces, but I'd rather not so I can speed up render times. Is there an easy way I can toggle which face of a plane is shown?


回答1:


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

However, three.js does not support reflections in the object matrix -- it only supports pure rotations and (positive) scale factors. By setting a negative scale factor, you are reflecting the geometry of the object.

For more on this, see Transforming vertex normals in three.js.

three.js r.58



来源:https://stackoverflow.com/questions/17431316/how-to-toggle-threejs-outer-face-direction

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