Control hair color with a ramp 2D texture

You can add multiple colors to splines and vary these colors along their length using a 2D ramp texture. To do this, you must connect an xgen_hair_length_mapping node to the ramp. This node provides U V coordinate space along the length of spline primitives for textures and ramps.

  1. In the Hypergraph, select your XGen hair shader network.
  2. In the Node Editor ( Window > Node Editor), display the shader node connections.

    For information about displaying node connections, creating nodes, and connecting nodes, see Node Editor basics.

  3. In the Node Editor, create a ramp [texture] node.
  4. Connect the ramp node's Output Color to a color input on you hair shader.
  5. Create an xgen_hair_length_mapping node.
  6. Connect the Out Value of the xgen_hair_length_ mapping node to the V Coord input of the ramp node.
  7. Select the ramp node, and in the Ramp Attributes section of the Attribute Editor, set the ramp to color the splines along their length. For information about setting colors, see Ramp.
  8. Render your Description with mental ray.

    You can also apply a texture map to the ramp's color points by connecting an xgen_ptex_map_lookup node.

Apply a texture map to ramp color points

  1. In the Node Editor, select the ramp node.
  2. In the Ramp Attributes section of the Attribute Editor, select a ramp color point, and then click the map icon beside Selected Color.
  3. In the Hypershade, create an xgen_ptex_lookup node.
  4. In the node's Attribute Editor, click beside File Name and browse to the location of the Ptex map or texture file.
  5. Render your Description with mental ray.

Related topics