Vertices and triangles count

Hi,

i display the vertices and triangles count on model selected.

When is a Geometry is simple as using vertices.length and faces.length.

But when is a BufferGeometry.
The vertices = attributes.position.count.
There is no faces attribute, so just divide this by 3 for the triangles and it seem ok
And when is index.
The index.count can be much higher and even divided by 3 the triangles is greater than the vertices count.
What is the real good value to use as vertices count when is index ?
The attributes.position.count or the index.count ?

thx.

The vertex count is always position.count. The number of rendered triangles depends on whether the geometry is indexed or non-indexed. If there is an index, it’s index.count / 3. Otherwise it’s position.count / 3.

1 Like

Thx for the super quick answer

Yep, is what i was doing, and is why i ask about.
Because this make me feel strange to have a possible triangles count superior to the vertices count.