mesh.py
rerun.log.mesh
def log_mesh(entity_path, positions, *, indices=None, normals=None, albedo_factor=None, timeless=False)
Log a raw 3D mesh by specifying its vertex positions, and optionally indices, normals and albedo factor.
The data is always interpreted as a triangle list:
positions
is a (potentially flattened) array of 3D points, i.e. the total number of elements must be divisible by 3.indices
, if specified, is a flattened array of indices that describe the mesh's faces, i.e. its length must be divisible by 3.normals
, if specified, is a (potentially flattened) array of 3D vectors that describe the normal for each vertex, i.e. the total number of elements must be divisible by 3 and more importantly,len(normals)
should be equal tolen(positions)
.albedo_factor
, if specified, is either a linear, unmultiplied, normalized RGB (vec3) or RGBA (vec4) value.
Example:
# A simple red triangle:
rerun.log_mesh(
"world/mesh",
positions = [
[0.0, 0.0, 0.0],
[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0]
],
indices = [0, 1, 2],
normals = [
[0.0, 0.0, 1.0],
[0.0, 0.0, 1.0],
[0.0, 0.0, 1.0]
],
albedo_factor = [1.0, 0.0, 0.0],
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entity_path |
str
|
Path to the mesh in the space hierarchy |
required |
positions |
npt.ArrayLike
|
An array of 3D points |
required |
indices |
Optional[npt.ArrayLike]
|
Optional array of indices that describe the mesh's faces |
None
|
normals |
Optional[npt.ArrayLike]
|
Optional array of 3D vectors that describe the normal of each vertices |
None
|
albedo_factor |
Optional[npt.ArrayLike]
|
Optional RGB(A) color for the albedo factor of the mesh, aka base color factor. |
None
|
timeless |
bool
|
If true, the mesh will be timeless (default: False) |
False
|
def log_meshes(entity_path, position_buffers, *, index_buffers, normal_buffers, albedo_factors, timeless=False)
Log multiple raw 3D meshes by specifying their different buffers and albedo factors.
To learn more about how the data within these buffers is interpreted and laid out, refer
to log_mesh
's documentation.
- If specified,
index_buffers
must have the same length asposition_buffers
. - If specified,
normal_buffers
must have the same length asposition_buffers
. - If specified,
albedo_factors
must have the same length asposition_buffers
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entity_path |
str
|
Path to the mesh in the space hierarchy |
required |
position_buffers |
Sequence[npt.ArrayLike]
|
A sequence of position buffers, one for each mesh. |
required |
index_buffers |
Sequence[Optional[npt.ArrayLike]]
|
An optional sequence of index buffers, one for each mesh. |
required |
normal_buffers |
Sequence[Optional[npt.ArrayLike]]
|
An optional sequence of normal buffers, one for each mesh. |
required |
albedo_factors |
Sequence[Optional[npt.ArrayLike]]
|
An optional sequence of albedo factors, one for each mesh. |
required |
timeless |
bool
|
If true, the mesh will be timeless (default: False) |
False
|