Wed, Nov 20, 12:01 AM CST

Renderosity Forums / Poser Technical



Welcome to the Poser Technical Forum

Forum Moderators: Staff

Poser Technical F.A.Q (Last Updated: 2024 Nov 13 12:50 am)

Welcome to the Poser Technical Forum.

Where computer nerds can Pull out their slide rules and not get laughed at. Pocket protectors are not required. ;-)

This is the place you come to ask questions and share new ideas about using the internal file structure of Poser to push the program past it's normal limits.

New users are encouraged to read the FAQ sections here and on the Poser forum before asking questions.



Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: Do we know how PMD files are encoded?


odf ( ) posted Thu, 29 July 2021 at 12:14 AM · edited Tue, 19 November 2024 at 11:26 PM
Online Now!

Greetings Poser Technicians!

Imagine I wanted to write a tool that can read PMD files and do something exciting with them. Would I have to reverse engineer the format from scratch, or is it documented somewhere? Thanks!

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


adp001 ( ) posted Thu, 29 July 2021 at 5:20 AM

4 years ago I made this:

https://sharecg.com/v/89075/gallery/8/Script/PMD-File-reader-writer-WIP

It's not complete. But enough to read/write morphs or create complete PMD files from scratch. Maybe you want to extend it?




odf ( ) posted Thu, 29 July 2021 at 5:42 AM
Online Now!

Cool, thanks for the link! If I end up extending it, I'll be sure to let you know. At the moment, I'm mostly interested in converting between PMD-based injections poses and ones with embedded deltas.

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


adp001 ( ) posted Thu, 29 July 2021 at 5:49 AM

odf posted at 5:47AM Thu, 29 July 2021 - #4424126

Cool, thanks for the link! If I end up extending it, I'll be sure to let you know. At the moment, I'm mostly interested in converting between PMD-based injections poses and ones with embedded deltas.

This is what my script was made for :)




primorge ( ) posted Thu, 29 July 2021 at 2:00 PM · edited Thu, 29 July 2021 at 2:05 PM

Free is nice. There's also a nice paid option for this. It's an external application that runs fine in windows 10. I use it quite a bit, fully featured and works great. Also writes both pmd and standard embedded INJ pz2 files... and a host of other handy operations.

https://www.renderosity.com/mod/bcs/binary-morph-editor/51221

20210729_145421.jpg20210729_145546.jpg


adp001 ( ) posted Thu, 29 July 2021 at 3:11 PM

@primorge: Did I miss something or where is the source code for the Binary Morph Editor?

odf wrote he wanted to know how PMD works to make his own script. But this does not work with a compiled script.




primorge ( ) posted Thu, 29 July 2021 at 3:26 PM

Apologies ADP. You didn't miss anything, it was my oversight. I totally missed that part. I have a tendency to jump the gun when it's a topic that interests me. I'm also pretty good at interrupting people mid conversation, as many an ex girlfriend will attest.

Again apologies.


odf ( ) posted Thu, 29 July 2021 at 7:02 PM
Online Now!

@primorge: I think I have a whole suite of Dimension3d tools from way back, probably including the BME. Not sure if I'm still eligible for updates but I can try. Could still be useful if I wanted something done quickly.

But yes, the point of my question was to have something I can use in my own scripts, so that I can tweak it how I want it and when necessary combine several processing steps into one script instead of having to juggle multiple tools. I have code that can read and write Poser files, search and replace nodes within them and so on, but so far I didn't have anything to handle PMDs.

@adp001: Without having looked at your code yet, I was wondering if it also covers subdivision morphs (I have no idea when those were introduced). If it doesn't, I could have a go at finding out how to support them.

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


adp001 ( ) posted Fri, 30 July 2021 at 5:14 AM

No subdivision and still Python 2.7. I didn't touch it for the last 4 years, because it did what I made it for and nobody else gave feedback or requested something. Wouldn't be bad if Poser's subdivision would be accessible for Python. And I know: You can do it :)

If things would get a bit more lively around Poser, I would do something for it again. At the moment I only play around with it from time to time. I still have a lot of Python code lying around. Many started projects.

