MakeHuman to Egg (Panda3D)

MakeHuman python API, python plugins, etc

Moderator: joepal

MakeHuman to Egg (Panda3D)

Postby Nick_Angel » Sun Mar 05, 2017 3:52 am

I was on the Panda3D forum and noted several people requesting help converting MH models to Blender then to EGG format for Panda3D. Wouldn't it be far more simplistic to go from MakeHuman directly to Egg format? Both are written in Python code and MH supports export plugins for python. I am not asking someone to reinvent the wheel, I did several searches for MakeHuman to Egg plugin and came up empty. I would like to hear back from anyone interested in attempting to create such a plugin and lending a hand.

Some may say to just convert to Blender and then to Egg. But that is an extra step and very messy having to deal with the layers, UV, and animation. Not to mention learning another program (unless you must) just to convert a file from one format to another.I believe Egg should be a direct export from the MakeHuman program.

Below is an example of a simple cube in EGG which can be read from any text editor. Unfortunately it is 183 lines long... I would have uploaded this as an attachment, but .EGG is not allowed.

CUBE.EGG
Code: Select all
<CoordinateSystem> { Z-up }
<Material> Material {
  <Scalar> diffr { 0.640000 }
  <Scalar> diffg { 0.640000 }
  <Scalar> diffb { 0.640000 }
  <Scalar> specr { 0.500000 }
  <Scalar> specg { 0.500000 }
  <Scalar> specb { 0.500000 }
  <Scalar> shininess { 12.5 }
  <Scalar> ambr { 1.000000 }
  <Scalar> ambg { 1.000000 }
  <Scalar> ambb { 1.000000 }
  <Scalar> emitr { 0.000000 }
  <Scalar> emitg { 0.000000 }
  <Scalar> emitb { 0.000000 }
}

  <Group> Cube {
    <Transform> {
      <Matrix4> {
        1.0 0.0 0.0 0.0
        0.0 1.0 0.0 0.0
        0.0 0.0 1.0 0.0
        0.0 0.0 0.0 1.0
      }
    }
   
    <VertexPool> Cube {
   
      <Vertex> 0 {1.000000 1.000000 -1.000000
        <UV> ORCO {
          1.000000 1.000000
        }
      }
      <Vertex> 1 {1.000000 -1.000000 -1.000000
        <UV> ORCO {
          1.000000 0.000000
        }
      }
      <Vertex> 2 {-1.000000 -1.000000 -1.000000
        <UV> ORCO {
          0.000000 0.000000
        }
      }
      <Vertex> 3 {-1.000000 1.000000 -1.000000
        <UV> ORCO {
          0.000000 1.000000
        }
      }
      <Vertex> 4 {1.000000 0.999999 1.000000
        <UV> ORCO {
          1.000000 1.000000
        }
      }
      <Vertex> 5 {-1.000000 1.000000 1.000000
        <UV> ORCO {
          0.000000 1.000000
        }
      }
      <Vertex> 6 {-1.000000 -1.000000 1.000000
        <UV> ORCO {
          0.000000 0.000000
        }
      }
      <Vertex> 7 {0.999999 -1.000001 1.000000
        <UV> ORCO {
          0.999999 0.000000
        }
      }
      <Vertex> 8 {1.000000 1.000000 -1.000000
        <UV> ORCO {
          1.000000 1.000000
        }
      }
      <Vertex> 9 {1.000000 0.999999 1.000000
        <UV> ORCO {
          1.000000 1.000000
        }
      }
      <Vertex> 10 {0.999999 -1.000001 1.000000
        <UV> ORCO {
          0.999999 0.000000
        }
      }
      <Vertex> 11 {1.000000 -1.000000 -1.000000
        <UV> ORCO {
          1.000000 0.000000
        }
      }
      <Vertex> 12 {1.000000 -1.000000 -1.000000
        <UV> ORCO {
          1.000000 0.000000
        }
      }
      <Vertex> 13 {0.999999 -1.000001 1.000000
        <UV> ORCO {
          0.999999 0.000000
        }
      }
      <Vertex> 14 {-1.000000 -1.000000 1.000000
        <UV> ORCO {
          0.000000 0.000000
        }
      }
      <Vertex> 15 {-1.000000 -1.000000 -1.000000
        <UV> ORCO {
          0.000000 0.000000
        }
      }
      <Vertex> 16 {-1.000000 -1.000000 -1.000000
        <UV> ORCO {
          0.000000 0.000000
        }
      }
      <Vertex> 17 {-1.000000 -1.000000 1.000000
        <UV> ORCO {
          0.000000 0.000000
        }
      }
      <Vertex> 18 {-1.000000 1.000000 1.000000
        <UV> ORCO {
          0.000000 1.000000
        }
      }
      <Vertex> 19 {-1.000000 1.000000 -1.000000
        <UV> ORCO {
          0.000000 1.000000
        }
      }
      <Vertex> 20 {1.000000 0.999999 1.000000
        <UV> ORCO {
          1.000000 1.000000
        }
      }
      <Vertex> 21 {1.000000 1.000000 -1.000000
        <UV> ORCO {
          1.000000 1.000000
        }
      }
      <Vertex> 22 {-1.000000 1.000000 -1.000000
        <UV> ORCO {
          0.000000 1.000000
        }
      }
      <Vertex> 23 {-1.000000 1.000000 1.000000
        <UV> ORCO {
          0.000000 1.000000
        }
      }}
   
   
    <Polygon> {
      <MRef> { Material }
      <Normal> {0.000000 0.000000 -1.000000}
      <VertexRef> { 0 1 2 3 <Ref> { Cube }}
    }
    <Polygon> {
      <MRef> { Material }
      <Normal> {0.000000 0.000000 1.000000}
      <VertexRef> { 4 5 6 7 <Ref> { Cube }}
    }
    <Polygon> {
      <MRef> { Material }
      <Normal> {1.000000 -0.000000 0.000000}
      <VertexRef> { 8 9 10 11 <Ref> { Cube }}
    }
    <Polygon> {
      <MRef> { Material }
      <Normal> {-0.000000 -1.000000 -0.000000}
      <VertexRef> { 12 13 14 15 <Ref> { Cube }}
    }
    <Polygon> {
      <MRef> { Material }
      <Normal> {-1.000000 0.000000 -0.000000}
      <VertexRef> { 16 17 18 19 <Ref> { Cube }}
    }
    <Polygon> {
      <MRef> { Material }
      <Normal> {0.000000 1.000000 0.000000}
      <VertexRef> { 20 21 22 23 <Ref> { Cube }}
    }
  }



