CREATING HAIR FOR A GAME CHARACTER STEP BY STEP
Once upon a time, a game character's hair was just a handful of pixels; in the 2000s, with the transition to 3D graphics, they began to be modeled as separate objects with textures, and a little later, particle systems came into use.
Today, hair uses AI algorithms and can react in real time to wind, character movement, and other physical factors. The modern pipeline for creating lush (and not so lush) hair is described in a new article by artist Blacksteinn.
Preface
You can use any software that allows hair generation and texture rendering. The main principle is to create realistic-looking hair strand textures, correctly place the planes, and set up the shader.
This tutorial uses the Maya 3D editor, the built-in XGen hair system, and the Arnold renderer. The internet has plenty of detailed tutorials on how to use these tools, so here we’ll focus on the basic steps and core workflow.
Setting Up XGen
There are two main methods for hair generation in XGen: the XGen Editor and Interactive Grooming. Both are based on placing guides on a polygonal object and adjusting procedural generation settings in what’s called a Description.
With Interactive Grooming, you can directly manipulate generated hair—select individual strands, use grooming brushes, and work in layers.
This tutorial uses the XGen Editor method.
A Description is essentially a set of parameters, options, and auxiliary generators that define the appearance of the generated hair. Each hair strand type should have its own Description.
Use polygonal planes with enough subdivisions as a base for hair generation, since individual hairs are generated from these.
Place them at a slight tilt (10–20 degrees) to add depth and volume to the texture. You can speed up the process by creating a large square reference plane, centering the camera on it, and positioning your hair planes within its bounds. You can also overlay a guide image showing the intended hair layout.
Select a polygonal plane, create a Description (naming convention like LongHair01, MediumHair01, ShortHair01, etc., depending on the strand type). Ensure Placing and Shaping Guides is selected—this allows drawing guides to define strand shapes.
Next, place the guides — they will determine the overall silhouette and will be used later with modifiers.
Use Add Guides, then shape them using Guide Control Points or the Sculpt Guides brush.
After placing the guides, we proceed to setting up the generator parameters.
Use the rand(*,*,*) function in Length and Width for variation. Example: rand(0.8,1.2,3) to avoid uniformity.
If needed, use the Mask section to load or paint a mask that defines where hair should or shouldn't be generated—helpful for hair caps.
Create hair strands with varying density and spacing for a fuller, more natural hairstyle.
Modifiers
The main modifiers will be Clumping, Cut, Coil and Noise.
Each has a Mask parameter to control influence. Masks can be hand-painted, procedural, or use functions like rand(), percentStray, etc.
Use multiple Noise and Clumping modifiers with different parameters and masks for variety. Clumping can use guides to determine clump placement.
Texture Creation
After finishing the hair in XGen, we proceed to rendering the textures.
For rendering, you can use various shaders - both standard ones that come with the Maya and Arnold libraries, and custom ones that can be found on the Internet. In this tutorial, shaders and materials from the Arnold library will be used.
Recommended by LinkedIn
Regardless of the program in which the work is done, the general idea is to create at least basic texture maps from the generated hair - Ambient Occlusion/Depth, ID, Opacity and, if necessary, auxiliary Root-Tip, Flow/Direction and Normal.
For rendering AO, we use an Arnold shader called aiAmbientOcclusion.
To render the ID, we use the aiStandardHair material, set the Diffuse value to 1, and connect aiUtility to the Diffuse Color parameter, in which we change the Color Mode parameter to Primitive ID.
For rendering Root-Tip we also use the aiStandardHair material, with the same value for Diffuse, but we connect ramp [Texture] to the Diffuse Color parameter.
If Normal is required, you can also use aiUtility with the Color Mode parameter changed to Normal.
For rendering Flow/Direction shader can be found on the Internet. All files are saved in png format.
Creating the Hair Mesh
There are different methods and tools for creating a polygonal hair mesh for game characters like haircards. One of the most convenient ways is to bind the plane to a curve. By controlling the curve points, the polygonal plane is also controlled. This can be done in different programs, both through built-in plugins and custom ones that can be purchased on the Internet.
In our case, the planes were placed in the ZBrush program using the Bend Curve modifier. In this modifier, the number of controlled points is adjusted dynamically, each of them has the ability to rotate around the axis, as well as change the width and depth.
The strands generated in XGen can be combined with planes in different variations, this will further diversify their appearance, give them more volume and speed up the process of creating a hairstyle.
The general rule for creating a hairstyle mesh is to work in several layers.
Of course, it all depends on the type of hairstyle being created and the budget of the polygons, but you need to try to stick to the fact that depth, volume and visible separation between the strands of hair are visible, and also try to diversify their direction.
Basic material setup
We use Marmoset Toolbag for visualization, but similar renders can be done in any engine, the general principle is that in addition to connecting the main texture maps, also include anisotropic reflections and subsurface scattering, this will make the hair more believable and realistic.
The main texture maps that will be used are Alpha/Opacity, Ambient Occlusion, RootTip, ID. Optionally, you can connect Normal and Flow/Direction maps, but this already depends on what and how is located on the hair atlas, as well as on the shader.
The main texture map for color can be created in Photoshop or any other graphic editor that supports working on layers and through different blending modes.
We will take Ambient Occlusion as a basis, use the RootTip map to darken the roots and lighten the tips, and lighten/darken individual hairs through ID.
This simple combination of texture maps will give a more natural and realistic look to the hair. It is better to try not to make a sharp contrast between dark and light areas, because then the hair texture will look more stylized than realistic.
It is more convenient to add color to hair directly in the shader itself, because you will see the final result in real time.
For Specular we use the ID map, stick to the minimum values, it is advisable to reduce the Fresnel parameter to the minimum and, if the shader allows, add color to the reflections.
The Flow/Direction map is used to determine the direction of anisotropic reflections, which must be used for rendering hair. If such a map exists, then simply connect it in the shader, there is no need to change any parameters, except perhaps adjust the effect strength.
If there is no such map, then turn on the Anisotropy parameter and, if the hair UVs are made in one direction (all vertical/all horizontal), then set the Angle parameter so that the shine of the reflections on the hair is not parallel to the length of the hair, but perpendicular, usually these are either 90 degrees or 0.
In this sense, the Flow/Direction map is useful because you can have hair in different directions on one texture.
We need to use the Flow/Direction map because the atlas, in addition to vertical strands of hair for the main hairstyle, has eyelashes and a baked "cap" for a short haircut.
In the shader, it is advisable to enable the Subsurface Scattering parameter to simulate the passage of light through the hair, this will give it more realism at the edges and tips.