5 minutes tutorial : From Blender Hair Particles to Makehuman Hair


If you follow this tutorial correctly you will be able to create hair in Blender and have it exported as curves and finally as Makehuman hair within 15minutes! 5minutes!

You will need:

  1. Blender 2.49b (or lower? .. Blender 2.5xx or higher will probably not work)
  2. Makehuman nightly build
  3. This head template
  4. This python script
  5. Some creativity and patience!


  1. Open the head template I provided, the head template will look like this:

    head template

    With the head itself placed in the second layer. This will make us separate the created hair into the first layer and easily select them for export without selecting the head.

  2. Create Hair using Blender Particles and the head template I provided (this will ensure you that the hair will fit makehuman base model once you have exported it for use in makehuman). Just make sure you have Segments to at least 20 when making the hair.
    • You can use this video to learn how to create hair using Blender Particles

    It is advised to use weight paint and select the head area where you really want the hair to grow. This is how weight paint looks like. See the tutorial video linked above):

    growing hair on weight paint

    You can then apply vertex (as seen in the video tutorial) by going to Particle Systems -> Extras -> Vertex group and click on the (really) small button where the mouse is pointing in the figure below

    choosing vertex groups

    After applying vertex group, comb the hair and do your design as you please.

  3. After having your desired hair design

    In blender Window-Type selection select the Text-Editor as shown in the figure below
  4. Now open the python file in a text-editor and copy and paste it in your blender text-editor window or just paste the code shown below:
    import Blender
    from Blender import Scene, Curve, Object, Particle
    from random import randrange
    def exportAsCurves(file, guides, number):
    DEG_ORDER_U = 3
    # use negative indices
    M = min(len(guides),number)
    for j in xrange(0,M):
    n = randrange(0,len(guides))
    N = len(guides[n])
    for i in xrange(0,N):
    file.write('v %.6f %.6f %.6f\n' % (guides[n][i][0], guides[n][i][1],\
    #name = group.name+"_"+guide.name
    #file.write('g %s\n' % name)
    file.write('cstype bspline\n') # not ideal, hard coded
    file.write('deg %d\n' % DEG_ORDER_U) # not used for curves but most files have it still
    curve_ls = [-(i+1) for i in xrange(N)]
    file.write('curv 0.0 1.0 %s\n' % (' '.join( [str(i) for i in curve_ls] ))) # hair  has no U and V values for the curve
    # 'parm' keyword
    tot_parm = (DEG_ORDER_U + 1) + N
    tot_parm_div = float(tot_parm-1)
    parm_ls = [(i/tot_parm_div) for i in xrange(tot_parm)]
    file.write('parm u %s\n' % ' '.join( [str(i) for i in parm_ls] ))
    scn= Scene.GetCurrent()
    obj = scn.objects.active
    parts = obj.getParticleSystems()
    hairs = parts[0].getLoc()
    file = open("C:\hair.obj", 'w')
  5. If you press Alt-P, the hairs are saved as hair.obj file in your C: drive. This is a wavefront obj format and can be imported by makehuman. Better save it in your makehuman data folder afterwards.
  6. Make a copy of long.hair and long.png with the same name you saved your obj file in the data folder of makehuman (e.g. hair.hair or hair.png if your filename was hair.obj).
  7. Here is the exported hair in makehuman

    hair imported in makehuman

Note: If you want it in another directory or as another filename you will have to change line 35 of the code. Just remeber you cannot use long filenames or directories or names that have unicode non-ascii characters (sorry for the lack of tech-support, you will have to live with it as I have very little time to extend this). Also observe the number 300 in line 36, this number tells Blender to export 300 hair guides. If you want more hair guides to be exported for makehuman you need to increase this number.

This entry was posted in 3D Modelling. Bookmark the permalink.

12 Responses to 5 minutes tutorial : From Blender Hair Particles to Makehuman Hair

  1. blackblender says:

    wow! It’s great tutorial! I try it!

  2. jcapco says:

    thanks. Some of the images were from an older work and so you might wonder why some dont look from the same model. I will fix that as soon as I get the time. Though, the tutorial is valid whatever the images be πŸ˜›

  3. blackblender says:

    I see. It looks forward.
    I would to put movement on Makehuman by using BVH. I am challenging now.
    Your tutorial was seen, and I was touched off. I also extrapolate the results. And, I would to make the tutorial that you wrote.

  4. blackblender says:

    Now I try your tutorial, No.6 . Alt-p is not only “P” .
    nurbs curves is very good!

  5. jcapco says:

    Thank you for your correction blackblender πŸ™‚
    I corrected Step 6.

    Yes.. curves rock! πŸ˜€ hehe. I see that the hair in the last step looks as if its colliding a bit with the head in makehuman. So converting hair to curve will cause a bit of collision. I will soon write a collision correction script πŸ™‚ For the moment you can edit the curves in blender manually to reduce collision before exporting it as .obj

    The hairs arent yet renderable by aqsis renderer in makehuman, I will correct that in a week or two and I will post some new renders with some help from Manuel πŸ™‚

  6. david says:

    i couldnt get this to work. i created my own .png image copied long.hair and exported my hair mesh correctly and it loads the long hair instead of my hair. u know y

  7. jcapco says:

    To find out why we need to have several question answered..
    What makehuman revision are you using? Supposing that temp.obj is the name of your .obj export. Then you have to name your .png as temp.png and the long.hair copy should be called temp.hair and they have to be in the hair data folder of makehuman, did you do that correctly? Are there any errors appearing in makehuman console output? if so, could you post it in the comments here?

    • david says:

      im using alpha 5, i named my hair test2.obj, i copied long.hair and renamed it test2.hair, and i named my png image test2.png. it shows up but when i select it theres no hair. no errors in the console. they r in the correct folder. anything wrong or not right?

  8. jcapco says:

    Yes. You need to have the latest nightly build (not makehuman alpha 5) to be able to use this feature. The ability to use wavefront obj format for hair was not introduced in alpha 5. The nightly builds have them. They are unstable builds (i.e. they may have bugs or somethings may not be working), but they have the new features that is mentioned in this tutorial.

  9. Pingback: Grouping Hairs to Render in Makehuman | Jose's Blog

  10. LJM says:

    Wow, I must have spent 2 hours hunting around for how to limit hair to a vertex group. I looked at the manual and various tutorials, but could not get it to work. Thank you for clearly pointing out (as you mention) the “really small” button for vertex groups on the Extras tab! πŸ˜‰

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s