This is not a step-by-step tutorial. I will nail down the main stages for creating hair for game characters using lots of images and some printscreens directly from the application used (Maya/Photoshop, etc). The idea for this tutorial came from the polycount forums; for the Dominance War II contest I joined the Polycount team and the folks there asked me if I can make a little tutorial about Varga's hair so here it is ...
This tutorial is about women's hair but the technique can work for men as well; it's just that I like long hair for women and my Dominance War II entry happened to be a chick. I can write countless words about the importance of the hairstyle and the effect that the hairstyle adds to the personality of the character; we pay a lot (especially women) for a hairdo and we spend a lot of time styling our hair, or at least I am (every day in the morning I have to spend a few minutes to put some gel/foam in my hair, it does not matter if I will stay all day long at home and no one will see me, it's just that I won't feel OK if I don't have my hair done) so I cannot stress it enough that the hairdo will reflect the personality of the character -- that it will add a strong touch to the mood.
Where do we find interesting hairsyles?
Well, there are a lot of sources for inspiration. First you have the Internet where you can find tons of cool pictures, then fashion magazines, entertainment mags (playboy will do the trick;-)) and a lot more ... people you see on the street ... for Varga's hair I was wandering around in a supermarket to buy some food and on a shelf I saw a box for tough gel, ultra strong or something ... and on the box there was a picture of a guy with his hairstyle in big clumps pointing in all directions that I liked a lot. This was before entering the Dominance War II competition. After I started drawing some concepts, I went into the same supermarket searching for that ONE box :) because I didn't manage to find it on the Internet so... I found it, took a picture and left.
Below are a few variations for the hairstyle, some of them will be covered in this tutorial.
There was a big problem concernig CG hair in the past, but now there have been some solutions developed that will render realistic hair. For cinematic characters where the polygon count or texture size and numbers do not matter so much, you have a lot of freedom and a lot of choices. But when it comes to game models, you will always be limited to a certain number of polygons and number/size of the textures used. Realistic hair solutions that have been adopted for some time, is to use textures with alpha (transparency). The problem is that the geometry mapped with transparency textures will add more computations to the render process and if you have some planes that will intersect and that have transparency textures, it will be even worse; depending on the rendering engine there will be problems with the sorting algorithm (even at version 8.5 Maya still has problems with transparency sorting when using high quality renderer in the viewport, the default opengl renderer works fine -- there is a polygon transparency sorting option that does the trick but when it comes to the highQ renderer, problems will arise ...) so geometry with transparency is tricky. Some of the engines I did models for required that the geometry mapped with transparency textures will not self-intersect. There is some sort of confusion regarding the terms alpha and transparency ... alpha is a separate channel in Photoshop channels window, but transparency is available for each of the red, green and blue channels and cannot be edited directly in Photoshop except only through using the paint/erase brushes on the red/green/blue channels. These are the correct definitions for alpha/transparency that I know, but I see that the terms are used interchangeably so I will do the same. In the past, they were used (or maybe they are still used now) alpha test images (1bit alpha files) for transparency. Each pixel in the texture is either visible or invisible, no partial transparency is used; but now with the growing performance of the hardware, 8-bit transparency files are used. The 1bit transparency files will require less computations for displaying the geometry with alpha textures but the display quality will be more poor in comparison.
Below I will show you some examples for some of the hairstyles shown in the first picture. I have chosen a different hairstyle than the one Varga has because it would have been boring for me to use the same hairstyle to make this tutorial :). The first hairdo (normal1) is the usual one ... I will not spend so much time on it because you probably can find a lot of tutorials about it on the Internet. In a few words, you will map a texture like the one below on some geometry extruded from the skull like in the figure below and then tweak the shape of the hair by moving the vertices around.
For this tutorial I will go with a more interesting hairstyle.
For the entire project, I used Maya as the 3D application, Photoshop for texture painting and Mudbox for high rez. For the hair, I used Maya Paint Effects a lot in the past ... now I like to paint the hair in Photoshop, it gives me more freedom and variation using custom brushes and a little more time. You can customize some Paint Effects brushes in Maya to do the trick and I will show you later how to achieve it.
The most important thing when painting hair textures with alpha is the alpha channel(basically the transparency map). You should put more effort into painting the form and irregularities of hair strands and then, concern yourself about light and shadow in the diffuse texture. I will nail down two approaches for painting the alpha for the hair:
* Maya Paint Effects
Maya Paint Effects
The first approach that I used a lot in the past and did the job well is using Maya Paint Effects. With a little effort and a few hours of work you can make some pretty good fx brushes for painting hair, i have a few custom ones done by myself but I will start from a basic one to show you the process. This is the Maya Paint Effects canvas:
Click on the brush presets icon and the visor will pop up. From the Paint Effects tab inside the visor, choose the "hair" folder and then the most saturated red hair there like in the picture below. You can play with other presets as you like but this one is best suited for what I need.
If you are using a wacom tablet, you can map the pen pressure to different attributes of the brush in the Paint Effects tool settings dialog.
This is how the default brush will look like (hit the alpha channel button shown in the Paint Effects canvas picture to work only with alpha).
Now to customize the brush hit Ctrl+b to open the Paint Effects Brush Settings dialog box. Here you can find all the parameters you will have to modify and customize the brush and there are plenty to choose from (i did not count them but I remember in a tutorial saying that there are more than a hundred params for Paint Effects brush settings). You will not have to play with all of them, but some are quite useful. Pay attention to the brush profile parameters, especially Brush Width and Stamp Density.
Also under the Tubes section you will find Creation and there, you have Tubes per step which modify the density of the tubes, the segments attribute (which you will have to increase if you have curly hair).
You can enter a bigger value than the maximum allowed when you drag any slider by numerically entering the value in the field
You can also modify some parameters in the Tubes->Behaviour to alter the behaviour of the brush. In the Forces sections, you can modify Path Follow so that the tubes will closely follow the path if you draw curved strokes and add randomness to the tubes using Random parameter.
Also play with the attributes found under Turbulence, Spiral and Bend ... they will add a lot of variation to the brush strokes. Here are some results after playing with the parameters listed above:
All of these are done with a single brush stroke. Spend a few minutes playing with the parameters of the brush and you will end up with some cool brushes for painting the hair. Keep in mind to increase the number of segments located in Tubes->Creation if the strands of hair look like little straight lines connected and also use Path follow located in Tubes->Behaviour->Forces if you want the tubes to follow the path of your stroke. Experiment a lot until you find something you are pleased with and then save the canvas as a file type that supports alpha channel and go to Photoshop for further tewaking. That is all for painting the transparency map using Maya Paint Effects. You can paint the diffuse texture at the same time; among those one hundred parameters for the brush settings there are a lot used for the color of the stroke, you can modify the colors, add variations to hue, saturation ... even map textures to the strokes in different modes ... but I will leave that for another time :).
As a final tip: use large canvas sizes for painting in Maya ... if the hair texture is a 512 square, you may double the resolution in Maya (or go with even far higher resolutions); you can always scale down the texture in Photoshop to the size required. It is better to have more detail than lack of detail. After scaling down the image in Photoshop, do not forget to sharpen the transparency map; I used the unsharp mask with the following settings: .4 .5 for the radius and around 100 for the amount -- use the preview option to get a preview of the filter and analyze the result.
Painting the Hair in Photoshop
The second approach for painting the hair texture is using Photoshop.With some simple custom brushes and a little more time you can achieve even better results than using Maya.The advantage is that you have full control over the strokes and you can shape the hair in whatever form you like ... in Maya Paint Effects you have a ton of parameters to alter the stroke but it remains a procedural generated stroke. There are a lot of good tutorials on the Internet about paiting digital hair(a very good one is here ) so I will not insist on this subject more than is necessary. These are the basic brushes I use: 1.spackled brush for blocking in the shape 2.detail brush 3.single pixel brush for painting individual strands of hair 4.default ps round brush for rough block in
Now all you have to do is spend some time drawing clumps of hair. Below are a few quick examples.
After the transparency map is finished, you can paint the color map (a good idea is to keep the transparency map in the alpha cnannel of the diffuse texture for the hair). You can paint over the transparency map, overlay textures of real hair or anything else (dirt, rust textures) to give more variations to the diffuse. Keep in mind to start with a flat color for the entire texture and add details on top; you should avoid the first approach in the picture below and go with the second one. Keep the color around the edges of the hair the same as the hair color ... otherwise it will look bad.
Low Poly Game Character Hair-Part 2 (Continued)