Scene formed of XGen 'archive' cube primitives driven by a texture map


XGen is a powerful tool that offers many creative opportunities for positioning an arbitrary number of primitives either randomly or uniformly placed. You can use texture files with XGen Descriptions to specify the location and density of primitive generation as well as to control the number of primitive attributes. This tutorial will show you how you can very easily use a texture map to 'drive' the length, width, and depth of an XGen primitive. These primitives can range from spheres, splines or as in the example below, geometry that has been exported as an archive.

'Pyramid shape' archive distribution driven by a texture map (rollover image)

You are only limited to your imagination as to what you can achieve using this method. Uses for this tutorial could range from using a map to drive the position of some trees on a landscape or as in this case, be used to create an odd looking face:





Ensure that the original Maya shader is assigned to the XGen description. Otherwise, this step will not work! After you have created the map, you can then convert it to a different shader.






This is used to define the length attribute using the texture map, and 200 is the Map Resolution that we defined earlier.



...where 0.5 (0.3 + 0.2) is the maximum length of the sphere and 0.02 is the minimum size. Your length Expression Editor should look like the following image. Copy the expression text. We will use the same expression for the Width and Depth settings for the sphere primitives. Click Accept when you are done.



Create a texture map

Now we want to add our texture map. Click on the paint icon to the right of the slider control . You should see in the Hypershade and Node Editor windows that a file texture has been connected to the plane.


Distribution of spheres based on grayscale ramp


Remember to select the disk icon after updating the file texture used to define the primitive attributes. Otherwise, XGen will not update it, and the render will not change.

Sphere primitives rendered without texture map



Face image uses a 3d projection texture map




Further Examples

That concludes this tutorial on controlling XGen primitives with a texture map. This is just one example of what this powerful tool is capable of. Below are some further examples of different images used to drive the distribution of primitives. Try experimenting with different texture maps and have a go at using different primitive types such as splines and archives.

Texture maps used to drive sphere primitives




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