Wed, Apr 24, 6:11 AM CDT

Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2024 Apr 23 11:28 pm)



Subject: Here is a command line Python script that fixes vertex orders for morphs


odf ( ) posted Sat, 11 December 2021 at 2:20 AM · edited Wed, 24 April 2024 at 1:05 AM

If you're anything like me, you've messed up the vertex order countless times while trying to make morphs for Poser (or other programs we don't mention here) with external software. I feel like I have to treat the mesh like a raw egg, which is no fun. So I wrote a program to fix that years ago, but never shared it because I was in my Scala phase then.

Now I've made a Python version, which you are all welcome to use (also for that other program if you want): https://www.renderosity.com/filelocker/55818/download?key=8760

Just download the ZIP file as is, do NOT extract the contents (I mean, you can, but you don't need to), then run python on it. You need to Python 2.7 or 3.x plus numpy installed. The "-h" option tells you how to use, so I won't repeat that here.

As a little demo I took a figure with a famously prominent nose and gave her a cute little button nose in Blender, but I also "accidentally" flipped the mesh along the x-axis. Poser did not take that well (and it's built-in vertex-order correction did not help, either). On the left you see what happens if I load the resulting obj as a morph target and dial it to 0.5. On the right you see the fixed morph after running it through my script, also at 0.5.

C9bQCDThhzKjQ5iFtUYx1n6wnJtJYL8Dj5Z9P7ll.jpg

Fine print: currently meshes must be manifolds (no more than two faces per edge) with consistent face orientations. I think that's true for most actors in most of the common figures, but for example it is not true for Apollo's teeth, and it's probably not true for may clothe meshes. I'm working on an extended version that can handle such meshes, as well.

If you'd like to use the script from within Poser, please annoy a Poser Python specialist of your choosing. 😄

-- I'm not mad at you, just Westphalian.


odf ( ) posted Sat, 11 December 2021 at 2:31 AM · edited Sat, 11 December 2021 at 2:32 AM

PS: Part of the reason I'm posting this here is that I have no idea whether a command line script makes sense to put under Freestuff. Also, I think that making morphs in external software and problems with vertex orders, scaling etc. is a bit of broader subject, and I'm interested in any comments that may come up in that direction, as well. Mods, please feel free to move to a more appropriate place if you think this doesn't belong here.

-- I'm not mad at you, just Westphalian.


primorge ( ) posted Sat, 11 December 2021 at 6:30 AM

👍


Goldenthrush ( ) posted Sun, 09 January 2022 at 9:39 PM

I have a lot of conforming clothing turned to dynamic that gracefully fall to pieces and make me cry, but those are almost all conversions of various clothes I've done myself.  SO, just grab a few conformers with "bad dynamic" features (having pockets or ruffles) and see if they fall apart on being converted to objs.  :3  I would be SO grateful for something that fixed those pesky things because there's a lot of especially older conforming clothes that would benefit from being able to drape.  


Ken1171_Designs ( ) posted Mon, 10 January 2022 at 11:55 AM
Goldenthrush posted at 9:39 PM Sun, 9 January 2022 - #4433054

I have a lot of conforming clothing turned to dynamic that gracefully fall to pieces and make me cry, but those are almost all conversions of various clothes I've done myself.  SO, just grab a few conformers with "bad dynamic" features (having pockets or ruffles) and see if they fall apart on being converted to objs.  :3  I would be SO grateful for something that fixed those pesky things because there's a lot of especially older conforming clothes that would benefit from being able to drape.  

To fix things like pockets falling off during dynamic cloth sims, you just have to add them to the soft decorated group, and they will stick to the clothing. If the parts should not deform, like buckles or buttons, add them to the rigid decorated group, and that's all you need to do. However, if the mesh is split into separate body groups, just export it with the "weld" option, and they will become 1-piece again. Hope this helps. 


Y-Phil ( ) posted Mon, 10 January 2022 at 12:37 PM
Ken1171_Designs posted at 11:55 AM Mon, 10 January 2022 - #4433079

To fix things like pockets falling off during dynamic cloth sims, you just have to add them to the soft decorated group, and they will stick to the clothing. If the parts should not deform, like buckles or buttons, add them to the rigid decorated group, and that's all you need to do. However, if the mesh is split into separate body groups, just export it with the "weld" option, and they will become 1-piece again. Hope this helps. 

Interesting! thank you so much 😊


PhYl.


Win10 on i7 8700K@4.3Ghz, 64Gb, Asus TUF Gaming RTX 4070 OC Edition, 2x 2Tb ssd + 6+4Tb hd  + 1x 8Tb hd + 1 10T NAS, Poser 11, Poser 12  and now Poser 13 


Afrodite-Ohki ( ) posted Sun, 16 January 2022 at 6:55 AM

Oh BLESS, you have no idea how many times I forget to set the correct import options for Blender, only to find out later that I spent hours working on a morph in an ungrouped figure. Gonna try this as soon as I can.


Newbie question: how do I "run python on it"? LMAO!

- - - - - - 

Feel free to call me Ohki!

Poser Pro 11, Poser 12 and Poser 13, Windows 10, Superfly junkie. My units are milimeters.

Persephone (the computer): AMD Ryzen 9 5900x, RTX 3070 GPU, 96gb ram.


odf ( ) posted Sun, 16 January 2022 at 5:06 PM

Afrodite-Ohki posted at 6:55 AM Sun, 16 January 2022 - #4433346

Newbie question: how do I "run python on it"? LMAO!

It's a command line script, so you would probably have to install an external Python interpreter and run it from the command prompt. A bit lengthy to explain if you're not used to it.

In the meantime I've reacquainted myself a bit with the Poser Python API, so why don't I make a version that can be run from Poser? Shouldn't take too long.

-- I'm not mad at you, just Westphalian.


Afrodite-Ohki ( ) posted Sun, 16 January 2022 at 5:42 PM
odf posted at 5:06 PM Sun, 16 January 2022 - #4433365

In the meantime I've reacquainted myself a bit with the Poser Python API, so why don't I make a version that can be run from Poser? Shouldn't take too long.

That would be amazing!

- - - - - - 

Feel free to call me Ohki!

Poser Pro 11, Poser 12 and Poser 13, Windows 10, Superfly junkie. My units are milimeters.

Persephone (the computer): AMD Ryzen 9 5900x, RTX 3070 GPU, 96gb ram.


odf ( ) posted Sun, 16 January 2022 at 9:21 PM · edited Sun, 16 January 2022 at 9:22 PM

Okay, here goes nothing:

1) Download and unpack this ZIP file. This should create a folder named "pydeltamesh-main."

2) In Poser, select "Run Python Script..." from the File menu, navigate to the folder you have just created, then pick the subfolder named "pydeltamesh", and within that, the subfolder named "poser." There's a file named "fixVertexOrder.py," which is the one to run.

3) The script will now pop up a file chooser where you select the original OBJ file exported from Poser. After loading the file, it will pop up a second one where you select the morphed OBJ file exported from Blender or whichever modeler you used. It will then do some computations that could take less than a second or several minutes, depending on the mesh.

