Logarith
Logarith

Reputation: 710

Face is not drawn

I try to draw a mesh with several faces.

Some of the faces are drawn some of them not.

When instantiating a mesh which is normally not drawn, with the index in reverse it is drawn.

The following doesnt work:

   geom.faces.push(new THREE.Face3(k,k+1,k+2,myface.normal));

This works:

   geom.faces.push(new THREE.Face3(k+2,k+1,k,myface.normal));

This for me means that the order of the vertices is wrong and so the normal is drawn in the opposite direction, but I pass the correct normal to the face (which I calculate myself) Even if I try to negate the normal, the face is not drawn.

So if I pass the correct normal as I understand it, it would make no difference if the indices are put in reverse or otherwise.

Where am I wrong?

Upvotes: 2

Views: 1212

Answers (1)

WestLangley
WestLangley

Reputation: 104783

The face front is determined by the winding order, not the face normal. The default winding order is counter-clockwise (CCW).

Have a look at the source of Geometry.computeFaceNormals(), and notice how the computed face normal is consistent with a CCW winding order.

three.js r.58

Upvotes: 4

Related Questions