InstancePoses3D
One or more transforms between the current entity and its parent. Unlike archetypes.Transform3D
, it is not propagated in the transform hierarchy.
If both archetypes.InstancePoses3D
and archetypes.Transform3D
are present,
first the tree propagating archetypes.Transform3D
is applied, then archetypes.InstancePoses3D
.
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 max3x3 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".
Components components
Optional: PoseTranslation3D
, PoseRotationAxisAngle
, PoseRotationQuat
, PoseScale3D
, PoseTransformMat3x3
Shown in shown-in
- Spatial3DView
- Spatial2DView (if logged above active projection)
- DataframeView
API reference links api-reference-links
- 🌊 C++ API docs for
InstancePoses3D
- 🐍 Python API docs for
InstancePoses3D
- 🦀 Rust API docs for
InstancePoses3D
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_sequence("frame", 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]]))
rr.log("world/box/points", rr.Points3D(np.vstack([xyz.ravel() for xyz in np.mgrid[3 * [slice(-10, 10, 10j)]]]).T))
for i in range(0, 180):
rr.set_time_sequence("frame", 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_sequence("frame", 0)
rr.log(
"shape",
rr.Mesh3D(
vertex_positions=[[1, 1, 1], [-1, -1, 1], [-1, 1, -1], [1, -1, -1]],
triangle_indices=[[0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3]],
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(0, 100):
rr.set_time_sequence("frame", 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)),
),
)