1
$\begingroup$

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.

// 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?

$\endgroup$
3
  • 2
    $\begingroup$ 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... $\endgroup$
    – pmw1234
    Jun 5 at 11:01
  • $\begingroup$ @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. $\endgroup$
    – bim
    Jun 5 at 11:30
  • 1
    $\begingroup$ You could qualify the number of vertices with something like "unique vertices". $\endgroup$
    – pmw1234
    Jun 5 at 11:40

1 Answer 1

1
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ Thanks, now I see the point. Maybe more sophisticated software like Blender, Maya, 3dmax, etc. has better vertices numbers depending on their use. $\endgroup$
    – bim
    Jun 5 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.