Add a noise expression to blend hair colors

You can use a noise expression to vary the hair color. In this example, you use an expression to blend the root color with the hair base color set by the XGen hair phenomenon shader.

  1. Click this icon beside the root_color parameter.

    In this example, the noise expression is added to the root_color parameter.

  2. In the XGen Expression Editor, click the Samples tab.
  3. Under Samples, click + to expand Global then again to expand Color.
  4. From the expression list that appears, select noiseE.

    The noise expression appears in the editor.

  5. In the text field of the XGen Expression Editor, do the following:
    • At line 10, type:

      $baseColor=[1.0,0.0,0.0]; #color

      This specifies that the root_color parameter is now used as the Base Color attribute for the expression.

    • At line 13 after mix($Cs,$Cnew,$Strength), type * $baseColor.

      This adds the Base Color value to the noise calculations.

  6. Click the swatch in the XGen Expression Editor to validate the expression.
  7. (Optional) In the Customer Shader Parameters section of the Attribute Editor, use the sliders in the editor to modify the noise pattern in the expression.

    For example, set freq_fine to 0.356 and freq_coarse to 8.

  8. Click Accept.
  9. Render the Description.