Generating vertex normals for smooth shading with a slope angle in Three.js

I have several objects in Three.js JSON Model Format . It defines vertex positions, and faces - sometimes triangles, sometimes squares, sometimes with material indices, and sometimes not.

However, none of these files have vertex normals.

I need an algorithm that can calculate such normals over a set of grid faces. I would like to indicate the angular limit beyond which the bend is displayed (normals are not separated by adjacent faces at the vertex.)

Before encoding this, I wondered: does this exist in three or more than three .js?

+4
source share
1 answer

The only thing available is

geometry.computeFaceNormals(); geometry.computeVertexNormals(); 

See source for algorithm.

three.js r.55

+4
source

All Articles