4) Once the script is done pondering the meshes, it will pop up a third file chooser in which you select the output file, again in OBJ format. I advice against overwriting one of the input files, in case your modeler messed up more than the vertex order or the script got confused by some other issue.

Hope that helps.

-- I'm not mad at you, just Westphalian.


odf ( ) posted Sun, 16 January 2022 at 9:41 PM

The be clear: the script does not care the least bit about what's going on in Poser at the time. It's just using Poser as its operating system, so to speak. The code for fixing the vertex orders could easily be incorporated into a morph loader, which would of course be far more convenient. But I have no ambitions to maintain a morph loader, so... 😄

-- I'm not mad at you, just Westphalian.


odf ( ) posted Sun, 16 January 2022 at 9:58 PM

Oh, and before I forgot: the Poser version has only been tested in P12 so far, because that's only version I have installed. In principle it should work in any Poser that supports numpy, but there's always a chance some little detail throws one off.

-- I'm not mad at you, just Westphalian.


primorge ( ) posted Sun, 16 January 2022 at 10:13 PM · edited Sun, 16 January 2022 at 10:18 PM

Afrodite-Ohki posted at 6:55 AM Sun, 16 January 2022 - #4433346

Oh BLESS, you have no idea how many times I forget to set the correct import options for Blender, only to find out later that I spent hours working on a morph in an ungrouped figure. Gonna try this as soon as I can.


