0
$\begingroup$

I have a .obj file with accompanying .mtl file and texture files. I want to extract the coordinates of the seams on my mesh. I then want to plot these seams in a 3D matrix in Python. Is there a fast way to do that?

Further clarification: I have found a way recreate my mesh in my Python IDE using a library called Pymesh. I now want to plot the seams of my mesh (the ones that will give me the unwrap that I have in my texture files) in a 3D matrix as well. One way I could do this is to write a script that takes the edge points of all my UV islands, and then searches the .obj file for the 3D coordinates that they map to (and translate that into coordinates appropriate for my 3D matrix in Python). That will take a long time though - is there a faster way? I also asked this in the Blender StackExchange as I wasn't sure which was more appropriate.

Thank you!

$\endgroup$
2
  • $\begingroup$ "plot these seamns in a 3D matrix"? Can you give a short explanation what you understand as a "3D matrix"? $\endgroup$ Commented Nov 3, 2017 at 12:33
  • $\begingroup$ Yup! Essentially as voxels. So I'm imagining a 100x100x100 3D space. I would plot the meshes in that space. Then I would plot the seams in that same space, on top of the meshes. Is that clearer? $\endgroup$
    – ganesha123
    Commented Nov 3, 2017 at 17:47

1 Answer 1

2
$\begingroup$

A seam can be defined as a line along the mesh where the vertices are doubled each with different texture coordinates.

So that's what you should look for. The set of vertices where there is a twin in the same position with different texture coordinates.

Depending on how the obj file was built that will be simple if they didn't duplicate the position when a vertex became part of a seam. Or it's not as simple because you need to deduplicate positions again.

$\endgroup$
2
  • $\begingroup$ I unwrapped a cube in Blender into six islands to test out what you're using. I got 8 vertices but each was linked to 3 different textures, like so: f 1/1/1 2/2/1 3/3/1 4/4/1 f 5/5/2 8/6/2 7/7/2 6/8/2 f 1/9/3 5/5/3 6/10/3 2/11/3 f 2/12/4 6/13/4 7/14/4 3/15/4 f 3/16/5 7/17/5 8/18/5 4/19/5 f 5/5/6 1/9/6 4/20/6 8/6/6 Is this an example of the vertices having been deduplicated? (Because there is only one instance of each vertex but each is linked to several textures) $\endgroup$
    – ganesha123
    Commented Nov 3, 2017 at 20:29
  • $\begingroup$ @ganesha123 yeah, I dislike the obj format but this is the one thing it's decent for. $\endgroup$ Commented Nov 3, 2017 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.