简体   繁体   中英

How to identify the resulting meshes after separating an object

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?

@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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM