Thomas An
Thomas An

Reputation: 533

In OBJ files can v/vt/vn ever be different numbers?

The format specifies that faces are represented as:

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

Using v, vt, and vn to represent geometric vertices, texture vertices,
and vertex normals, the statement would read:

 f v/vt/vn v/vt/vn v/vt/vn v/vt/vn

Is it EVER the case that a triplet is non uniform such as 1/2/1 ?

(I am a little confused because openGL uses a single index array, but OBJ uses three indexes as if multiple index arrays are allowed somewhere ?)

Upvotes: 1

Views: 1538

Answers (2)

genpfault
genpfault

Reputation: 52085

Is it EVER the case that a triplet is non uniform such as 1/2/1 ?

Yep. Negative values are also possible:

Referencing vertex data

For all elements, reference numbers are used to identify geometric vertices, texture vertices, vertex normals, and parameter space vertices.

Each of these types of vertices is numbered separately, starting with 1. This means that the first geometric vertex in the file is 1, the second is 2, and so on. The first texture vertex in the file is 1, the second is 2, and so on. The numbering continues sequentially throughout the entire file. Frequently, files have multiple lists of vertex data. This numbering sequence continues even when vertex data is separated by other data.

In addition to counting vertices down from the top of the first list in the file, you can also count vertices back up the list from an element's position in the file. When you count up the list from an element, the reference numbers are negative. A reference number of -1 indicates the vertex immediately above the element. A reference number of -2 indicates two references above and so on.

Upvotes: 2

Dietrich Epp
Dietrich Epp

Reputation: 213318

Yes, the indexes can be different. This is a line from the Wikipedia article:

f 6/4/1 3/5/3 7/6/5

Yes, OpenGL only supports one index array. This means that you can't just pipe the data through OpenGL without significant pre-processing first.

I believe that the format dates back to the 1980s, which predates OpenGL and certainly means that the files were visualized with software renderers, possibly on CPUs that are as slow as the connected memory. The world has changed.

Upvotes: 2

Related Questions