Page 1 of 1

C++ reader to open .mhx2 files

PostPosted: Wed Mar 03, 2021 11:40 am
by jeanmilost
For a c++ project I want to create, I need a MakeHuman model reader capable to read .mhx2 files directly and to provide generic data which may be used in a renderer, in my case OpenGL. I know that the MakeHuman models are very well supported in 3D engines like Unity (I'm actively using both Unity and MakeHuman), but in my current case I need to write my code in c++ directly, with my own renderers.

I searched a lot for an existing reader, but I found none, unfortunately. So I decided to begin to write one by myself. And, well, it's working, but I think it could be better. However it's a first try.

I also tried to read the skeleton part, based on another of my projects, which reads DirectX files, and it should theoricaly work, but I never tested it, because I currently have no idea about how to include a generic, skeletal based, animation in my c++ code.

Also I found very few documentation about the .mhx2 file format, even if its content is commonly obvious, there are some tags that deserve additional explanation.

I would be interested to know about the following points:
- Are .mhx2 files a standard accepted by the MakeHuman community? Would this format be greatly modified, or restructured with time, in a such manner the older versions may become incompatible?
- Is there an existing and open-source c++ .mhx2 files reader which I may use for my purposes?
- Are other users or developers interested by a such project, and eager to help improve this reader?
- May the MakeHuman community be globally interested by a such project?

By the way, my project is available here:

Re: C++ reader to open .mhx2 files

PostPosted: Fri Mar 05, 2021 7:02 am
by joepal
MHX has largely been deprecated by MPFB, as the only use case for MHX so far has been importing to blender. MHX is no longer actively being developed. We keep a fork of it for backwards compatilbility and do the occasional bug fix, but that's the extent of it. We don't plan to actively remove it though, so it'll probably be around for the overseeable future.

To my knowledge, the only implementation of MHX is the one in the repo. I haven't heard of anyone trying to replicate it somewhere else.

If MHX works for you, then I guess it's not such a bad idea to use it. However, it might be more future proof and portable to go for collada or fbx. These paths would not be without their own set of problems vs MH though.

Re: C++ reader to open .mhx2 files

PostPosted: Fri Mar 05, 2021 8:15 pm
by jeanmilost
Thank you very much for these important info. To be honest I have already took a look on the FBX and Collada file formats before writing my reader. However they seemed more complex to work with, contrary to the .mhx2 files which exposed the data I needed directly.

Also, as I pretend to create open-source and cross-platforms projects, the idea to use something like the very closed Autodesk SDK chilled me. But I'm searching these days for alternative open-source and cross platforms FBX readers, and I'm finding interesting results. So I will probably use these file formats instead.

In all cases my source code will remain available for those may be interested by it. :)

Re: C++ reader to open .mhx2 files

PostPosted: Sun Mar 07, 2021 9:54 am
by joepal
FBX is a smelly swamp filled with slithering, incomprehensible and largely undocumented data structures. Unfortunately, it is something of an industry standard though. It is therefore often hard to avoid.

The upside of collada is that it is an open standard with decent documentation. It doesnt have the market share though.