script for grouping of meshs based on vertex order

228 views
Skip to first unread message

ThierryBaret

unread,
Mar 9, 2012, 3:49:33 PM3/9/12
to soft...@listproc.autodesk.com
Hello list,
 
I've got a little situation with a big quantity of meshs all identical as far as number of polys in each is concerned but they all have different vertex numbering so I can't copy UVs accross them.
 
Is there a way by scripting, to either reorder them identically or at least classify together the one that are ordered the same way?
 
Thanks for your help.
 
Thierry
 
 

ThierryBaret

unread,
Mar 9, 2012, 4:11:35 PM3/9/12
to soft...@listproc.autodesk.com
I forgot to say that all these meshes are orientated differently in space but have had their transformations frozen.
 
Thierry
 
 
----- Original Message -----

Martin yara

unread,
Mar 9, 2012, 10:08:18 PM3/9/12
to soft...@listproc.autodesk.com
Wouldn't be faster to just copy the uv with gator and fix manually those parts that didnt went well

myara

Stephen Blair

unread,
Mar 10, 2012, 6:22:27 AM3/10/12
to soft...@listproc.autodesk.com
Afaik you cannot renumber vertices

From: softimag...@listproc.autodesk.com [mailto:softimag...@listproc.autodesk.com] On Behalf Of Martin yara
Sent: March-09-12 10:08 PM
To: soft...@listproc.autodesk.com
Subject: Re: script for grouping of meshs based on vertex order

Wouldn't be faster to just copy the uv with gator and fix manually those parts that didnt went well

myara

winmail.dat

Christian Gotzinger

unread,
Mar 10, 2012, 9:13:30 AM3/10/12
to soft...@listproc.autodesk.com
I don't know about the scripting way of doing this, but in ICE wouldn't it be as "easy" as taking the polygonal description and the vertex positions, reordering them, and then hooking both arrays into a Create Topo to overwrite the old topology?

As far as the reordering process goes, I'd probably try using polygon positions because they are just about always unique. So take the first polygon position of your master object and find the same polygon position in the object that needs reordering. Using .PolygontoVertices you can find the relevant vertex indices and their positions. Do this for all polygons and build the reordered vertex arrays as you move along.

Christian Gotzinger

unread,
Mar 10, 2012, 10:11:11 AM3/10/12
to soft...@listproc.autodesk.com
It's actually much, much easier than I thought. I've attached an image + compound.

Chris
ICE-reorder-vertex-ids.jpg
Reorder Vertex ID.xsicompound

ThierryBaret

unread,
Mar 10, 2012, 10:54:05 AM3/10/12
to soft...@listproc.autodesk.com
Cool, Thank you Christian.
That's exactly what I had in mind. I can't test it now in my scene but I'm sure that's the simplest solution.
 
Thierry.
 
 
 
----- Original Message -----
Sent: Saturday, March 10, 2012 4:11 PM
Subject: Re: script for grouping of meshs based on vertex order

pet...@skynet.be

unread,
Mar 10, 2012, 11:23:01 AM3/10/12
to soft...@listproc.autodesk.com
Very nice Christian –
this would seem to handle arbitrarily complex meshes?
That could be handy when importing/exporting messes up pointorder.

Christian Gotzinger

unread,
Mar 10, 2012, 11:31:57 AM3/10/12
to soft...@listproc.autodesk.com
It should, yes.
However, I think it'll run into problems if the meshes have several vertices in the exact same position. If this case must be handled as well, the logic would have to be adapted to work off of polygon positions (like I initially thought) instead of vertex positions.

pet...@skynet.be

unread,
Mar 10, 2012, 12:10:59 PM3/10/12
to soft...@listproc.autodesk.com
I just tried it on this scene I was working, with a render-ready character. I received pointcaches from the animation supplier – but when applying them, the face turned into meatcake – I assumed they messed up pointorder.
My render version is in default pose – but the animated model, with pointcaches muted, isnt in default pose nor position – so I didnt have much hope.
using your compound, I pointed the renderversion to the animated version, it turned into meatcake, but when applying the pointcaches its all good!
now I’m really impressed!

Christian Gotzinger

