how to parse obj file?

This topic is 414 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

but something wierd happened.

in OBJ file, there're 254 vertices.

but in face section, it indicate 258th vertex.

I attach file here.

Share on other sites

There's a plane-object with 4 vertices at the beginning of the file:

o Plane.001
v -55.848103 -0.456518 59.626743
v 60.802990 -0.456518 59.626743
v -55.848103 -0.456518 -57.024349
v 60.802990 -0.456518 -57.024349
vn 0.0000 1.0000 0.0000

With that, there are actually just 258 vertices.

Share on other sites

I think that's plane not part of rock model..

Share on other sites
If you have a look. There is a wiki entry explaining the file format in great detail.

Share on other sites
I think that's plane not part of rock model..

Doesn't matter. See Wavefront Object specs pdf: https://www.cs.utah.edu/~boulos/cs3505/obj_spec.pdf

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.

Edited by vstrakh

• 11
• 19
• 12
• 33
• 9
• Forum Statistics

• Total Topics
631397
• Total Posts
2999835
×