Page tree

Versions Compared

Key

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

Table of Contents

If you have geometry in your scene that is reused in multiple places, instancing provides you with the ability to reduce the memory footprint of your renders if you do a little bit of extra work.  For example, if your scene is composed of multiple buildings, each rotated a bit differently, you can use instancing to only load one copy into memory.

RenderMan for Katana supports three approaches to instancing: leaf-level instancing, hierarchical instancing, and instance arrays.  The first approach, leaf-level, lets you instance matching pieces of geometry via an attribute.  The second and third are very deliberate approaches where you set up an object master and then explicitly instance it. The teapots_instancingExample.katana file includes an example of how to render the above image using these methods.

Note
titlePerformance Note

Instancing can save on memory but may impact performance such as time to first pixel (how quickly a render begins sending pixels) since Katana may process many nodes. Options where you can instance a hierarchy will be more efficient for time to first pixel but you may lose control of some attributes you may wish to override, this is the trade off.

In the PrmanGlobalStatements you can specify prmanGlobalStatments.plugin.flattenInstanceSources Or you can use PrmanObjectStatements with prmanStatements.traversal.flattenInstanceSource These options tell Katana to keep instances as groups rather than flatten them, this speeds time to first pixel as the flattening doesn't happen for a possible deluge of instances.

You can read more about nesting versus flattening on the main Instancing page.

Leaf-level instancing

You may find that your scene is taking a lot of memory, and you think that because your scene has lots of repeated geometry, that you may be able to take advantage of instancing.  The leaf-level instancing approach can be used to efficiently turn already existing geometry locations into instances of each other via the instance.ID attribute.  RenderMan for Katana will make the first location it encounters with a certain instance.ID into the geometry master, and all subsequent locations will be instances.  All locations with matching instance.IDs must be identical, otherwise there could be undefined behavior depending on which location RenderMan for Katana encounters first. The screenshot below shows an example of how to set the instance.ID attribute via an AttributeSet node.

Image Modified

Like it's its name states, leaf-level instancing only works on Scene Graph locations with no children.  RenderMan for Katana will not traverse past a location with the instance.ID attribute, so it cannot be used to instance groups of geometry.  If you need to instance a hierarchy, you will need to use either hierarchical instancing or an instance array.  These are described in the next two sections.

...