The Help > Samples > Instances sample for the setup details.

In most of productions memory requirements are a major consideration. Large scene graphs containing a lot of nodes can benefit from using instancing to reduce memory costs. For example if you have a house that contains a lot of nodes, instead of duplicating the house many times to create a city, you can create instances of that house.

Creating an instance is done using the linker.

Create an instance of a scene graph node
  1. Create a new scene graph node using the Create/Create Node command.
  2. Press the SceneGraphNode > Instances > Edit button to open the Linker.
  3. In the right column, select the nodes to instanciate.
The nodes you instanciate should have their Transform > Hierarchy Mode attributes set to Inherit. Replace low resolution objects by high resolution instances

Let's replace simple model instances by a complex, high resolution, instance of meshes. We want to keep the low resolution model for OpenGL and switch for a complex instance for the rendering.

  1. In any software, scatter low resolution models or transforms on a surface.

  2. You also need a group including the high resolution models.

  3. Hide the objects inside the high resolution group.
  4. Select all the low resolution objects.
  5. Press the SceneGraphNode > Instances > Edit button to open the Linker.
  6. Select in the right column all the children of the high resolution group. This will instanciate the high resolution models at every low resolution positions.
  7. Add a rule in the RenderGraph to hide the low resolution models. Check the SceneGraphNode > Hidden attribute.

  8. Add a rule in the RenderGraph to show the high resolution models. Uncheck the SceneGraphNode > Hidden attribute.

Get a random color per instance
  1. Make sure the instance root name end with a number, like this:
  2. Apply a Attributes/RandomizeColor node in the DiffuseColor of your instances.
  3. Choose a color and increase the different random parameters.

A single color, and random colors using the RandomizeColor node.

The Library/Attributes/RandomizeColor node. Override an instance

Thanks to the RenderGraph, Guerilla is able to override any attribute of a single instance.

  1. In the Rendergraph, drag'n drop the instance you want to override, or add a RenderGraph/Path node and write the path to the specific high definition instance objects you'd like to override. Here it is ^trees|tree609|leaf$.
  2. Override any attributes you like. Here we put the Surface > Diffuse > Color to red.