Color hair root and tip

You can color spline primitives along their length by setting root and tip colors. To do this, use a custom shader parameter or connect an xgen_root_tip_color_blend node to your hair shader. Root and tip colors appear in the rendered Description, but not in the XGen preview.

Color root and tip color using a custom shading parameter

  1. Click the Preview/Output tab, and in the Custom Shader Parameters section, do the following:
    • In the space beside Name, type tip_color.
    • From the drop-down list beside Name, select color.
    • Click to create the parameter.

    The tip_color parameter appears in the Custom Shader Parameters.

  2. Repeat step 1 to create a parameter named root_color.

    Use an expression to add color for the tip and root color.

  3. Click this icon beside the parameters to open the XGen Expression Editor.
  4. In the XGen Expression Editor, click the Samples tab.
  5. Click the + beside Global and then + beside UI.
  6. From the expression list that appears, click a color-related expression such as color_green.
  7. Click Accept.

    The tip_color parameter is now set to green.

  8. Click the color swatch to set a new color.
  9. Repeat steps 4 to 8 for root_color.
  10. Note: If your Customer Shader Parameters do not affect the rendered Description, you may need to delete the Descriptions xgmr:geoshader object. To do this, in the Outliner, expand the Description until the xgmr:geoshader object displays, then delete it. Rebuild the shading network by clicking Setup in the mental ray Settings of the Preview/Output tab. Render your Description again.

You can blend the root and tip colors using an expression. See Render Description workflow examples.

Color root and tip using an xgen_root_tip_color_blend node

Connecting an xgen_root_tip_color_blend node to your hair shader lets you set hair root and tip color, and then output these colors as a single channel to the shader.

  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. Create an xgen_root_tip_color_blend node.
  4. Connect the node's Output Value to a color channel input on your hair shader node.
  5. Double-click the xgen_root_tip_color_blend node.
  6. In the node's Attribute Editor, click the swatches beside Root Color and Tip Color to set colors.
  7. Render your Description with mental ray.

    You can also apply a texture map to the root or tip color by connecting an xgen_ptex_map_lookup node.

Apply a texture map to the root or tip color

  1. In the Node Editor, double-click the xgen_root_tip_color_blend node.
  2. In the node's Attribute Editor, click the map icon beside Root Color or Tip 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