问题描述
Three.js的 JSON模型格式.它指定了顶点的位置和面-有时是三角形,有时是四边形,有时是带有材质索引,有时没有.
I have several objects in Three.js's JSON Model Format. It specifies vertex positions, and faces -- sometimes triangles, sometimes quads, sometimes with material indices and sometimes not.
但是这些文件都没有指定顶点法线.
However none of these files have vertex normals specified.
我想要一种可以在一组网格面上计算此类法线的算法.我想指定一个角度限制,超过该角度将显示折痕(在顶点处,相邻面不共享法线.)
I want an algorithm that can calculate such normals over a set of mesh faces. I'd like to specify an angular limit beyond which a crease is shown (normals are not shared by adjacent faces at a vertex.)
在我自己编码之前,我想知道这是否已经存在于Three.js中或其他可用的地方?
Before coding this myself I wondered, does this exist either in Three.js already or somewhere else that's usable?
推荐答案
唯一可用的是
geometry.computeFaceNormals();
geometry.computeVertexNormals();
请参阅该算法的来源.
three.js r.55
three.js r.55
这篇关于在Three.js中生成顶点法线以使用折角平滑阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!