Rendering Textured XGen Fur with Vray in Maya 2016

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:

2016-08-03_19h24_28

2016-08-03_19h25_51

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

2016-08-04_11h03_59

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

2016-08-04_11h59_22

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.

By |2017-01-09T04:13:41+00:00August 4th, 2016|Maya, Tutorials|11 Comments

11 Comments

  1. Nathanael August 30, 2016 at 11:52 am - Reply

    Ow thank you thank you…finally i got it right….it works!!!

    • Erwan Leroy August 31, 2016 at 1:04 pm - Reply

      Glad it could help. Cheers.

  2. Ahmet September 16, 2016 at 5:10 pm - Reply

    Thank you so much! I was about to go crazy until I found your tutorial!

  3. Anton October 10, 2016 at 1:23 pm - Reply

    Thank you for this. Much appreciated!

  4. Thomas Capizzi April 8, 2017 at 5:57 pm - Reply

    Thanks! The VRay Hair sampler node is a black box. Thanks for shedding light on how it actually works!

  5. bala September 28, 2017 at 1:02 pm - Reply

    Thank you for this tut ,Can you tell me if i use Custom geometry the vray shader is not supporting.

    • Erwan Leroy September 28, 2017 at 1:12 pm - Reply

      I don’t have access to Vray where I currently work so I would have to guess. You mean using custom geometry instances instead of hairs? I would think in that case each instance will take on the shader of the primary Geo. There might be ways to add dynamic properties to the shader using part of the workflow above, but I would have to look deeper into it, which I can’t these days.
      The Vray and Xgen docs might be a good place to start.

  6. bala September 28, 2017 at 1:19 pm - Reply

    yes correct instead of hair i m using Custom geometry,i ll try to find dynamic prop any way thanks erwan.

  7. Greg Marshall November 19, 2017 at 6:59 am - Reply

    Thanks for this! How did you ever discover the process?

    • Erwan Leroy November 19, 2017 at 3:08 pm - Reply

      Reading the documentation, and a fair amount of trial and error.

  8. Abbas Emadi May 9, 2018 at 6:35 am - Reply

    Many thanks Mr Leroy, Your tutorial was great and it helped me a lot.

Leave A Comment