BufferGeometry face normals

Dear community!

I have some BufferGeometry which holds indexed triangles.
I want it to have a face normals. But it seems I can add only per-vertex normals.

When I compute normals in per-triangle basis, and then add normals of length of (indices.length), via
geometry.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array(normals), 3 ) );

I get glDrawElements: attempt to access out of range vertices in attribute 1

The geometry I work with contains tetrahedrons, so I need those face normals.
And I do not want to split it to non-indexed geometry, because my original tetrohedron mesh already tooo big.

So my question is. Where can I digg into ThreeJS source and implement face normals to BufferGeometry?

Author: Fantashit

1 thought on “BufferGeometry face normals

Comments are closed.