<p>The wavefront format (.obj) contains several abbreviations for vertex information:</p>
<pre><code>v 1 2 3   #vertex position (x y z)
vt 1 2    #texture coordinate (u v)
vn 1 2 3  #normal direction (x y z)
</code></pre>
<p>and definition of a triangle (surface):</p>
<pre><code>f 1/2/3 4/5/6 7/8/9 #Triangle with texture coordinate and normal direction.
f 1/2 3/4 5/6       #Triangle with texture coordinate
f 1 2 3             #Triangle without additional information
f 1//2 3//4 5//6    #Triangle with normal direction
</code></pre>
<p>However, counting vertices is complicated:</p>
<p>When using a graphics API, the vertex information must be formatted in a different way. Let's say we have only 2 triangles that share an edge. The wavefront obj file can look like this:</p>
<pre><code>v 0 0 0
v 0 1 0
v 1 0 0
v 1 1 0

vn 0 0 1

f 1//1 2//1 3//1
f 2//1 4//1 3//1
</code></pre>
<p>Here we can say that the mesh contains 4 vertices with 2 faces. But if you change to the following:</p>
<pre><code>v 0 0 0
v 0 1 0
v 1 0 0
v 1 1 0

vn 0 0 1
vn 0 1 1

f 1//1 2//1 3//1
f 2//2 4//2 3//2
</code></pre>
<p>then the graphics API must generate 6 vertices: three vertices for the first vertex v1, v2 and v3 with normal n1 and three vertices for the second triangle v2, v4 and v3 with normal n2. Thus, the vertices v2 and v3 must be generated twice because they have different normal directions.</p>
<p>Optimization algorithms can also play a role, for example if n1 is equal to n2, you only need 4 vertices. But does the software (MeshLab, 3D viewer) check this kind of optimization? I don't.</p>
<p>For non-textured objects, the type of shading also matters: if you use flat shading for our example, you need 6 vertices because both v2 and v3 get two normal directions. With Gouraud shading, you need only 4 vertices, since the multiple normal directions of a vertex result in only one normal direction, which affects the shading of both triangles (faces).</p>
<p>As you can see, your question cannot be answered without additional information.</p>

CC BY-SA 4.0
2023-06-05T11:37:07.943Z
Thanks, now I see the point. Maybe more sophisticated software like Blender, Maya, 3dmax, etc. has better vertices numbers depending on their use.
bim
CC BY-SA 4.0
2023-06-05T10:12:58.847Z
2023-06-05T10:12:58.847Z
Thomas
<p>I am confused by a 'wavefront obj' file's <code>true triangle number</code>. For example, I downloaded the <strong>Rungholt</strong> scene from <a href="https://casual-effects.com/data/index.html" rel="nofollow noreferrer">McGuire's Computer Graphics Archive</a>.</p>
<pre><code>// McGuire's site says the model has: 
Triangles: 6704264
Vertices: 12308528

//When I am using window's 3D viewer
Triangles: 6704264
Vertices: 20112792

// To get the confirmation I used MeshLab and the numbers are
Faces (Triangles): 6704264
Vertices: 2527838
</code></pre>
<p>You see, <strong>the triangle number</strong> is constant for all these three sources, but the <strong>vertices</strong> vary a lot. Now, which one should be the right in the <code>context of vertices number</code>? How to verify?</p>

CC BY-SA 4.0
2023-06-05T11:01:28.040Z
The methods being used to count vertices is inconsistent across tools. There are 'unique' vertices. Which is probably where the McGuire number is coming from. There is the number of vertices that are drawn. This can come from computing vertices from the index count.  This can include degenerate triangles. This is probably mesh labs number.  Then there are naïve approaches to counting vertices such as multiplying the triangle count by 3. Which is the number being output by windows 3d viewer.  The list goes on...
pmw1234
CC BY-SA 4.0
2023-06-05T11:30:04.467Z
@pmw1234 You are really right, I did not notice the trick of __3D Viewer__, checked with a few other models, and each time it is returning `3`,  I 3D viewer is out of the list. Now, if I want to use the vertices number for a publication, I need a reference point. May be either McGuire as a reference point, or not use the number at all.
bim
CC BY-SA 4.0
2023-06-05T11:40:03.513Z
You could qualify the number of vertices with something like "unique vertices".
pmw1234
<3d><mesh><triangulation>
How to get the accurate number of triangles of an wavefront obj model?
bim
# How to get the accurate number of triangles of an wavefront obj model?

