Topology walking

Has anyone done this before? Walk geometric topology and make a match to a second mesh?

In cases where UVs don’t match and only topology is identical, it seems entirely possible to build an index map from one mesh to another and then perform whatever operations you need.

I’m struggling with the topology walking part though, it’s not something I’ve ever had to tackle before so it has left me spinning each time I sit down to figure it out.

There is a script called morphfix but it doesn’t work well in new versions of max - I will try to contact the author in case they have some hints for me.

I’m happy to receive any advice or ideas -

:slight_smile:

This wouldn’t be topology walking per se, but if the vertex positions are identical (or very similar), you could use a brute force algorithm to match up vertex IDs by position. Unfortunately, I’m guessing from your post that this is not the case.

You have two options:
1- If the verts are identical or very close, you can use a ray mesh grid intersect (or whatever the voxel accelerator is) to find the closest matching vert between two meshes. This is pretty simple when you are familiar with RMGI and have some libraries for working with it.

2- If the topology is identical (number of verts, edges between verts), you can basically pick two corresponding verts on each mesh that make an edge, and use that to walk the topology. There was an ubisoft video at the Autodesk area from 2008 or 2009 about it.

Basically, if you have two corresponding edges and identical topo, you can, say, walk around one of the verts clockwise, and the edges all correspond. You would just branch out from there- it sounds a bit like it’s impossible but it makes perfect sense when you think about it. The algorithm can be a bit tricky but the concept is quite simple.

Thanks guys,

The position match is already done - thanks for the idea though, it can be useful but for faces proportional changes cause a fair bit of haywire as you can imagine.

We also have made project world pos from uv pos to enable similar workflow as maya - max’s native projection does not cover this particular method. This works for a lot of cases too.

Rob’s option 2 is the one I am after. I will have to check the consistency of the getedgesbyvert return value, whether it is in a conisten order etc. otherwise I am not sure how to know what I am getting is clockwise of the starting edge.

I’ve already drifted down the dot product route to compare which edges are relatively closest to each other for every vert and somehow figure it out that way. Immediately you lose the idea of the real topology, it becomes about position as much as topology.

The description for 2 is reat Rob - I will go and tinker and see if I can get something going. I’ll post back here with progress anyhow. :slight_smile:

Unfortunately you will need to use the direction of the edges to order them consistently. Fortunately the only way this can be very wrong is if you have some crazy ass geometry, and I imagine you could assign some sort of ‘probability’ and eventually calculate low-probability verts once high-probability ones have been calculated.