I will get back to you when I have more information. I have asked for assistance at the Panda3D community as well. They can pitch in and help with this as well.
User avatar
Nick_Angel
 
Posts: 23
Joined: Fri Feb 24, 2017 12:19 am

Re: MakeHuman to Egg (Panda3D)

Postby joepal » Sun Mar 05, 2017 8:38 am

Looks like a low hanging fruit, as the file format seems simple enough.

I suggest you open a new issue at the bugtracker and attach examples there instead. That way, it'll remain in the roadmap too.
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4465
Joined: Wed Jun 04, 2008 11:20 am

Re: MakeHuman to Egg (Panda3D)

Postby Nick_Angel » Sun Mar 05, 2017 3:30 pm

Thanks Joepal, will do.
User avatar
Nick_Angel
 
Posts: 23
Joined: Fri Feb 24, 2017 12:19 am

Re: MakeHuman to Egg (Panda3D)

Postby badwolf » Sun Mar 05, 2017 7:13 pm

or if you want to solve this in a somewhat more elegant way maybe code up an MHX2 importer for Panda3d
badwolf
 
Posts: 272
Joined: Fri Feb 06, 2015 12:41 am

Re: MakeHuman to Egg (Panda3D)

Postby Nick_Angel » Mon Mar 06, 2017 1:56 am

badwolf wrote:or if you want to solve this in a somewhat more elegant way maybe code up an MHX2 importer for Panda3d


As it stands, the MHM files are tiny and very simple to edit. If you edit a model and save, you can open the save file in a text editor. Depending on how many changes you made to the default your file will vary in length. All the lines represent slider positions from 0 to 1 or -1 to 1. Although the model below is a male, the breast size and firmness are still present. Asian, African, and Caucasian values must sum total to 1.0. Other items such as clothing, hair, and teeth are represented by a code written in hexadecimal, while the material is followed by the same hex code and path to the texture.

