---
title: "Hair Sampler Texture Setup"
canonical: "https://documentation.chaos.com/space/VMAYA/111741659/Hair+Sampler+Texture+Setup"
format: markdown
---
This page includes details on the hair Sampler node used with V-Ray hair.

## **Overview**

---

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](https://docs-chaos.atlassian.net/wiki/spaces/VMAYA/pages/111740641) 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](https://www.chaos.com/free-trial?utm_campaign=docs-tutorials&utm_medium=website&utm_source=docs.chaos.com)


![image](media://aa2abadf-7150-41d9-8201-ad4429a0e867)



## **Tutorial Assets**

---

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

[Project Files](https://drive.google.com/uc?export=download&id=1h_t4aeQ-1t5CfjA_YZYMGXjCnPYUzzxr)


## **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**.

![image](media://6c7a5e25-78ab-4b3d-91b5-d1f55e79b293)

  
** **

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

![image](media://5970a4d3-3e0f-4c5a-96a2-b87c580001e1)


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.


![VMAYA_HairTexSetupTut_greyResult.jpg](media://28790a65-1210-4f5e-9a40-9b78fc66a014)

Resulting Render


### **Set up the Ramp**

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

![image](media://acffeb5f-f565-4439-8ba9-7c5e360feb55)



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

![image](media://41207db5-bd5d-4ab6-a61e-302baf906103)


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.

![image](media://dcf10c95-bec9-4458-a526-df89d25309db)


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


![image](media://3f40f4fa-a914-46ab-a568-7f91b8116ed5)



### **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.

![image](media://d7eaaccf-85c1-4958-956a-d5bc3c04cb18)



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


![VMAYA_HairTexSetupTut_blueHairRamp.jpg](media://c82ce1a0-fd5d-45fc-9d48-36dba5293af4)

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


![VMAYA_HairTexSetupTut_blueHairResult.jpg](media://070ca51f-2857-42ac-b5a9-31358bc0a7b8)

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



![VMAYA_HairTexSetupTut_orangeHairRamp.jpg](media://4e2bdfd8-177b-4957-a647-84dd8d03f17d)

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






![VMAYA_HairTexSetupTut_orangeHair_connections.jpg](media://14572b2f-5655-4a6c-a33c-415b9f4a16c6)

This ramp is driven by the ** distanceAlongStrand ** parameter.



![image](media://8141c835-1b5b-46da-b7d7-48606b5d32cd)

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







![VMAYA_HairTexSetupTut_orangeHair_alongStrand_ramp.jpg](media://c18d9dbc-8e37-407e-9084-c052eeb7715a)

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


![VMAYA_HairTexSetupTut_orangeHair_alongStrandResult.jpg](media://8646e1ec-062a-447e-acec-185d04734d72)


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.

![image](media://474c2f75-c21c-4844-a4c7-b4eaef33f78d)



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.


![VMAYA_HairTexSetupTut_ExtraAttributes.jpg](media://f56a2120-9f02-4c6b-9c97-d1eadfd02211)

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


![VMAYA_HairTexSetupTut_purpleHair_ramp.jpg](media://d0cb2f7c-a47d-43cc-8413-fa1d319edecb)

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


![VMAYA_HairMaxDist_fifteen.jpg](media://c15a846d-75f5-45e2-aa99-7e28fefbc8b5)

**Hair Max Distance** = *15.0*


![VMAYA_HairMaxDist_thirtySix.jpg](media://f1aad958-a3b7-416d-9ac6-ec5cabcbde0c)

**Hair Max Distance** = *36.0*