InstancePoses3D

One or more transforms applied on the current entity's transform frame.

Unlike archetypes.Transform3D, it is not propagated in the transform hierarchy. If archetypes.CoordinateFrame is specified, it acts relative to that coordinate frame, otherwise it is relative to the entity's implicit coordinate frame.

Whenever you log this archetype, the state of the resulting overall pose is fully reset to the new archetype. This means that if you first log a pose with only a translation, and then log one with only a rotation, it will be resolved to a pose with only a rotation. (This is unlike how we usually apply latest-at semantics on an archetype where we take the latest state of any component independently)

From the point of view of the entity's coordinate system, all components are applied in the inverse order they are listed here. E.g. if both a translation and a mat3x3 transform are present, the 3x3 matrix is applied first, followed by the translation.

Currently, many visualizers support only a single instance transform per entity. Check archetype documentations for details - if not otherwise specified, only the first instance transform is applied. Some visualizers like the mesh visualizer used for archetypes.Mesh3D, will draw an object for every pose, a behavior also known as "instancing".

Fields fields

Optional optional

Can be shown in can-be-shown-in

Examples examples

Regular & instance transforms in tandem regular--instance-transforms-in-tandem

"""Log a simple 3D box with a regular & instance pose transform."""

import numpy as np
import rerun as rr

rr.init("rerun_example_instance_pose3d_combined", spawn=True)

rr.set_time("frame", sequence=0)

# Log a box and points further down in the hierarchy.
rr.log("world/box", rr.Boxes3D(half_sizes=[[1.0, 1.0, 1.0]]))
lin = np.linspace(-10, 10, 10)
z, y, x = np.meshgrid(lin, lin, lin, indexing="ij")
point_grid = np.vstack([x.flatten(), y.flatten(), z.flatten()]).T
rr.log("world/box/points", rr.Points3D(point_grid))

for i in range(180):
    rr.set_time("frame", sequence=i)

    # Log a regular transform which affects both the box and the points.
    rr.log("world/box", rr.Transform3D(rotation_axis_angle=rr.RotationAxisAngle([0, 0, 1], angle=rr.Angle(deg=i * 2))))

    # Log an instance pose which affects only the box.
    rr.log("world/box", rr.InstancePoses3D(translations=[0, 0, abs(i * 0.1 - 5.0) - 5.0]))

3D mesh with instancing 3d-mesh-with-instancing

"""Log a simple 3D mesh with several instance pose transforms which instantiate the mesh several times and will not affect its children (known as mesh instancing)."""

import rerun as rr

rr.init("rerun_example_mesh3d_instancing", spawn=True)
rr.set_time("frame", sequence=0)

rr.log(
    "shape",
    rr.Mesh3D(
        vertex_positions=[[1, 1, 1], [-1, -1, 1], [-1, 1, -1], [1, -1, -1]],
        triangle_indices=[[0, 2, 1], [0, 3, 1], [0, 3, 2], [1, 3, 2]],
        vertex_colors=[[255, 0, 0], [0, 255, 0], [0, 0, 255], [255, 255, 0]],
    ),
)
# This box will not be affected by its parent's instance poses!
rr.log(
    "shape/box",
    rr.Boxes3D(half_sizes=[[5.0, 5.0, 5.0]]),
)

for i in range(100):
    rr.set_time("frame", sequence=i)
    rr.log(
        "shape",
        rr.InstancePoses3D(
            translations=[[2, 0, 0], [0, 2, 0], [0, -2, 0], [-2, 0, 0]],
            rotation_axis_angles=rr.RotationAxisAngle([0, 0, 1], rr.Angle(deg=i * 2)),
        ),
    )