0

So I have a list of faces from a single mesh. That mesh (lets call it "A") is the result of combining an unknown number of meshes (you can assume that the list of faces equals one or more whole meshes that make up "A"). I then use separate on the mesh which results in a lot of separate meshes. What would be the best way to know which of these meshes corresponds to the original set of faces?

TheBeardedBerry
  • 1,636
  • 5
  • 20
  • 30
  • The best idea I have so far is to assign vertex colors to the faces and then search for the vertex colors after the separate is done. – TheBeardedBerry Sep 29 '14 at 09:59

1 Answers1

2

@beardedBerry's solution usually works; the main likely problem is that some kinds of history will screw up vert colors when the mesh is split. You can use an extra UV channel in the same fashion, the UV's tend to be more survivable then the vertex colors, although (rarely) they too can go bad. Sigh.

If you want an analytical method, you can do it more or less like this:

  1. Grab every vertex's world space position. Convert these to a hash value (you can probably just use the hash of the xyz tuple for the vert.
  2. Loop through all the faces in the complete object, mapping faces to the 3 hashes for its vertices (you'll want to sort the 3 hashes to make sure they are in the same order)
  3. Split the object
  4. Repeat the process in 1 and 2
  5. Compare the dictionaries: each new object will be a subset of the original, and you'll be able to say 'face 7 in object 3 is face 250 in the original'
theodox
  • 12,028
  • 3
  • 23
  • 36
  • Coincident points will naturally cause problems, but otherwise this would work well – mhlester Sep 29 '14 at 16:59
  • Yeah, what i've done in the past is to include the face count in the vertex hash, which will make it slightly more survivable. I guess you could do a vertex-face hash instead by XORing all the vertex indices in the original geo... but... overkill until there's a problem :)\ – theodox Sep 29 '14 at 17:05
  • The mesh can be fixed beforehand, with renumber vertexes plug found in devkit. Or by detaching one face first then merge in. then color or calculate indexes they are now the same. The reconstitution tappens because the mesh has non native vertex order. So maya does 2 actions at once so its hard to see the order. But by fixing this first it eliminates the problem. Ps hashing works badly for points build a bsp tree. – joojaa Sep 30 '14 at 12:11