I am writing a python script that parses a 3D model file from one format to another and noticed a problem when storing vertices. It seems like the same vertex could have different UV’s in different faces.
While writing the script I assumed all vertices would have unique UV’s, but now it seems like a false assumption.
Is there a general way to store faces and vertices?
It would’ve been nice if I had a dictionary for vertices that stores UV’s, normals, and coords (won’t be storing anything else for now) and a dictionary of faces that contain a list of vertices that make up the face, but it won’t work if a single vertex takes on different UV values in different faces.
I’ve been trying to avoid storing every single vertex (like storing the vertices with the faces rather than having references to the vertices) but can’t come up with a workaround.
If the vertex belongs to a shared edge between two faces, you need to store texture coordinates of both faces. I usually store these info at triangle level not at vertex level.