(Asked by: username_0 on 2023-06-05)

I am confused by a 'wavefront obj' file's `true triangle number`. For example, I downloaded the **Rungholt** scene from [McGuire's Computer Graphics Archive](https://casual-effects.com/data/index.html).

```
// McGuire's site says the model has: 
Triangles: 6704264
Vertices: 12308528

//When I am using window's 3D viewer
Triangles: 6704264
Vertices: 20112792

// To get the confirmation I used MeshLab and the numbers are
Faces (Triangles): 6704264
Vertices: 2527838

```

You see, **the triangle number** is constant for all these three sources, but the **vertices** vary a lot. Now, which one should be the right in the `context of vertices number`? How to verify?

**Tags:** 3d, mesh, triangulation

> **Comments:**
> **username_1**: The methods being used to count vertices is inconsistent across tools. There are 'unique' vertices. Which is probably where the McGuire number is coming from. There is the number of vertices that are drawn. This can come from computing vertices from the index count.  This can include degenerate triangles. This is probably mesh labs number.  Then there are naïve approaches to counting vertices such as multiplying the triangle count by 3. Which is the number being output by windows 3d viewer.  The list goes on...  
> **username_0**: @username_1 You are really right, I did not notice the trick of __3D Viewer__, checked with a few other models, and each time it is returning `3`,  I 3D viewer is out of the list. Now, if I want to use the vertices number for a publication, I need a reference point. May be either McGuire as a reference point, or not use the number at all.  
> **username_1**: You could qualify the number of vertices with something like "unique vertices".  

---

## 1 answers

### Answer by username_2 on 2023-06-05. Score: 1 | Accepted answer

The wavefront format (.obj) contains several abbreviations for vertex information:

```
v 1 2 3   #vertex position (x y z)
vt 1 2    #texture coordinate (u v)
vn 1 2 3  #normal direction (x y z)

```

and definition of a triangle (surface):

```
f 1/2/3 4/5/6 7/8/9 #Triangle with texture coordinate and normal direction.
f 1/2 3/4 5/6       #Triangle with texture coordinate
f 1 2 3             #Triangle without additional information
f 1//2 3//4 5//6    #Triangle with normal direction

```

However, counting vertices is complicated:

When using a graphics API, the vertex information must be formatted in a different way. Let's say we have only 2 triangles that share an edge. The wavefront obj file can look like this:

```
v 0 0 0
v 0 1 0
v 1 0 0
v 1 1 0

vn 0 0 1

f 1//1 2//1 3//1
f 2//1 4//1 3//1

```

Here we can say that the mesh contains 4 vertices with 2 faces. But if you change to the following:

```
v 0 0 0
v 0 1 0
v 1 0 0
v 1 1 0

vn 0 0 1
vn 0 1 1

f 1//1 2//1 3//1
f 2//2 4//2 3//2

```

then the graphics API must generate 6 vertices: three vertices for the first vertex v1, v2 and v3 with normal n1 and three vertices for the second triangle v2, v4 and v3 with normal n2. Thus, the vertices v2 and v3 must be generated twice because they have different normal directions.

Optimization algorithms can also play a role, for example if n1 is equal to n2, you only need 4 vertices. But does the software (MeshLab, 3D viewer) check this kind of optimization? I don't.

For non-textured objects, the type of shading also matters: if you use flat shading for our example, you need 6 vertices because both v2 and v3 get two normal directions. With Gouraud shading, you need only 4 vertices, since the multiple normal directions of a vertex result in only one normal direction, which affects the shading of both triangles (faces).

As you can see, your question cannot be answered without additional information.

> **Comments:**
> **username_0**: Thanks, now I see the point. Maybe more sophisticated software like Blender, Maya, 3dmax, etc. has better vertices numbers depending on their use.  

---