unread,
Mar 10, 2012, 12:22:04 PM3/10/12
to soft...@listproc.autodesk.com
That's great to hear!
Just keep in mind that the compound completely rebuilds the topology, which means that you'll lose all vertex attributes your object had before you applied the ICE tree. It shouldn't be difficult to copy them over to the new topology by adding some additional logic to the compound (or even using Gator), but it's something to watch out for.

Stephen Blair

unread,
Mar 11, 2012, 9:08:15 AM3/11/12
to soft...@listproc.autodesk.com
Ah yes, well I meant you cannot do it without re-creating the topology...

My bad for not thinking in ICE !!!

From: softimag...@listproc.autodesk.com [mailto:softimag...@listproc.autodesk.com] On Behalf Of Christian Gotzinger
Sent: March-10-12 9:14 AM
To: soft...@listproc.autodesk.com
Subject: Re: script for grouping of meshs based on vertex order

winmail.dat

ThierryBaret

unread,
Mar 11, 2012, 9:52:00 AM3/11/12
to soft...@listproc.autodesk.com
Christian,
 
I confirm that it doesn't work if there are vertices with the same numbers in the master and the mesh to clean.
See attachment.
 
Thierry
 
 
 
----- Original Message -----
Sent: Saturday, March 10, 2012 4:11 PM
Subject: Re: script for grouping of meshs based on vertex order

test_ICEreordering.jpg

ThierryBaret

unread,
Mar 11, 2012, 10:29:32 AM3/11/12
to soft...@listproc.autodesk.com
If I change the test for PolygonPosition instead of PointPosition, the mesh with some vertices numbered like the master is not messed up anymore but the vertices index are wrong compared to the master. The same happens with the mesh that didn't have any vertices number in common with the master. It seems that doing the test with the polygon position doesn't create a topology with the same description. Maybe an additional test is necessary to create the same topo.
test_ICEreordering2.jpg

Christian Gotzinger

unread,
Mar 11, 2012, 10:56:22 AM3/11/12
to soft...@listproc.autodesk.com
Hi Thierry,

I just checked this case and can't reproduce the problem. Can you verify that the Find in Array has a small Epsilon value set? If the Epsilon is 0 it never finds the point positions.

ThierryBaret

unread,
Mar 11, 2012, 11:13:11 AM3/11/12
to soft...@listproc.autodesk.com
Hhmm, strange. I've got an epsilon of 0.001 in the Find in Array node.
Could you send your repro scene script so that I can try the very same manip and see if I get the same result?
Thanks Christian,

Christian Gotzinger

unread,
Mar 11, 2012, 11:36:08 AM3/11/12
to soft...@listproc.autodesk.com
I think it would make more sense for you to send me the objects on which the compound fails.
However, there is another possible explanation: Can you make sure that your objects are offset only via SRT? If you have moved the vertices, the point positions can't be found. It'll only work if you have moved the entire object via SRT.

To rule this out, you can place both objects right on top of each other, freeze their transforms, then apply the ICE tree.

ThierryBaret

unread,
Mar 11, 2012, 11:39:21 AM3/11/12
to soft...@listproc.autodesk.com
aahh, ok I've found the problem.
My central mesh had it's centre transfo resetted, when I do a center to vertice on it and put my IceOp above in the stack it works.
However I still can't get the models (not a grid)  that I really want to reorder to work, probably a mistake on my part somewhere.
 
Thierry

ThierryBaret

unread,
Mar 11, 2012, 12:02:18 PM3/11/12
to soft...@listproc.autodesk.com
The meshes I'm trying to reorder are coming from a single mesh that has been splitted with separate in Maya. Each mesh has got the same number of polys and are spread out in space but each mesh is not an exact clone copy of the next, vertices change slightly in position in relation to its own mesh.
 
So for your compound to work, I would need to get the model I want to reorder do a copy of it, ten on the copy do a center to vertices with all the vertice of my mesh to order selected, then a match transform to the master mesh, then snap every vertice to those of the master.
Then finally apply your compound and re-match transform to the original messed up mesh and re-snap each vertice of the reordered mesh to the original positions of the vertices of the messed up mesh.
 
Because what i want is only reorder the vertex of eachsplitted mesh but keep the vertex positions as they were originally, meaning all slightly different from the master's vertex positions.
 
I don't know if I make myself clear but anyway, your compound works it's only that I'm trying to do too much with it.
Reply all
Reply to author
Forward
0 new messages