|On this page|
Instancing replaces an object with another at render time. This lets you, for example, use lightweight proxy geometry from the 3D display, and swap it efficiently for more heavyweight, detailed geometry at render time.
Point instancing replaces the points of an object with other objects at render time. This makes it easy to create a large number of efficient copies of an object. For example, scatter points on a surface representing a meadow, and replace them in the render with trees.
Because instancing takes place in the renderer, the instanced geometry does not use memory or slow down the display as you work in Houdini. On the other hand, since you can’t see the instanced geometry in the viewport, it might be hard to visualize the finished scene.
Point instancing is very similar to particle instancing.
Using the delayed load shader lets you store the geometry to instance on disk rather than in the scene.
In the network editor, create an Instance object at the object level.
In the object’s parameters, click the Instance tab and set the Instance object parameter to the path of the object you want to instance onto the points of the Instance object. (You can drag the node from the network onto the parameter to set it.) Turn on Point instancing to instance onto the points of the Instance object instead of replacing the Instance object.
Go inside the Instance object and model the template geometry. The object you set above to instance will be copied onto the points of this geometry at render time.
(See how to use the network editor if you need help working with the network and the parameter editor.)
The Instance object is just a regular Geometry container object with some extra render properties related to instancing added to it. You could manually turn any object into an instancing object by adding the same properties (in the parameter editor, Gear menu > Edit rendering parameters, open Mantra x.x folder, and drag the Instance folder into the Existing parameters list). However, it’s usually more convenient to start with the Instance object.
How it works
You can only instance object-level nodes using point instancing: geometry container objects, lights, cameras, object subnets, object-level digital assets, and so on.
You can vary object-level parameters for each instance, such as transforms. You can also override material parameters per-instance, which can be very powerful. Instances can also pick up various attributes from the points they are instanced onto. See varying copies and instances for more information.
Instancing is fast and efficient because the renderer only needs to keep one copy of the object’s geometry, and just output it multiple times for each instance. This means that the object’s actual surface geometry cannot changed between instances.
For example, you could have a skyscraper object asset with a parameter that changed the surface network inside to vary the number of floors. You could not instance the object with varying number of floors, because the renderer keeps one copy of the object’s geometry for instancing. To do instancing with varying geometry, you would have to do one of the following:
If possible, change the asset so its variation works at the object level instead of the geometry level (for example, a skyscraper asset where each part is an object).
The viewport renderer supports instancing to a limited degree. Simple and point instancing are supported at the object level using an Instance object or a geometry object with instancing parameters. The viewport supports:
Simple instancing, where point instancing is not used and the object references another object’s geometry.
Point instancing, where an object’s geometry is instanced onto each point in the instancing object. Point attributes can be used to vary the transform.
Point instancing with the object path or transform varying by the value of an instancepoint() expression.
Point instancing with the object path specified by a point
Variations of the above cases are also supported (some parameters driven by
instancepoint(), others by attributes).
The number of instances can be reduced to improve performance by changing the Point Instancing percentage on the Geometry tab of the viewport Display Options. The number of instances that can be displayed in a fluid manner is dependent on your graphics hardware. Point Instancing can also be turned off to show the underlying instancing point geometry.
Entering the instance object will show the instancing geometry rather than the instances themselves, similar to disabling the Point Instancing display option.
You can set the Instancing Limit on the Geometry tab of the 3D View Display Options dialog to the maximum number of OpenGL primitives that can be instanced before some instances start being replaced by the Stand-In Geometry. This prevents the graphics card from being overrun by a huge amount of rendering which could halt or reset the graphics driver. Setting this to zero will always use the stand-in geometry.
Older tutorials suggest using a Copy SOP with its display flag turned on and its input with the render flag turned on to emulate Point Instancing. This was the way to show instances in the viewport before instancing was natively supported by the viewport. In this case, the Copy SOP is being used to replicate the geometry. Now you can skip this step because the viewport’s Point Instancing feature will do this for you.
If you use both the Copy SOP method and the viewport’s Point Instancing, it will display the instance object on all the points of the replicated geometry, which is not only incorrect but will be very slow due to the huge number of instances being displayed.