-1

Basically I want a way to export the uvs from one model to another as a part of our pipeline where rig and texture/lookdev models(created simultaneously) need to be merged I would like a solution other than importing the model into the scene and copying the uvset. Something like an xml export. Is there any way.

Thanks in advance

Gaurav
  • 21
  • 2

1 Answers1

1

You can't really do this precisely unless the meshes are topologically identical. You can do a decent, but not perfect job with something like this:

  1. for each triangle in the source model, derive a tangent space matrix. That's the matrix which converts the world space points of that triangle into the UV points of that face.
  2. for each triangle in the target model, see if it matches one of the triangles in the source. "Match" will mean "has the same three corners" regardless of order (assuming you can fix up your normals in a separate step
  3. Where source triangles have exact matches in the target triangles, apply a planar project that matches the tangent space matrix.
  4. where a target triangle doesn't have an exact match you'll have to guess; you can try finding the N closest matches and doing a weighted blend between all of their matrices or something like that - but it will be hacky
  5. This should be visually pretty close to the source, but all of the UV triangles will be disconnected; you'll need to merge coincident UVs to prevent seams.

It's a pretty non-trivial project, unfortunately.

theodox
  • 12,028
  • 3
  • 23
  • 36