Copying Varying copies/instances

See also: Copying to points, Instancing

Overview

Most of the time, when you're creating copies and instances, such as a forest of trees or a crowd of soldiers, you want variations between the copies/instances (unless you're building an army of clones). There are several ways to do this in Houdini.

Copy stamping

Copy stamping is a technique for the Copy to Points tool (not instancing) that lets you change the parameters of the source geometry network for each copy. These gives you the power to completely change the geometry of each copy. See copying to points and copy stamping.

If changing parameters isn’t powerful enough, you can create a Python surface node, or use the VEX surface node or Script surface node. These nodes let you write a script (or create a VOP network) to edit geometry, giving you total power over it.

Material surface node and material overrides

  • When copying, the Material node assigns materials to primitives (e.g. polygons) or points. The Material node lets you override individual parameters on the assigned material. The Material node works by creating shop_material and material_override attributes on the primitives/points. If you instance objects onto the points, the instanced objects pick up the material and overrides specified in the point attributes.

    Material parameter overrides are stored in the material_override attribute as a Python dictionary string representation. If you need total control over how material overrides happen, you could create a Python surface node that sets the material_override attribute manually.

  • When instancing, once you assign a material to an object being instanced, you can use the menu button on the object’s Material tab to create local parameters that override parameters on the material. You can then use instancepoint to vary the parameters.

See property overrides for more information.

By combining overriding material parameters with values using the instancepoint() function, you can vary the material or the override values per instance.

instancepoint function

When you're instancing objects, you can use the instancepoint expression function to vary object parameters (such as transforms) per instance. It returns the point number of the point the object is being instanced onto.

Because instancing only works at the object level, instancepoint is only valid in parameter expressions on objects. See instancing.

Delayed load shader

The delayed load shader replaces an object’s geometry with geometry loaded from disk at render time. You can create multiple geometry archives representing different instance variations, and switch between them per-instance by overriding the material parameter that specifies which geometry archive to load.

Displacement shader

Since you can vary parameters on the object’s material (or switch materials completely) per instance, you can vary the displacement shader. With clever displacement maps you can use this to do limited “modeling” of the instances to vary their geometry.

For example, you could instance flat squares, and use various displacement maps to extrude them into different shapes, such as a cityscape of buildings.

Point attributes

Attributes are pieces of data attached to primitives (e.g. polygons) or points. When you copy or instance geometry onto points, Houdini looks for specific attributes on the destination points to customize each copy/instance.

Attribute nameData typeDescription
orientfloat4 (quaternion)Orientation of the copy
pscalefloatUniform scale
scalefloat3Non-uniform scale
Nvector
upvectorUp vector of the copy
vvectorVelocity of the copy (for orientation and/or motion blur)*
rotfloat4 (quaternion)
transvector
shop_materialstring

Path to a material. You can add this attribute to points using the Material surface node. When you instance an object onto a point with this attribute, the instanced object uses the given material.

material_overridestring

A serialized Python dictionary mapping parameter names to values. You can add this attribute to points using the “override” controls on the Material surface node. When you instance an object onto a point with this attribute, the instanced object applies the given overrides to its material.