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:
- Blender 2.49b
- A hair .obj file designed for makehuman (they are just .obj curves)
- This head-template head template
- This python script
The steps are:
- Open the head template in Blender
- Import desired hair (.obj format) (to see how check my previous blog)
- Now open the python file in a text-editor and copy and paste it in your blender text-editor window
- Select the hair strands you want in a group (you can select more than two)
- Group the selected hair strands by pressing Ctrl-G
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).
- Keep on making more groups until you are satisfied with the guide groupings and the number of groups you want to make
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')
file = open("C:/temp/hair1.obj", 'w')
- 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.