Square Enix © Goodbye Kansas

Table of Contents

This page includes details on the hair Sampler node used with V-Ray hair.


This tutorial will cover the standard setup for the VRayHairSampler node for adding variation to a hair system. For more information on the node itself, see the V-Ray Hair Sampler page.

The V-Ray hair Sampler is set up by connecting the Distance Along Strand, Distance Along Strand Absolute, or Random By Strand to a 2D driven texture. This is most commonly done with a Maya ramp node.

Want to follow along but don’t have a license?

Download Free Trial


Tutorial Assets

To download the files used in this tutorial, please click on the button below.

Tutorial Steps

Apply VRayHair3Mtl to hair system

 1.  Select the Hair System in the Outliner and add the V-Ray Hair Shader Attributes. This is done by navigating to the hairSystemShape tab in the Attribute Editor, and selecting Attributes > VRay > Hair Shader.

2.  Apply a VRayHairMtl3 shader to the HairShader slot in the Extra VRay Attributes rollout.

3.  For clarity later in this tutorial, set the preset to White (matted). This will make the hair a natural white.

4.  Do a quick render for reference.

Resulting Render

Set up the Ramp

1.  Create both a ramp and a VRayHairSampler node in the Hypershade.

2.  Disconnect the place2dtexture node from the ramp by selecting and deleting the inputs.

3.  Click on VRayHairSampler's white output and select Other... to bring up the output selection window. From here, either distanceAlongStrand, distanceAlongStrandAbsolute, or randomByStrand can be selected.

4.  Connect this output from the VRayHairSampler to the V Coord input of the Ramp.

Color the Hair

1.  Connect the ramp to the desired VRayHair3Mtl channel(s). Here, we connect the Out Color channel to both the Diffuse Color and Primary Specular channels to affect both the color and shininess of the hair.

2.  Finally, select the desired colors for the ramp. Here are a couple of examples:

The ramp is driven by the randomByStrand parameter.
Multiple colors set with no interpolation.

With randomByStrand, each hair strand recieves one color from the ramp.

This ramp is used for both the distanceAlongStrand and distanceAlongStrandAbsolute parameters.
Multiple colors set with no interpolation.

This ramp is driven by the distanceAlongStrand parameter.

With distanceAlongStrand, the full ramp is mapped onto each strand regardless of the strand's length.

This ramp is driven by the distanceAlongStrandAbsolute parameter.
It works with the Hair Max Distance parameter.

The distanceAlongStrandAbsolute parameter allows length-depending mapping. All hair strands can have a root color all up to the same length followed by the rest of the ramp

Using the Hair Max Distance

1.  The Hair Max Distance parameter allows you to set the max strand length when using distanceAlongStrandAbsolute. This option is mappable, allowing different parts in a hair system to have different max lengths.

2.  It can also be set in the Extra Attributes rollout when the VRayHairSampler node is selected. Typically, this value should be equal to the longest strand of hair.

The following examples demonstrate length-dependent effects that can be produced.

This ramp is driven by the distanceAlongStrandAbsolute parameter.
Three colors set with linear interpolation.

 Hair Max Distance = 15.0

 Hair Max Distance = 36.0

Was this helpful?