Grouping Hairs to Render in Makehuman

Introduction:
When we load hairs in makehuman, they are nothing other than loading Wavefront .obj curve format. These .obj hairs are stored under ./data/hairs directory of your makehuman directory. The content of the .obj files are only the hair “guides”. The hair guides are around 200-300 strands of hair. When rendering in makehuman, the rest of the hair (btw. around 10,000 in a human’s head) are interpolated by an internal algorithm in makehuman. The number of hair interpolated are called the children of the guides. The number of children is adjustable under makehuman’s rendering settings. There are two types of algorithm involved for makehuman hair interpolator (based on Nvidia reasearch papers). One of them is the clump interpolator, which roughly just interpolates a strand to more strands by surrounding it with more hair strands (user adjusts the radius of the clump). The other interpolator which is more realistic is the multistrand interpolator. The focus of this blog is the multistrand interpolator. This interpolator tries to extract the guide-groups of the hair .obj file and then interpolate more hair-strands between the guide groups. In this tutorial we show how to group the hair guides and save them for use in makehuman. The grouping of the hair has a significant influence on how the hair will be rendered in makehuman.

You will need:

  1. Blender 2.49b
  2. A hair .obj file designed for makehuman (they are just .obj curves)
  3. This head-template head template
  4. This python script

The steps are:

  1. Open the head template in Blender
  2. Import desired hair (.obj format) (to see how check my previous blog)
  3. Now open the python file in a text-editor and copy and paste it in your blender text-editor window

    Loaded Python Script

  4. Select the hair strands you want in a group (you can select more than two)

    chosen hair strands to group

  5. Group the selected hair strands by pressing Ctrl-G

    Grouping the strands

    Note that you do not need to group all the hair strands to be able to render it in makehuman. If makehuman finds a hair strand that is not grouped then it does not use the multi-strand interpolator on it (this strand is however still rendered).

  6. Keep on making more groups until you are satisfied with the guide groupings and the number of groups you want to make
  7. Now click your mouse in the text-editor of your blender and change line 32 to the appropriate (absolute) path and filename you want the obj to be saved. The script does not support too long filenames or unicode filenames. For windows users, make sure that you use slash instead of backslash when writing the path. For instance, if you want the filename to be “hair1.obj” and if you want it saved in “C:\temp”. I won’t provide support for unicode or long filenames, so please put up with this. You change line 32 from

    file = open("C:/temp/temp.obj", 'w') 

    to

    file = open("C:/temp/hair1.obj", 'w') 
  8. Execute the code by pressing Alt-P, make sure that your active window is Blender’s text-editor window (click your mouse in the window before pressing Alt-P).

That’s all for now. Soon I will post a render using this hairstyle. This hairstyle was contributed by workingprogress of the makehuman forum.

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

One Response to Grouping Hairs to Render in Makehuman

  1. workinprogress says:

    Thankyou for this explanation! I think it will be very helpful.
    I’ve been reading the blogs, and trying to catch up a little with whats new in Makehuman.
    (lots of exciting developments are taking place.) 🙂
    Thanks for your patience in trying to help me to get some of my hairstyles working with
    MakeHuman.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s