Forum: Poser Python Scripting


Subject: Moving morphs between different figures

Cage opened this issue on Dec 20, 2006 · 1232 posts


Cage posted Wed, 20 December 2006 at 2:55 AM

...with different base meshes.  I'm  trying to see if I can port to V3 any of the Vicky 1 morphs over which I've sweated.  The attached script is a WIP which actually succeeds at transferring morphs between figures - to a surprising degree, considering my skill level.  (*cough* newbie *cough* math dunce *cough*)

But I have a couple of questions, and I'm hoping someone can at least point me toward learning resources.

Right now I'm finding the closest vertices between two meshes.  This is darned slow, as I loop though all of the verts in one mesh AND all of the verts in the other  - for each vert in the first.  Is there any method besides this which can be used to find corresponding (or near-corresponding) vertices?  38,000+ times 11,000+ is a lotta vertex comparisons when working with heads... and V1 is comparatively low-resolution, nowadays.

The script works fairly well going from a high-res mesh to a lower-res mesh, but the opposite effort results in jaggies in the final morph.  I need to know how to smooth the end result, or how to place vertices based on where they would intersect polygons, rather than moving them to match other verts.  Does anyone have any thoughts?

Finally, is there a way to find neighboring vertices in the same mesh, without looping through all of them once or more?  The only thing that seems to come close is the Polygon approach used by Ockham in a couple of scripts.  Umm.  Ideas?  Comments?

The attached script runs in P5, presumably in P6, I can't guess about P7.  Load two figures into a scene, then start the script.  Select the source figure, then the target figure, in the first listbox.  Then select an actor, then a morph, and click 'run'.  

Then wait... for about seven years... until the script has found the matched vertices for the corresponding actors.  It will save a data file with this information, so subsequent conversions are much faster.  (The data file will be placed in the poser.AppLocation folder, in case you want to get rid of it afterwards....)  The script will spawn a morph in the target figure's specified actor.  I've been testing with V1 and V3, as I said - the 'V3 to V2' version.  V3 to V1 offers problems with inner mouth meshes, but otherwise works well.  V1 to V3 gets the basic shape, but it's awfully ragged, with too many verts trying to piggyback on shared 'nearest' verts in the low-res source actor.  I'd like to improve this script, because I think it could be quite useful.  So please, if you have the know-how, let me know how.  :)

My apologies to anyone who looks at the code.  I'm a sloppy coder.  Yeeks.

===========================sigline======================================================

Cage can be an opinionated jerk who posts without thinking.  He apologizes for this.  He's honestly not trying to be a turkeyhead.

Cage had some freebies, compatible with Poser 11 and below.  His Python scripts were saved at archive.org, along with the rest of the Morphography site, where they were hosted.