Page tree


Reusing geometry through instancing can allow for a tremendous reduction of the memory footprint when rendering complex scenes in RenderMan.  Even when working with simpler scenes that contain multiple similar objects, it can be convenient to incorporate instancing into your workflow.

In Maya there are several approaches to setting up instances, including:

Maya Instances

Maya instances are probably the most familiar form of instancing in Maya.  Maya instances are rendered as "object instances" in RenderMan, its most efficient form of instancing.

In this example, suppose a teacup will be instanced.

Select the top level group node of the hierarchy that you want to instance, in this case the teacup node.

If the object that you wish to instance is very complex, you may want to create a RenderMan Archive first, and instance that, so the original geometry doesn't even have to be present in the scene.

Do Edit->Duplicate Special, opening the option box.

Make sure instancing is enabled in the options.

A new instance appears in the outliner.

Open the HyperGraph Hierarchy window to observe that original node and the instance are separate transforms that share the same geometry. (Windows->HyperGraph: Hierarchy)

The new instance can be positioned independently.  

Multiple Materials

New materials can be assigned to the instanced shapes.  Select the shape in the viewport that you want to assign a new material, and assign in your usual manner.  The new material will become assigned only to the shape you clicked on.  

Particle Instancer

Creating Maya instances and positioning them each independently can become impractical for large numbers of instances.  Maya's particle instancer is one approach to instancing geometry at particles.

First, create some particles.  This can be done using an emitter (to place particles dynamically) or Maya's nParticle Tool to place individual particles.  Both nParticles and Maya's legacy particles are supported.

In the example below, particles have been positioned individually using the nParticle Tool.

Note, sometimes when doing particle instancing, you'll get unexpected offsets in Maya.  To avoid this move the object that will be instanced (eg. teacup) to 0,0,0.  Do Modify->Freeze Transformations.  And so that per particle attributes can be used for each instance, you can leave the original out of the view.

Looking through the "top" orthographic camera.  Click to create particles where new instances should sit, and when done hit Enter.

Select the node that should be instanced (eg. teacup) followed by the particle shape's transform (eg. nParticle1), and do nParticles->Instancer.  If you select these in the wrong order, Maya will point that out.

You'll see an instance appear at each particle position.


XGen Archives

Nested Instancing

Especially when dealing with large data sets like Xgen instancing of many objects, we try and flatten the instances to allow users flexibility in overrides and improve speed. But there are times when this may consume too much memory. This is because flattened instances multiply when rendered, so 1,000 instances of 1,000 instances are 1,000,000 instances.

Nested instances are added so 1,000 instances of 1,000 becomes 2,000 in memory. However, options for instances like some variation and more are no longer available to the renderer. So we allows users to decide when to nest instancing in the transform nodes by tagging them.


Create XGen Description

XGen is a powerful tool that can be used to position instances of arbitrary geometry.  First an XGen description needs to be created, which holds the collection of points where instances will be placed.  Then, the archive can be created to instance at those points.

Select the shape upon which instances should be placed (eg. the ground plane).  Then from the XGen toolbar, click on the leftmost icon with an X.

In the XGen window that pops up, choose the button that says "Create New Description".

In the Create XGen Description dialog that pops up, choose the radio button called "Custom Geometry/Archives (use for any model you have created)".

Go ahead and click the Create button.  This distributes points randomly across the plane.  Don't worry about that now.  Let's create an archive.

Create XGen Archive

In the XGen Window, under the Primitives tab, scroll down to the section called Archive Files.

Select the top level transform of the hierarchy that you wish to archive (eg. teacup node), then click on the button called "Create From Selection..."

In the "Export Selection as Archives" dialog that comes up, go ahead and choose a location and name for the XGen archive, and Export.  You may also be prompted to re-save the scene.

Next, click on the "Add..." button below the Archive Files list.  Browse to the previously saved archive.  The file name should end with .xarc.

You should see instances of your archive densely packed across the ground plane.

Specify Points

If random positioning isn't what you're after, you can specify points at specific locations.

Scroll to the top of the XGen Primitives tab.  Change the Generate Primitives setting from "Randomly across the surface" to "At specified locations.  Then, click on the button that says "Specify Points..."

A tool appears in the viewport for placing points.

After placing points, you should see the archive instanced at those points.

Add a Material

Under the Preview/Output tab, scroll down to the RenderMan Settings section.  Here a new material can be applied to the archvies.