There is for example a project to make morphs for Poser in Blender. The figure is morphed and posed in Poser and then passed to Blender as a monolithic mesh. In Blender you can edit the mesh as you like and then pass it back to Poser (data exchange via OBJ file). The difference between the two files (output from Poser to Blender and vice versa, each as an OBJ file) then results in a morph that is applied to the figure. This works great so far, is fast, straightforward, and makes for a smooth workflow. If you could also use it to produce hires morphs, that would be great. I would then also rework the UI significantly :)

Here is a link to the sourcecode: https://adp.spdns.org/OBJ_ImExport_WX.zip

file_a97da629b098b75c294dffdc3e463904.png




odf ( ) posted Fri, 30 July 2021 at 5:31 AM
Online Now!

That sounds great. I'd been wondering about the best workflow for making morphs in Blender. I did some that I loaded into DAZ, which worked fine until it didn't. A workflow that didn't require me to remember all the correct scale factors and checkboxes when exporting and importing would be amazing.

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


primorge ( ) posted Fri, 30 July 2021 at 6:37 AM · edited Fri, 30 July 2021 at 6:37 AM

ADP's script does what PML does, which I use constantly. Makes creating JCMs and "layered" morphs a snap. When I say layered I mean morphing over top of already dialed in morphs and having a seperate dial for the resulting morph without having to subtract the already existing morphs. If that makes sense. For instance you can have a character face morph dialed in and exported, morph an expression or detail over that, reimport, and have a working dial that won't cause the underlying morph "doubled". In other words a post transform morph.

Morphing in blender for Poser sized figures is easy. The important thing are the import export options. These are under the Geometry section of the import dialogue.

For import uncheck split by object and select the Keep Vert Order

For Export, likewise check Keep Vertex Order

There's no need for scaling the Poser figure in blender in order to morph. The brush and tool falloff gizmos work fine on Poser scale objects. You might want to adjust the viewport camera settings. Press N and adjust the settings under the view tab. Focal length, clipping, etc.

Also, I've never found the need to adjust or move the cursor to work on a specific area, simply select the polys or obj your working on and press the dot button. This will zoom focus to the area, adjust via navigation shortcuts or the navigator gizmo to taste.


primorge ( ) posted Fri, 30 July 2021 at 8:20 AM

Also. If you can manage to incorporate Poser subdivision into that exporter in a functional way you'll have discovered the holy grail. I'd pay good money for that. I imagine it's a task because the only exporter I've heard of to do such a thing is GoZ.

Crossing my fingers on that one.


adp001 ( ) posted Fri, 30 July 2021 at 8:54 AM

Beside of that, I had plans to export Posers materials to Blender (didn't work on it further because I don't do mutch Poser). Posers Cycle implementation is just a subset of "the real one" in Blender. And Blender renders mutch faster than Poser (even P12). Because Posers materials are just a subset of what we have in Blender, it shouldn't be so hard to convert them.

Next step would be a seamless conection between Poser and Blender via network (to be able to use external machines).




primorge ( ) posted Fri, 30 July 2021 at 11:25 AM

"Also, I've never found the need to adjust or move the cursor to work on a specific area, simply select the polys or obj your working on and press the dot button."

Small correction I meant dot Key here. Not button lol. Big difference. Anything I post before work in the morning is typed without coffee and getting dressed, and usually running late ;)


odf ( ) posted Fri, 30 July 2021 at 8:06 PM
Online Now!

The dot key is the bee's knees. Before I discovered it, I felt like I was very close to pulling out my hair in bunches.

I looked at a scene file including subdivision morphs, and they seem to be stored as regular deltas with an extra attribute specifying which subdivision level they belong to. No idea how they are encoded in PMDs, but I hope by tweaking adp001's code I should be able to find out. The remaining bit is matching the subdivided mesh to the original, but I know how to go about that.

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


odf ( ) posted Tue, 14 December 2021 at 9:04 PM · edited Tue, 14 December 2021 at 9:05 PM
Online Now!

After all this time, I've finally gotten around to playing with adp001's PMD code. Not too much trouble converting to Python 3 so far.

One now needs to decode strings read from binary files in order to use them like regular Python strings, which is something I had not done too often and had to look up. Smooth sailing after that.

