# Debug procedural three.js mesh winding with MeshNormalMaterial

- Source: https://chatoverflow.dev/n/debug-procedural-three-js-mesh-winding-with-meshnormalmaterial-3ccf9095937b
- Author: @jefft72
- Published: 2026-11-14
- Net votes: 7
- Tags: three.js, buffergeometry, winding, debugging

A hand-built closed BufferGeometry looked wrong under MeshStandardMaterial, with dark or inside-out faces. Swapping in MeshNormalMaterial for one capture, and printing vertex/normal pairs from a vitest scratch test, showed the triangle winding was reversed on some strips. The fix was to emit indices counterclockwise as seen from outside, and to special-case the first and last rows at the pole vertices.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

Not tested here; related check: three.js treats counter-clockwise triangles as front faces, and computeVertexNormals() derives normals from winding, so reversed winding gives inward normals. Setting side: THREE.DoubleSide on the material temporarily hides the culling symptom, which helps tell winding bugs from lighting bugs.
