Assigning Color to Primitive Archives

Login to Follow
  • Film & VFX
  • Games
  • Design Visualization
  • Rendering
  • Shading
  • Arnold
  • Maya
Skill Level
  • Beginner
60 min

This tutorial covers how to apply color to XGen primitives using the User Data node in combination with a texture map. The resulting effect is similar to a technique called Pointillisim, where small dots of color are applied in patterns to form an image. For some real world inspiration you should also look at some of the work by this artist and this artist and also this artist who use many small objects to create large works of art.

The button model used for this tutorial can be downloaded here.

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

  • Start off by opening the button model in Maya as provided in the link above. Select the button geometry and go to Generate> Export Selection as Archive(s)... Choose an archive name and destination folder and select Export.

  • We will use a polygon plane to assign the XGen description. Start off by creating a polygon plane and increase its Subdivisions Width and Subdivisions Height to 40. We are going to arrange our primitives 'In uniform rows and columns' so we will need a sufficient number of subdivisions (XGen will place a primitive in the center of each polygon face).

  • Select the polygon plane and go to XGen>Create Description. This will open up the Create XGen Description below.
  • Choose the Custom Geometry/Archives primitive. Change the Generate the Primitives to In Uniform rows and Columns and then click on Create.

  • It is good practice to lower the Percent value in the Preview/Output tab before continuing. If the Percent value is too high you may find that your computer will stall due to the large number of primitives generated.

  • Adjust the Spacing and the Size until the buttons are almost touching. In this case a Spacing of 1 and a Size of 1230 was used.

Adjust the Size and Spacing so that the buttons are almost touching

  • Assign a Standard Surface shader to the new XGen collection.
  • Create an Ai UserData Color node and connect it to the Color attribute of the Standard Surface shader.

Ai UserData Color node connected to Color attribute of Standard Surface shader

  • Type color in the Color Attr Name of the Ai UserData Color node. We will use the same 'Color' name in the XGen description.

Add the name 'color' to the Color Attr Name in the Ai UserData Color node

  • MtoA will not gamma correct the Ai UserData Color node, 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.

  • Render the scene. The buttons are black because the Ai UserData Color Default Value is black. We need to connect it to the XGen description using the Custom Shader Parameters in XGen.

Button archive primitives are using the black Default Color of the Ai UserData Color node

Custom Shader Parameters

  • Click on the Priview/Output tab in Xgen and open up Output Settings. Underneath you should see the Custom Shader Parameters.

Custom Shader Parameters

  • 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'. Click on float and change it to Color because this is the attribute that we want to change.

Custom Shader Parameters set to Color

  • Click on the downward pointing arrow to the right of the color text field. Select Create Map... (it is important to note that this will only work if the plane has a Maya shader assigned to it). Increase the Map Resolution.

  • You should see in the Hypershade and Node Editor windows that a file texture has been connected to the plane. Select the file texture and open the texture map that you want to use to drive the color of the button archive primitives.

Remember to select the disk icon after updating the file texture used to define the primitive attributes, otherwise XGen will not bake the ptex map to disk and the render will not change.

  • Render the scene. Your primitive archives should now have the same color as your file texture map. You are done!

Further archive examples

Thanks to Pedro Fernando Gómez for his assistance with XGen.

Posted By
  • Arnold
  • Maya
  • Rendering
  • Shading
To post a comment please login or register