I tried the code on a very old PMD file that did not include UUIDs for morphs. I'm not sure how Poser itself handles the distinction, but only trying to read UUIDs if there's room between the end of the morph declarations and the first batch of morph data seems to work well enough.

Slightly off-topic, but relevant to how much time I spend on PMDs right now: has anyone checked if Poser can read pose files with embedded deltas for subdivision morphs? Because if it does, I think that's a slightly easier avenue for now for getting such morphs into Poser from external programs. If no one knows, I'll just try it myself.

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


adp001 ( ) posted Tue, 14 December 2021 at 10:13 PM

A Python 3 compatible version is on my website since last October.

https://adp.spdns.org/#LibPoserPMD




odf ( ) posted Tue, 14 December 2021 at 10:18 PM
Online Now!

👍

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


odf ( ) posted Wed, 15 December 2021 at 7:54 PM
Online Now!

So, I think I've figured out how subdivision morphs are encoded in PMD files. That means the next order of business will be a decoder so that I can cross-check with the data in the scene file. After that an encoder, and then the real fun begins...

@adp001 Did you reverse engineer the PMD format from scratch, or did you find documentation somewhere. Asking for a friend. 😄

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


primorge ( ) posted Thu, 16 December 2021 at 8:22 AM

sorry to interrupt... Can I ask where your subdivision/pmd coding explorations are leading? Subdivision morph capability not tied strictly to Poser/Zbrush perhaps? Just curious.


primorge ( ) posted Thu, 16 December 2021 at 10:17 AM

And I'm going to preemptively throw a selfish temporary tantrum if you achieve such sorcery and only make it Python 3 compatible :D


adp001 ( ) posted Thu, 16 December 2021 at 3:44 PM
odf posted at 7:54 PM Wed, 15 December 2021 - #4431905

@adp001 Did you reverse engineer the PMD format from scratch, or did you find documentation somewhere. Asking for a friend. 😄

Sorry, no documentation.

I remember that I started searching the net for PMD. And all I found for the keyword PMD was "MicoMicoDance". Here is a video with what you create with MMD:
 
https://www.youtube.com/watch?v=i1YSjN1tToU

Maybe that's where the original idea of the file format came from (considering what Poser was created for back then). But has as good as nothing more in common with it.




adp001 ( ) posted Thu, 16 December 2021 at 3:52 PM
odf posted at 7:54 PM Wed, 15 December 2021 - #4431905

So, I think I've figured out how subdivision morphs are encoded in PMD files.


After finishing my excursion "I-want-to-finally-know-how-wxpython-ticks", my Python editor is bored. So,  programming around and with HD morphs would be another thing I'd dig Poser out for again :)




odf ( ) posted Thu, 16 December 2021 at 6:40 PM
Online Now!
primorge posted at 8:22 AM Thu, 16 December 2021 - #4431931

sorry to interrupt... Can I ask where your subdivision/pmd coding explorations are leading? Subdivision morph capability not tied strictly to Poser/Zbrush perhaps? Just curious.

Yep!

primorge posted at 10:17 AM Thu, 16 December 2021 - #4431940

And I'm going to preemptively throw a selfish temporary tantrum if you achieve such sorcery and only make it Python 3 compatible :D

Is that a promise or a threat? 😄 Well, I'll be starting with a command line tool, so Python 3 only should be fine for that. You don't have to pay for Python 3 like you do for Poser 12. 😉 Once it works, I'll add 2.7 compatibility so that the code will work within Poser 11 scripts. Not sure I'll be making any of those myself, though. Hoping for adp001 or someone else to pick up that ball, to be honest.

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


odf ( ) posted Thu, 16 December 2021 at 6:49 PM
Online Now!

PS: I'll start a dedicated thread in this forum once I've got the PMD part sorted.

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


odf ( ) posted Thu, 16 December 2021 at 6:58 PM · edited Thu, 16 December 2021 at 6:58 PM
Online Now!
adp001 posted at 3:44 PM Thu, 16 December 2021 - #4431967

Sorry, no documentation.

That's a shame. I do not like puzzling out binary file formats. But well, it looks as if I've figured this one out now, thanks in no small part to the work you'd already done.

