Intricacies of xGen in Maya 2015 - Hair Edition

I've been using xGen for hair and it's pretty awesome. However, myself and a friend have been experiencing some weird issues that isn't really mentioned anywhere. Through tutorials and such, people seem to just have everything magically work while we had to go through and find workarounds. Special thanks to Ashlee Martino-Tarr for somehow breaking everything she touches but then going through and spending the time to find fixes.

Especially amazing is that I posted this onto CGSociety's forums to see if anybody else has any inputs and Michael Todd, the product owner and designer of xGen responded back with some clarifications.

This is for hair groom. While attempting to use xGen for environments I've run into a whole slew of additional headaches.


xGen will not work properly for Vray if you only have the xGen Vray plugins loaded in your plugin manager. Make sure that xGen for Mental Ray is also loaded along with the xGen tool kit. It is important to note, that you may have all the usability of Xgen but when rendering, the hair may not show up.
MT: 
One description can be bound to multiple pieces of geo. The Patch can also be made of combined geo pieces. There is a limitation in Artisan where it cannot paint maps on geo whose UV's are outside of U1V1. Artisan does not yet support tiled UV's, which can cause issues when painting masks and maps in XGen. XGen itself has no such limitations and can read tiled UV maps and you can also forego UV's altogether if you use geo without UV's and have XGen set up the mesh to use ptex maps.

Make sure you have all of your xGen plugins loaded into your scene file before opening a scene with xGen guides/ materials or creating xGen guides. If you do not, xGen will not work properly when rendering. If you realize you started working on a scene without having all the scripts loaded, autoload them in the Plugin Manager, save your scene and completely close out of Maya. xGen will not work properly/will not render if you try to add needed plugins after starting xGen guides. In some cases the load boxes may be grayed out; xGen needs to refresh which is why you must exit Maya completely and restart it.

When creating your xGen Collection and Description, make sure that they have unique names. If the name clashes with something else in your outliner, xGen will still allow the collection to be made but when attempting to save your scene file, the necessary .xgen file will not be generated and thus your work will not be saved.

xGen splines can only belong to one Patch (object Geometry). Hair will spawn oddly or not at all if it is attached to multiple patches that each have different pTex info.
Ex: Your character has a mustache. You want to attach the mustache to the face so you make a patch on the face Geo. The face geo has texture maps linked in its region and density, but for some reason your hair isn't working. This is because your guides may still be attached to an additional patch (aka: the mustache geo) which has its own additional region map info. xGen has a hard time determining where to spawn the guides, so make sure that a single guide is assigned to a single patch. A single patch however, can be connected to multiple guide descriptions.

xGen does not work with references.
MT: This used to be the case, but has been addressed in the latest Service Pack


You may see an error, something along the lines of 
// Error: XGen: Error in expression “beard1::length”. [$a=1.0000;#0.05,5.0]
Error: Unexpected end of expression’:
$a=1.0000;#0.05,5.0
For whatever reason, sometimes the expression is incomplete. The expression is missing a second line with $a. If you look in either the script editor or the xGen log, it will say exactly which field has the error in its expression that needs to be fixed.

When painting pTex maps for defining masks, it is optimal to assign a lambert material to the geometry first. When attempting to activate the live paint, Maya tends to have issues with recognizing the surface to be painted on if the geometry has a material with miscellaneous attributes. 

After creating a region mask, change the Region Mask value to 1 to enable it. 0 means that the mask has no influence.

Painted maps are not only stored in your xGen folder but also in a 3DPaint Textures folder. When passing your files off to someone else, make sure to include your most recent 3D paint texture folders otherwise xGen may load in out-dated info.
MT: 
This is due to Artisan and Maya not being able to read/paint ptex maps directly and to XGen's reliance on ptex for maps and masks. Ptex maps painted in Mudbox or Mari work fine if you can use those to create them.

Sometimes when scrolling through the editor, the dropdown options may be accidentally changed. Make sure that the Output settings have Operations set to Render and Renderer to your render engine otherwise things will not show up in the render.

If your hair does not follow the guides in your render but appears to be correct in the viewport, reassign your shader to the hair and render again.

If you add additional guides at a later point and find that the hair is not following the guides when testing on a turntable, return back to frame 1 and convert the guides to curves and then back to guides again.

xGen cannot read movement of the Geo if its patch is being deformed inside a group. 
Ex: Your tiger has fur but the fur doesn’t follow because the actual tiger geo isn’t being rotated. Instead you have the tiger geo in a group and that group is being rotated. To xGen, this means that the patch isn’t moving/deforming. 
You can fix this by :
A. Selecting the geo that the guides are connected to and key the geometry instead of the group it is contained in.
B. Pull geo out of the parent group and smooth bind it to a joint that will “deform the mesh”.
MT: 
When you bind XGen to the geo, it builds a pref which is essentially the ‘Bind Pose” of the mesh. This is done to create a reference to ensure that as the faces are deformed during animation, the pref is used to make sure that the number of primitives generated on the faces does not change. Density is calculated as Primitives per unit Area, and if the surface area of the faces alters, without the pref, the density would change. How this is relevant is that when the geo is grouped, the transforms on that geo are 0 as they are inherited from the group. Another workflow is to make an ungrouped copy of the mesh and use a blend shape deformer to ensure that XGen will follow the deformation/translation 

If using GI, make sure you uncheck use camera path , otherwise you will experience a lag time in which Maya becomes unresponsive before starting renders.