0

In this .obj file:

o sometriangle
v 1 0 0
v 0 1 0
v 0 0 1
f 1 2 3

o somesquare
v 5 0 0
v 5 5 0
v 0 5 0
v 0 0 0
f 1 2 3   # HERE
f 1 3 4   # AND HERE

Do the marked lines refer to the vertices within their containing object, or are vertex numbers global?

Eric
  • 95,302
  • 53
  • 242
  • 374
  • Note to self - this may affect [three.js](https://github.com/mrdoob/three.js/commit/6d2fe7edd5b72554daa07215e6cf6663aaac66d8#diff-c95aa6af1ef517957bfbff6af39992f5R212) – Eric Jul 08 '14 at 22:24

1 Answers1

1

The OBJ specification states

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.

So this means that the vertices are indeed numbered globally, at least within the same file.

Gray
  • 2,333
  • 1
  • 19
  • 24