While working on my custom geometry in three.js with TypeScript, I encountered an issue where the object appeared dark with Lambert material. To troubleshoot, I examined the source code and noticed that nearly every geometry class had the following two lines at the end of the constructor:
this.computeCentroids();
this.computeFaceNormals();
After adding computeFaceNormals, the problem was resolved. I vaguely recall that normals are related to lighting, which makes sense.
However, I am unsure about the purpose of computeCentroids and why centroids are necessary. Can someone provide an explanation? Do I also need to call that function, and what consequences might arise if I neglect it?