Newbie question: how do I "run python on it"? LMAO!

Can I interrupt and point something out?

If you forgot to include polygroups in your export import process from Poser to Blender or vice versa... that's not a vertex or winding order problem. Which this script addresses. You won't be able to load as a FBM but unless you also forgot to include 'Maintain Vertex Order' in your import export process from Blender, you can still recover the FBM from an ungrouped export import...

"only to find out later that I spent hours working on a morph in an ungrouped figure."

Solution is to import the figure's grouped mesh from geometries into Poser as a prop and load your ungrouped Blender export onto the figure prop as a morph target. Doesn't matter if its ungrouped. Dial the resulting morph on the figure prop to 1 and export that as wavefront obj with 'include existing groups in polygon groups' checked and reload that export result onto the live figure version as Figure Menu: Load Full Body Morph. The prop from geometries will have the groups and you will have 'projected' the morph target from the single group prop onto the grouped prop during that process.

Vertex order problems result in mesh mangling explosions, whereas dumped polygroups will result in failed FBM on live figures... dead FBM dial.



primorge ( ) posted Sun, 16 January 2022 at 10:28 PM · edited Sun, 16 January 2022 at 10:29 PM

There's basically 3 types of Poser morph errors

Wrong Vertex Order: results in explosion, no notification. You could try attempt vertex order correction during second try import or use a correction script like odf's.

Wrong Number of Vertices: you won't even get past the notification. No result will load because of the mismatch

Loss of Polygroups: This is specific to figures, there is no pop up. Result will be a dead FBM dial with no dependencies present.


odf ( ) posted Sun, 16 January 2022 at 10:32 PM
primorge posted at 10:13 PM Sun, 16 January 2022 - #4433388

Afrodite-Ohki posted at 6:55 AM Sun, 16 January 2022 - #4433346

Oh BLESS, you have no idea how many times I forget to set the correct import options for Blender, only to find out later that I spent hours working on a morph in an ungrouped figure. Gonna try this as soon as I can.


Newbie question: how do I "run python on it"? LMAO!

Can I interrupt and point something out?

If you forgot to include polygroups in your export import process from Poser to Blender or vice versa... that's not a vertex or winding order problem. Which this script addresses. You won't be able to load as a FBM but unless you also forgot to include 'Maintain Vertex Order' in your import export process from Blender, you can still recover the FBM from an ungrouped export import...

Thanks for picking up on that, primorge! I completely overlooked the part about missing groups.

I have not mentioned this before, but the script can still be used to fix the missing groups. Just make sure to use a base mesh that has the groups.

-- I'm not mad at you, just Westphalian.


odf ( ) posted Sun, 16 January 2022 at 10:35 PM · edited Sun, 16 January 2022 at 10:39 PM
primorge posted at 10:28 PM Sun, 16 January 2022 - #4433389

Wrong Number of Vertices: you won't even get past the notification. No result will load because of the mismatch

The script will also fix that if the extra or missing vertices are isolated or if a complete "loose part" as Blender calls them is missing or added. For example the lashes are completely missing (not just partially missing) and everything else is intact.

ETA: Actually, I just remembered that if any of the "loose parts" is somehow damaged or modified in the morph, it will simply be ignored. So partially missing lashes will be treated like completely missing lashes.

-- I'm not mad at you, just Westphalian.


primorge ( ) posted Sun, 16 January 2022 at 10:50 PM · edited Sun, 16 January 2022 at 10:59 PM

Last note,