I remember that I started searching the net for PMD. And all I found for the keyword PMD was "MicoMicoDance". Here is a video with what you create with MMD:
 
https://www.youtube.com/watch?v=i1YSjN1tToU

You know it's Japanese because of the expert work on the jiggly bewbs.

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


primorge ( ) posted Thu, 16 December 2021 at 10:50 PM · edited Thu, 16 December 2021 at 10:53 PM

It's Miko Miko Dance, not Mico Mico. There's also a very nice format importer and utility for Blender called Cat's Plug In that's useful for translating the models to Blender's environment (and by extension closer to Poser)... Also Vroid Models and XNALara, etc. There's quite a bit of PMD discussion in MMD circles on the web so maybe it IS the same thing. Only other place I've seen it also.

https://github.com/absolute-quantum/cats-blender-plugin

OT but... If you want to go down an interesting posing and manipulation software rabbit hole check out XNALara. Of course ripping game models is shady but you can find them easily enough on DA if you're curious and just want to pose and play around and look at how they are modeled and rigged. Notable that they can also be posed and exported as obj, basically perfectly with textures...  But that would be wrong lol. I won't link you to XNALara, if you're curious you'll have to dig that up yourself.


MmhSO0YzABR0n9wsa8zgOhCn0m1Bat9HigaBFGE4.png

AdnY0czupHVjXErJxsK2ePTj7vCDMDEyIiYi9vMa.png


adp001 ( ) posted Fri, 17 December 2021 at 5:41 AM
primorge posted at 10:50 PM Thu, 16 December 2021 - #4431994

It's Miko Miko Dance, not Mico Mico.

Yes, sorry, you are right. Was really late here yesterday as I wrote this.

But quite an unusual name for a software, isn't it? Maybe another hint to the Japanese ancestry (beside of the "expert work on the jiggly bewbs") :)




adp001 ( ) posted Fri, 17 December 2021 at 5:48 AM
primorge posted at 10:50 PM Thu, 16 December 2021 - #4431994

https://github.com/absolute-quantum/cats-blender-plugin

The structure is similar. That's probably true (I looked at the code). But it's also not unusual because the data is organized in a format that has been popular among C programmers for decades. Simplified:  [<number of entries in total>][<[string length>, <string name>, <pointer to data package>], [...], ...]. In between a few things you have to guess without docs. For a morph, the structure of a data pakage is obvious (vertices).

But it is interesting to see that MMD has a more active and obviously larger userbase than Poser.




adp001 ( ) posted Fri, 17 December 2021 at 6:00 AM

Your posted Blender Screenshot:

Pretty much the first thing I came across in my search for models for Blender was Smutbase. They use G8 models quite brazenly. And I have to admit that I did the first experiments in Blender with them before I installed "the other software" and spent a few hundred dollars on content.




adp001 ( ) posted Fri, 17 December 2021 at 6:07 AM

odf posted at 6:40 PM Thu, 16 December 2021 - #4431977

Hoping for adp001 or someone else to pick up that ball, to be honest.
Sure I will.

What about a nice wxPython interface right from the start (Python 2/3)? Just tell me what you need and how it should look like. "There are no limits except imagination" :)





primorge ( ) posted Fri, 17 December 2021 at 6:12 AM · edited Fri, 17 December 2021 at 6:13 AM

The Blender Screen Shot is the Jill Valentine model from the Resident Evil 3 Remake game from Capcom. I found it translated to OBJ format via some model sharing site, a popular one I think. Model is entirely Tris, and easily more beautiful than anything I've seen made for Daz or Poser. Game companies like Capcom, which pour millions into production budgets, hire the very best modelers and texturers. Plus use scanning. I'm also stunned how beautifully rigged Game Figures are. The jill model has hundreds of facial rig controllers. The things truly are Works of Art.


Apologies for the hijack.


adp001 ( ) posted Fri, 17 December 2021 at 11:15 AM

primorge posted at 6:12 AM Fri, 17 December 2021 - #4432004

The Blender Screen Shot is the Jill Valentine model from the Resident Evil 3 Remake game from Capcom.

There is also a version based on G3 (as far as I know) on Smutbase (easy to find with google). Just search for "Jil". Best version from user "Mustard".

