Page Information

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

Image Modified


In this tutorial, we will cover how to assign random colors to different XGen primitives using a combination of expressions and the User Data node. 


Before you start this tutorial, it is advised that you also read the tutorial tutorial Controlling Primitives with a Texture Map which shows you how to define the scale of your XGen primitives.


  • First of all, you will need to export your model as an XGen archive. 
  • Create an XGen archive description and add the archive file. Assign a Standard Surface shader to the archive collection.
  • Create an a User Data node and connect it to the Color attribute of the Standard Surface shader. 


  • MtoA will not gamma correct the Ai UserData Color node, therefore . Therefore you will need to add a Maya Gamma Correct node in-between the Ai UserData Color node and the Color attribute of the Standard Surface shader as shown below. Change the Gamma RGB values to 0.454.


Custom Shader Parameters

  • Click on the PriviewPreview/Output tab in Xgen and open up Output SettingsUnderneath you should see the Custom Shader Parameters. This is where we will add our expression.


  • In the Name text field, type the same name that was used for the Color Attr Name with the Ai UserData Color node. In this case, we used the word 'Color'. Change float to Color because this is the attribute that we want to change.