Code: Select all
# Written by MakeHuman 1.0.2
version v1.0.2
tags male01
face forehead-temple-in-out -0.758000
face forehead-trans-depth-forward-backward -0.276000
face forehead-scale-vert-less-more -0.194000
face head-invertedtriangular 0.564000
face forehead-nubian-less-more -0.182000
gendered BreastFirmness 0.500000
gendered BreastSize 0.500000
macro Weight 0.094000
macro Gender 1.000000
macro Age 0.500000
macro Height 0.500000
macro Asian 0.330000
macro African 0.330000
macro Caucasian 0.340000
macro Muscle 0.282000
macro BodyProportions 0.500000
tongue tongue01 52ad91a3-caad-4e50-8c38-67634e5e789c
teeth Teeth_Base 8ed08ea6-e3ad-4d36-b8e7-c4e3836e66b7
proxy male1591 d7e4934e-daed-4ad5-a055-18c9cba487dc
hair mhair02 f81a4e9a-e3d7-4ecb-bdf0-16d7fd9070a4
eyebrows Eyebrow003 4089e4e3-b842-40f4-91a4-0686118f7535
eyes HighPolyEyes 2c12f43b-1303-432c-b7ce-d78346baf2e6
clothes suit01LRes 0fcc7c06-1d64-48ce-b7d6-c78acfcfcc77
clothes shoes02 8887caca-d6fb-4d73-af10-1d4fb740a936
clothesHideFaces True
background enabled False
skinMaterial skins/young_asian_female/young_asian_female.mhmat
material mhair02 f81a4e9a-e3d7-4ecb-bdf0-16d7fd9070a4 hair/mhair02/materials/male02_black.mhmat
material HighPolyEyes 2c12f43b-1303-432c-b7ce-d78346baf2e6 eyes/materials/brown.mhmat
skeleton game.json
subdivide False


This just resets all the sliders as you had them when you saved. One could just as easily say, "Let's merge Panda3D and MakeHuman together since they are both written in Python. It would be a massive project and I doubt it would be very beneficial. The Blender MHX already has a working plugin called "YABEE" which is fine for those who need to go that route. However what of those who want a more direct approach? It is almost akin to translating a document from English to French to Spanish, when all along you wanted was the Spanish document.

I never wrote a plugin so this will be a learning experience. Unless someone tells me otherwise, I plan to study both the Python plugin YABEE and the various plugins in MakeHuman located at /usr/share/makehuman/plugins/ My only question now is; How long do I count after I pull the pin and toss it? LOL
User avatar
Nick_Angel
 
Posts: 23
Joined: Fri Feb 24, 2017 12:19 am

Re: MakeHuman to Egg (Panda3D)

Postby joepal » Mon Mar 06, 2017 8:52 am

First note that MHM != MHX. MHX is an export format which is intended to be generic (it's JSON, much like the egg format), but which so far only has an importer in blender.

You can read the MHX2 source code here: https://bitbucket.org/Diffeomorphic/mhx ... at=default
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4465
Joined: Wed Jun 04, 2008 11:20 am

Re: MakeHuman to Egg (Panda3D)

Postby Nick_Angel » Thu Mar 16, 2017 7:49 am

Apparently they are having me toss this aside as I was told we need fully animated "rigs" attached to the models. Unless I am misinformed MakeHuman cannot a) animate the model and b) attach a animated armature from a BVH armature.
User avatar
Nick_Angel
 
Posts: 23
Joined: Fri Feb 24, 2017 12:19 am

Re: MakeHuman to Egg (Panda3D)

Postby joepal » Thu Mar 16, 2017 7:55 am

Not MakeHuman as such, no. You will need the wider MH-related context, ie makehuman + MHX2 + blender + makewalk.
Joel Palmius (LinkedIn)
MakeHuman Infrastructure Manager
http://www.palmius.com/joel
joepal
 
Posts: 4465
Joined: Wed Jun 04, 2008 11:20 am

Re: MakeHuman to Egg (Panda3D)

Postby Nick_Angel » Thu Mar 16, 2017 10:07 am

joepal wrote:Not MakeHuman as such, no. You will need the wider MH-related context, ie makehuman + MHX2 + blender + makewalk.


Thanks again Joe, they hired a graphics "expert" but he doesn't arrive until next month so they asked me to pitch in and sort out what I can. I will bring this up at today's meeting. While they are experts in programming and networking, something tells me they would not need a 3D expert if they knew everything. :D
User avatar
Nick_Angel
 
Posts: 23
Joined: Fri Feb 24, 2017 12:19 am

Re: MakeHuman to Egg (Panda3D)

Postby Tanny » Thu Mar 16, 2017 2:02 pm

joepal wrote:Not MakeHuman as such, no. You will need the wider MH-related context, ie makehuman + MHX2 + blender + makewalk.


Right, and even I have put these pieces together, in at least a primitive manner.

Nick, you should be able to assemble a collection of MH characters, import them in to Blender files, and then connect them to the BVH motion data files, which provide the automated animation. At the least you should be able to set the table for the coming 3D expert guy.

Here's a tutorial from a Blender pro that may help:

https://www.youtube.com/watch?v=kPYbdnPwHuQ

The video describes the entire process (makehuman + MHX2 + blender + makewalk) in a pretty easy accessible manner. There's a bit of diversion in the middle of the vid that can be skipped over.
Tanny
 
Posts: 60
Joined: Tue Aug 09, 2016 2:02 pm


Return to Python scripts

Who is online

Users browsing this forum: No registered users and 1 guest