Mesh utilities#

The genesis.utils.mesh module provides helpers for loading meshes, generating primitive geometry, tetrahedralizing solids, and converting colors. They operate on trimesh meshes and NumPy arrays.

Loading and decomposition#

genesis.utils.mesh.load_mesh(file)[source]#
genesis.utils.mesh.convex_decompose(mesh, coacd_options)[source]#
genesis.utils.mesh.merge_submeshes(verts_list, faces_list)[source]#

Concatenate sub-meshes into a single mesh, welding vertices that share a position.

Welding covers both duplicated vertices within a sub-mesh (e.g. texture-seam splits) and vertices shared across sub-meshes, so that downstream consumers (e.g. tetrahedralization) see one connected surface.

Parameters:
  • verts_list (list of np.ndarray) – Per-sub-mesh vertex arrays with shape (n_verts, 3).

  • faces_list (list of np.ndarray) – Per-sub-mesh face arrays with shape (n_faces, 3), indexing into the matching vertex array.

Returns:

  • verts (np.ndarray) – Welded vertices, ordered by first occurrence in the concatenated input.

  • faces (np.ndarray) – Concatenated faces, re-indexed against the welded vertices.

  • verts_maps (list of np.ndarray) – For each sub-mesh, the map from its local vertex indices to indices into the welded vertices.

Primitive geometry#

genesis.utils.mesh.create_sphere(radius, subdivisions=3, color=(1.0, 1.0, 1.0, 1.0))[source]#
genesis.utils.mesh.create_cylinder(radius, height, sections=None, color=(1.0, 1.0, 1.0, 1.0))[source]#
genesis.utils.mesh.create_cone(radius, height, sections=None, color=(1.0, 1.0, 1.0, 1.0))[source]#
genesis.utils.mesh.create_box(extents=None, color=(1.0, 1.0, 1.0, 1.0), bounds=None, wireframe=False, wireframe_radius=0.002)[source]#
genesis.utils.mesh.create_plane(normal=(0.0, 0.0, 1.0), plane_size=(1000.0, 1000.0), tile_size=(1, 1), color_or_texture='textures/checker.png', double_sided=False)[source]#
genesis.utils.mesh.create_arrow(length=1.0, radius=0.02, l_ratio=0.25, r_ratio=1.5, body_color=(1.0, 1.0, 1.0, 1.0), head_color=(1.0, 1.0, 1.0, 1.0), sections=12)[source]#
genesis.utils.mesh.create_line(start, end, radius=0.002, color=(1.0, 1.0, 1.0, 1.0), sections=12)[source]#
genesis.utils.mesh.create_frame(origin_radius=0.012, axis_radius=0.005, axis_length=1.0, head_radius=0.01, head_length=0.03, sections=12)[source]#
genesis.utils.mesh.create_camera_frustum(camera, color)[source]#

Tetrahedralization#

genesis.utils.mesh.tetrahedralize_mesh(mesh, tet_cfg)[source]#
genesis.utils.mesh.create_tets_mesh(n_tets=1, halfsize=1.0, quats=None, randomize_halfsize=True)[source]#

Create artistic tet-based mesh for rendering particles as tets.

Color conversion#

genesis.utils.mesh.color_f32_to_u8(color) ndarray[source]#
genesis.utils.mesh.color_u8_to_f32(color) ndarray[source]#
genesis.utils.mesh.glossiness_to_roughness(glossiness: float) float[source]#

Mesh info#

class genesis.utils.mesh.MeshInfo[source]#
class genesis.utils.mesh.MeshInfoGroup[source]#

See also#