Compare this picture with your model:

https://ams1.files.sfmlab.com/content/content/image/gjdgqo.jpg?AWSAccessKeyId=YALKTSWDUPLBGUZZ&Signature=kAwn%2BAQ%2BJK7cjd8Ka35%2FyRn5o5E%3D&Expires=1639803612




primorge ( ) posted Fri, 17 December 2021 at 12:12 PM · edited Fri, 17 December 2021 at 12:14 PM

Will do, when I get home. Thanks for the link... Though it's a rabbit hole I'm not sure I want go down lol. Perhaps it's a 3d wrap of the genesis figure?

https://www.russian3dscanner.com/

Or the same algorithm via Zwrap...


odf ( ) posted Fri, 17 December 2021 at 3:38 PM
Online Now!

Anyway... 😁

I've got the PMD loader working and verified that the subd deltas it picks up match the data in the scene file. Might need to run a few more tests to make sure there aren't any funny edge cases it stumbles over, but I think basically it's done. The PMD writer is up next.

adp001 posted at 6:07 AM Fri, 17 December 2021 - #4432003

What about a nice wxPython interface right from the start (Python 2/3)? Just tell me what you need and how it should look like. 

Oh, thanks for the offer! But I think my initial proof-of-concept script might even be better off without a GUI. I was more thinking along the lines of adding subdivision morph powers to your OBJ_ImExport code.

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


adp001 ( ) posted Fri, 17 December 2021 at 3:38 PM

G3 and G8 comes free with Studio. So,where is the rabbit hole?

Since Diffeomorphic (the DAZ->Blender Bridge) is well known, almost any Blender user is using G3/G8 :) And DAZ knows that very well!




adp001 ( ) posted Fri, 17 December 2021 at 3:43 PM

odf posted at 3:38 PM Fri, 17 December 2021 - #4432024

Anyway... 😁

I've got the PMD loader working and verified that the subd deltas it picks up match the data in the scene file. Might need to run a few more tests to make sure there aren't any funny edge cases it stumbles over, but I think basically it's done. The PMD writer is up next.

adp001 posted at 6:07 AM Fri, 17 December 2021 - #4432003

What about a nice wxPython interface right from the start (Python 2/3)? Just tell me what you need and how it should look like. 

Oh, thanks for the offer! But I think my initial proof-of-concept script might even be better off without a GUI. I was more thinking along the lines of adding subdivision morph powers to your OBJ_ImExport code.

Fine! Whatever you think is best.

Congratulations on figuring it out so quickly. You are just the "Numbercruncher" :)




adp001 ( ) posted Fri, 17 December 2021 at 3:47 PM

@odf:

Monday at the latest I will be ready to work on it. Until then, I'm thinking about how to integrate this into an interface without people breaking their fingers or their heads when using it :)




odf ( ) posted Fri, 17 December 2021 at 5:09 PM
Online Now!
adp001 posted at 3:43 PM Fri, 17 December 2021 - #4432026

Congratulations on figuring it out so quickly. You are just the "Numbercruncher" :)

I've known this for a long time. It's the same in academia. I am Dr. Peter Pan, the postdoc who never wants to grow up.

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


odf ( ) posted Fri, 17 December 2021 at 7:17 PM
Online Now!

Okay, apparently I've got PMD reading and writing working. Poser happily loads my Antonia subdivision morph with the crunchy abs after it has been dissected and reassembled in Python. Huzzah! Now onwards to the geometry and pz2 crunching part and the other thread!

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


adp001 ( ) posted Fri, 17 December 2021 at 10:45 PM
odf posted at 5:09 PM Fri, 17 December 2021 - #4432033

adp001 posted at 3:43 PM Fri, 17 December 2021 - #4432026

Congratulations on figuring it out so quickly. You are just the "Numbercruncher" :)

I've known this for a long time. It's the same in academia. I am Dr. Peter Pan, the postdoc who never wants to grow up.

I'm not a number cruncher or an academic, but I can keep up with "never wants to grow up".

What would the world look like without those who never grew up?

No or slow progress.
Everything always the same.
Standstill.
Nothing would be broken and those who know how to fix things would be unemployed.

No, those who have not grown up are very important.





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.