Monday, July 19, 2021

Hair Cards in XGen

 Out of my own curiosity, I learned a little bit about how hair in games is created and about the artists that specialize in creating hair.  One of the methods I learned about was making hair cards, a polygon strip with a picture of hair on it, which is how hair is traditionally made for games.  The art of creating hair as I've come to learn requires a lot of time and patience to look good with the hair card method.  

As this is my first time using XGen, I created a hair card with a simple strand of hair and learned about how XGen works.  

Final Result of Hair Card Rendered in Arnold

To start the process of creating a simple hair card I created a polygon plane that I scaled and cleaned.   I also created a naming convention as XGen is very particular with naming conventions, created a description and added some guides to my geometry. 

Outliner View with Description and Guides

Geometry and Adding Guides


From watching the process of several groom artists, I learned that guides are extremely powerful.  They can control how long the hair is but they can also place, shape, and orient the primitives that are generated on the polygon meshes.  The primitives are the brown pieces of hair that appear when I push the eye icon on the XGen tab.  This is how the hair generates and if you shape the guides and push it again, the primitives update.  

Gif of Lengthening a Guide and Generating the Primitives to Update

To shape the guides, you need to manipulate the CVs.  Similar to how to create a custom rigging controller except you are shaping the strand!

Gif of Manipulating CVs on the Guides

Besides shaping the guides, I also learned about the tube shader.  The tube shader is a setting in XGen that applies a tube like shading to a flat plane.  This made me realize that the strands of hair are really flat planes.  Often times this setting in XGen is turned on to help the view the strands of hair better.  

Gif with Tube Shade Turned On

Gif Without Tube Shade

Some other really fun settings I learned about was the Density, Length, Width,Taper,Taper Start, Tilt, and Around.  These settings allow the user to edit the hair.   
Density - Gives you more or less hair (Generator Type Attribute)
Length - How long or short your hair is.
Width - How thick the individual hairs are
Taper - thins or thickens the edge of the hair
Taper Start - Allows you to control where the tapering is happening
Tilt - Lays the hair down flat on the card
Around - Brings the hair around town

Gif of Density Setting Example

Gif of Length Setting Example

Gif of Around Setting Example

One of my favorite parts to creating the hair card was learning about the painting mask.  When you originally generate the primitives, they generate in random places.  When you create a painting mask, it allows you to paint in the area on your card that you want your strands to appear.  After pushing the eye icon in the XGen tab the primitives will generate in that area.  This reminded me a lot about weight paining.

Gif of Painting a Mask for Hair


Some other settings that I learned about was that adding more CV's to the guides will actually smooth out the hair.  A good rule of thumb with the guides is that their length is always 1.  Adjusting the CV's will not add tot eh length attribute.  When you generate the hair their length attribute is 1 but it is coming from the length of the guides.  I also learned that a good width for characters is 0.10 or 0.12.  The width ramp is also a very useful tool as it helps with thickening and thinning out the hair in specific areas.  Hair is thinner by the roots, thickens out and then thins our again by the tips.

Hair Card with Width Ramp

Besides having fun with the painting mask, I also had a lot of fun with the modifiers.  There is a section in XGen that allows you to add a modifier that effects the whole card and it can create some really cool looks.  I also found that the more CV's you have on your guides the better the modifiers look.  I messed around with the Noise and Coil Modifiers.  

Selection of Modifiers in XGen

Hair with Noise and Coil Modifiers

To get a good idea on what the hair looks like, I created an Arnold render of the hair.  I applied an AiStandardHair shader and then used the Auburn preset

Arnold Render of Hair

Similarly to how modelers generate different maps for their models, we need to generate maps for the hair card.  The maps I found that needed to be created was the color, specular, normal, ambient occlusion, direction, and opacity.  For the color map, I found that you cannot just have a regular shader, there are several attributes that give you color.  So to get the color map, I used an HDRI to get the proper lighting and create my color map.

Color Map

The occlusion map is basically the alpha map.

Ambient Occlusion Map

For my AOV's , Direction, and Normal map I learned about the Shuma Hair AOV's tool.  It helps by creating some shader nodes to create these specific maps.  The AOV map is the most important map since it create the depth and it drops shadows between the hairs.   I also learned about a cool way to reduce anti-aliasing by putting a plane behind the hair and giving it an aiFlat and making that an mid grey color.

AOV Map

Learning about the Direction Map was a new type of map for me.  This map looks at where the specular is through out the hair and how it travels.  This helps create realistic hair.

Direction Map

I also created the normal map which adds a little bit of bump to the hair.  Some hair will look like they are on top of one another and it creates volume.

Normal Map

For fun I created the Specular map but it is not needed.  It created the lines that play witht eh straightness of the hair and breaks up the specular so that there is no perfect specular.  This map can be created in engine.  

Specular Map

No comments:

Post a Comment

Zenko Rig Reel

Zenko Rig Reel Zenko was my capstone character that I rigged and animated for Zenko: A Fox's Tale.  He is built to have a very reactive ...