I am a big fan of using XGen to create realistic hair. However, sometimes you can’t use the realistic strands-based hair because the target application doesn’t support groom objects. In these cases you need to convert your object to polygons.
XGen allows you to convert your hair objects into polygons very easily, using the “Generate/Convert XGen Primitives to Polygons…” command. However, you can imagine converting the hair to polygon without any additional work can result in a lot of polygons. Take this hair for example:
Converting it to polygons using the command described above results in the following geometry. As you can see, it is virtually identical to the XGen hair. However, it has 1.2 million vertices, half a million faces and 1.16 million triangles. My Maya can handle that just fine, and moving the camera is not an issue. However, it may be a lot of polygons for other situations, like using it in a videogame engine that doesn’t support groom objects (or you don’t want to deal with the groom renderer in UE4 for whatever reason).
In this article I will describe the steps I followed to create a polygon hair object using XGen. The XGen editor lets you change the primitive attributes. For example, you can change the width of the splines. Note I decreased the density to make the object look less cluttered.
If you increase the width and then convert to polygons, you will have a hair made of “cards.” When you convert the XGen object to polygons, UVs are automatically generated for each card, so you can apply textures later. By default, the cards are arranged in a 2x2 layout, meaning each card takes half of the UV space, and is positioned on any of the quadrants of the UV (for example one card will be on the upper right quadrant and the next on the lower left quadrant).
One thing to keep in mind is that hair cards are oriented to the view during conversion. In the image above you can see how the hair model looks from that angle. However, if I move the camera around, this is how it looks like:
The problem is, if you are working with 3D characters, and you are giving them 3D hair, you need the hair to look good from any angle, not just the front. What I do is make a conversion from different angles, like front, top, side, etc., to fit my needs.
Here’s another issue. Depending on the hair, simply doing this doesn’t work. If you compare the original XGen hair and the polygon hair, you will notice the side hairs on the original hair were supposed to be thin hairs very close to the head. However, the ones in the polygon hair are thick 3D cards.
This can be solved very easily, though. Notice there’s an Expression button next to the Width, and an arrow pointing down next to it. If you press the arrow, you can choose “Create Map…” and that will let you paint a map directly on your scalp. One thing I recommend is using a high value for the mask resolution (the default value is 5.0, but you should use something larger, like 50, or even 100, as this will allow for greater control). In the mask, white means full width and black means 0 width. After painting the mask, this is how the XGen hair looks (I also used another mask to control the density of the hair, making it more dense in areas with thinner strands, and less dense in areas with wider cards).
To create my hair, in this specific instance I used a conversion from the front and another one from above. The resulting hair was pretty dense, and was making my target application crash, so I had to use Maya’s “Mesh/Reduce” command to reach a more manageable polygon count.
And this is it. I hope you found this useful.