Even though I usually like to post about Compositing, I’m doing a little exception this time.

I recently had to help a student create Fur for her personal project, and I got surprised how few tutorials were present online for the Xgen/Vray Combo.
Some sort of Bug prevented us to make any progress for a long time, and even after we discovered what was causing it the process wasn’t as straightforward as we thought.

I’m writing this tutorial as a step-by-step manual for those who would also struggle to get a custom color on Xgen hair to render in Vray.

Hopefully this will be useful for some.

1- Setting up XGen to see Vray

First we need to load the Plugins. Open Maya (with a new scene) and load the plugins. Load Vray and XgenVray, then XGen.
It is necessary to load XgenVray before we launch XGen, otherwise XGen won’t see Vray as a Renderer.2016-08-03_19h08_33

2 – Create or Load your Geometry

No secret here, I’ll use my awesome modeling skills and create a Sphere.2016-08-03_19h15_33

3 – Create your XGen Fur

Well, this is not meant to be a full on XGen tutorial, so I’ll only touch the basics here.

a) Click the Xgen icon in the XGen tab2016-08-03_19h18_40

b) Select the Geometry (or Faces) you want to grow hair on

Important! There is a bug with the current version of Maya and Vray

[Maya 2016 + Vray 3.4](I’m not sure where it is coming from). Make sure the object you want to grow hair on does not have a Vray Material applied. Lambert and Blinn are fine. I haven’t tested other materials. We will see a bit later on why.

c) Create new Description (Create the Fur)

Pictures are worth a lot of words:



Make Sure Vray is visible to XGen and set it as renderer:2016-08-03_19h32_03

d) Do your Grooming or whatever you were planning to do on the hair.

In my case, I’m just increasing the density a bit, adjusting the length and taper, and adding a noise Modifier.
I end up with something that looks like this: 2016-08-03_19h34_02

4 – Color the hair

In order to color the hair, Vray uses custom shader parameters root_color and tip_color.
If you only create one of the two, the whole hair will be colorized.

a) Create the custom Map


In “Custom Shader Parameters”, in the name field enter “root_color”, change the type to color, and click the “+” icon. Then, click “Create Map”.2016-08-04_11h09_54

Choose a resolution. This will be a PTex map (not UV map) and the resolution will be dependent of this value. I went for 400 sort of randomly, assuming it would be big enough. You can change it at any time by clicking the little expression icon.2016-08-04_11h13_57

At that point, you will see the sphere becoming white, and the 3D paint tool will be active.
If you want to paint the color yourself, that’s fine, click the little paint icon next to the Custom Parameter.
In my case, I want to use a texture file. If you look into the Hypershade, you will notice a texture and a material have been created for you. This does not happen if your original object had a Vray Material applied! That is the bug I mentioned earlier.  2016-08-04_11h27_10

Click the Paint icon. You can now paint a custom color if you want to. (This step might not be necessary, but I failed last time I omitted it.)2016-08-04_11h37_35

Now in the Hypershade, double click the texture Map (pSphereShape1_collection_…stom_color_root_color.iff in the image above), and browse to the texture you’d like to use instead.2016-08-04_11h41_09

Note: The color management might not be available, in which case you’ll want a texture in Linear color.

Make sure you click the little save icon to apply that map to Ptex.2016-08-04_11h45_01

It will look like nothing happened. However, if you browse to the right path, you’ll notice you now have a ptex file.2016-08-04_11h46_42

Repeat the operation with “tip_color” if necessary. I will skip it, so my root_color will be applied on the whole hair.

5 – Render It

In order to render in Vray, I will change my renderer to Vray, and add a VrayLightDome to get some light in there.

At that point, it’s still rendering as a grey hairy ball, but at least it’s rendering.2016-08-04_11h52_14

a) Create a shader

I will use a Vray Mtl Hair 3 Shader. In the diffuse, I attach a VRayHairSampler.2016-08-04_11h55_10

The hair sampler is the node doing the magic, it’s not very clear to me exactly how it links to the PTex map, I’d like a bit more documentation on it, but somehow it can read some attributes of the XGen hair, and will recognize root_color and tip_color maps as such, and output them as Out color.

b) Assign the shader

Select the description, and assign the material to it:2016-08-04_11h58_39


c) Tweak your lighting / Shader, and Render

I replaced my dome light with two Rectangle lights, and removed the default brown color in the Hair material speculars.
Here is the “final” render:render

A magnificent hairy Earth.

Hope this Tutorial will be helpful for some. The process isn’t particularly intuitive and could be improved greatly, but for the time being we don’t have many options.

If you know a better way feel free to comment and let me know.