esc
Start typing to search the docs
Navigate Open

Voxel­Grid­Map

⚠️ This type is unstable and may change significantly in a way that the data won't be backwards compatible. A sparse 3D voxel grid map with grid indices and voxel dimensions.

This archetype is intended for 3D occupancy maps and other volumetric data represented as a sparse grid of voxels with scene-unit dimensions along the local X/Y/Z axes.

The minimum corner of the voxel with [0, 0, 0] index is located at the origin of the entity's coordinate frame and can have an additional offset from there through the optional translation and rotation fields.

A voxel center is at (index + 0.5) * voxel_size in local grid coordinates (i.e. relative to the minimum corner).

Fields

Required

Optional

Can be shown in

Example

Simple sparse voxel grid map

"""Log a simple sparse voxel grid map."""

import numpy as np

import rerun as rr

voxel_indices = np.array(
    [
        [-1, 0, 0],
        [1, 0, 0],
        [1, 1, 0],
        [3, 0, 0],
        [3, 0, 1],
        [4, 0, 1],
    ],
    dtype=np.int32,
)
values = np.array([0.0, 0.2, 0.4, 0.6, 0.8, 1.0], dtype=np.float32)

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

rr.log(
    "world/voxels",
    rr.VoxelGridMap(
        voxel_indices,
        voxel_size=[0.25, 0.25, 0.25],
        values=values,
        value_range=[0.0, 1.0],
        colormap=rr.components.Colormap.Turbo,
        translation=[-0.5, -0.5, 0.0],
    ),
)