Processing .obj files: why is it possible to have more vertex textures (vt) than vertices (v)?

I am working on a .obj handler in C ++. Importing data should not be a problem, but I do not understand why it is possible that .obj (for example, exported from a blender) has more "vt" entries than "v". If anyone could explain this to me, I would be very happy!

Thanks!

+5
source share
2 answers

The number of position, normal, and texture coordinates can be different, because two vertices can share a coordinate in the same space, but they differ from each other.

Think of a box (8 vert.) Using 6 different rectangular shapes (one per face) in the texture space →, which is 6 * 4 = 24 texture coordinates.

Edit: The overall uv map for the window looks lower (14 texture coordinates). I annotated three different vertices: A , B and C Note that in the rectangle, each vertex is adjacent to three faces, which should also be true in the uv map. C gets the texture coordinate, which is adjacent to the three faces, but B needs to be duplicated, and A tripled to do this.

Box-uv

+4
source

I found the source of the problem. I prematurely optimized my program and did not understand that the coordinates of the texture can have more than the coordinates of the vertices, due to the fact that the textures are displayed on the face and not on the vertex, so each vertex can have many texture coordinates associated with it, I hope Someone finds out about my mistakes.

Something that seemed strange to me, but initialized sf::RenderWindow before starting my .obj parser, led to no error messages being sent and the error message was reported in a completely different area than it was on really.

0
source

Source: https://habr.com/ru/post/1210391/


All Articles