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 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.
You should assign and set a Dice Instance Strategy on NURBS instances to render them.
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.
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. It is a bit disconcerting that all the instances become highlighted. However, the new material will become assigned only to the shape you clicked on.
Note, there is currently a limitation in RenderMan for Maya where assignment of materials to instances in this way only renders properly for shapes that are only one level below the top of the DAG, like these teacups. If you need to override materials within an instanced hierarchy, it's necessary to turn off RenderMan's "object instancing" feature. RenderMan will still reference the shared geometry in this case, but for large numbers of instances it is somewhat less efficient. Open the Render Settings Window, and under the Advanced tab disable the "Enable Object Instancing" checkbox.
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 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.
Create XGen Description
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.
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.