Which most are probably aware but just in case. Unless you're utilizing a dedicated exporter like GoZ or PML or similar, always work from the figure mesh in geometries rather than a figure export live from Poser. Single actor morph targets are fine from Poser but attempts at FBM from Poser scene will result in an unwelded mesh that's unworkable because of body part group splits. Poser unimesh is leading up to correcting this but as yet hasn't reached that degree of implementation.

Generally wrong vertex order problems result from welding or splitting the mesh, and sometimes translation errors. Wings3D is notorious for wrong number of vertices or vertex order problems, and seems to have gotten even worse in latest versions, it also does weird things with groups and will split a mesh into body part groups (often in unusual ways) even with static grouped imports from geometries. With Wings I found it best to morph on an ungrouped figure mesh and project the result as I mentioned earlier. Blender is a lot more forgiving. The 2 things that are most critical are do not split mesh and maintain vertex order, with polygroups being a strong third. I use PML to circumvent most of these issues but those first 2 are important regardless. PML could'nt care less about polygroups so I don't worry about it.


primorge ( ) posted Sun, 16 January 2022 at 10:54 PM
odf posted at 10:35 PM Sun, 16 January 2022 - #4433391
primorge posted at 10:28 PM Sun, 16 January 2022 - #4433389

Wrong Number of Vertices: you won't even get past the notification. No result will load because of the mismatch

The script will also fix that if the extra or missing vertices are isolated or if a complete "loose part" as Blender calls them is missing or added. For example the lashes are completely missing (not just partially missing) and everything else is intact.

ETA: Actually, I just remembered that if any of the "loose parts" is somehow damaged or modified in the morph, it will simply be ignored. So partially missing lashes will be treated like completely missing lashes.

I haven't tried your script. Haven't had a wrong vertex order explosion in years. I did have a strong hunch, after I posted, that your script might address additional problems... figured my post info might still be useful to someone... maybe.


primorge ( ) posted Sun, 16 January 2022 at 11:02 PM

Nice that you made the script 'run python script' friendly though... I still haven't got around to the second round of testing your SubD script. Tomorrow after work definitely.

👍


odf ( ) posted Sun, 16 January 2022 at 11:40 PM · edited Sun, 16 January 2022 at 11:41 PM

primorge posted at 10:54 PM Sun, 16 January 2022 - #4433393

I haven't tried your script. Haven't had a wrong vertex order explosion in years. I did have a strong hunch, after I posted, that your script might address additional problems... figured my post info might still be useful to someone... maybe.
Yeah, I hadn't mentioned the additional problems because I figured they had other workarounds. It only occurred to me after reading your comments that maybe my script is sometimes simpler to use than those other workarounds.

But of course there's nothing wrong with having a workflow that prevents problems in the first place. My script is more for fixing accidents, or special workflows that require weird mesh surgery. I came up with the method because back in the day in Wings3d I had to split the mesh in half in order to do symmetric editing, and then mirror and glue before export.

-- I'm not mad at you, just Westphalian.


infinity10 ( ) posted Mon, 17 January 2022 at 3:36 AM
Ken1171_Designs posted at 11:55 AM Mon, 10 January 2022 - #4433079
Goldenthrush posted at 9:39 PM Sun, 9 January 2022 - #4433054

I have a lot of conforming clothing turned to dynamic that gracefully fall to pieces and make me cry, but those are almost all conversions of various clothes I've done myself.  SO, just grab a few conformers with "bad dynamic" features (having pockets or ruffles) and see if they fall apart on being converted to objs.  :3  I would be SO grateful for something that fixed those pesky things because there's a lot of especially older conforming clothes that would benefit from being able to drape.  

To fix things like pockets falling off during dynamic cloth sims, you just have to add them to the soft decorated group, and they will stick to the clothing. If the parts should not deform, like buckles or buttons, add them to the rigid decorated group, and that's all you need to do. However, if the mesh is split into separate body groups, just export it with the "weld" option, and they will become 1-piece again. Hope this helps. 
IMPORTANT TIP 👍✅✅✅

Eternal Hobbyist

 


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.