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 flattened array of 3D points, i.e. its length 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 flattened array of 3D vectors that describe the normal for each vertex, i.e. its length must be divisible by 3 and more importantly it has to be equal to the length ofpositions
.albedo_factor
, if specified, is either a linear, unmultiplied, normalized RGB (vec3) or RGBA (vec4) value.
Example:
# A simple red triangle:
positions = np.array([0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0])
indices = np.array([0, 1, 2])
normals = np.array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0])
albedo_factor = np.array([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.NDArray[np.float32]
|
A flattened array of 3D points |
required |
indices |
Optional[npt.NDArray[np.uint32]]
|
Optional flattened array of indices that describe the mesh's faces |
None
|
normals |
Optional[npt.NDArray[np.float32]]
|
Optional flattened array of 3D vectors that describe the normal of each vertices |
None
|
albedo_factor |
Optional[npt.NDArray[np.float32]]
|
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.NDArray[np.float32]]
|
A sequence of position buffers, one for each mesh. |
required |
index_buffers |
Sequence[Optional[npt.NDArray[np.uint32]]]
|
An optional sequence of index buffers, one for each mesh. |
required |
normal_buffers |
Sequence[Optional[npt.NDArray[np.float32]]]
|
An optional sequence of normal buffers, one for each mesh. |
required |
albedo_factors |
Sequence[Optional[npt.NDArray[np.float32]]]
|
An optional sequence of albedo factors, one for each mesh. |
required |
timeless |
bool
|
If true, the mesh will be timeless (default: False) |
False
|