computeVertexNormals

女生的网名这么多〃 提交于 2019-12-21 12:20:51

问题


I am using 3d modifiers https://github.com/foo123/MOD3 to bend a cube. After the geometry is updated (vertex positions are changed) the lights are not updated, the cube is still shaded as if nothing changed. So I tried

cube.geometry.computeVertexNormals()

and

cube.geometry.computeFaceNormals()

but after that the cube is not rendered like a cube anymore but like an "ugly sphere":

On the left is shading after computeVertexNormals(), on the right is the original shading.

How can I update the shading after the geometry changes?


回答1:


If you use MOD3 to modify just the geometry, then you are going to have to update the normals yourself.

geometry.computeVertexNormals();

Each new vertex normal will be the normalized sum of the face normals of the neighboring faces that share that vertex.

If you don't like the way that three.js does it, your only choice is to modify the vertex normals yourself.

three.js r.85



来源:https://stackoverflow.com/questions/13233368/computevertexnormals

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