Hi!
I’m generating a Buffer geometry mesh from scratch manually and I’m not sure to do i correctly.
Is there a way to validate winding order of triangles of a Buffer Geometry?
Maybe a good thing that can help me to understand to debug it is to make something like a FaceNormalHelper but for BufferGeometry, is it possible?
When you just render the triangles, the winding order becomes obvious. Triangles (or their front-faces) are usually defined in CCW order. If you can only see a face if you move the camera around, you’ve obviously arranged your data in the wrong way.
Hi @Mugen87 thanks for the reply. I’m asking because I’ve seen some visual glitches moving the camera around, but I’d like to do a better debug programmatically…
I’m curious, what do you imagine such a validator being? An AI that inspects your geometry and goes “yup, that’s exactly what the author wanted it to look like, no errors here!” or perhaps a validator that checks that you geometry has exactly one triangle and it has index order 1,2,3? You have me intrigued!
I would say “analytically”. You have to know what order of vertices is correct and decide how to indicate when it’s incorrect.
Maybe it’s enough to have, say, a “helper material” that you apply to your model and it paints front of faces in green and back of faces in red. I think it would be noticeable. Well, depends on complexity of a model and amount of faces. Creativity is up to you