CuMesh is a GPU-accelerated library designed for high-performance 3D geometry processing directly within the PyTorch ecosystem. It provides efficient primitives for mesh cleaning, decimation, remeshing, and UV unwrapping.
Key features include:
- CUDA-Accelerated Mesh Operations: Fast topology queries, simplification, hole filling, and cleaning.
- Remeshing: Remesh arbitrary meshes using narrow-band UDF and Dual Contouring.
- UV Unwrapping: Efficient UV parameterization with
xatlasenhenced by a fast mesh clustering on the GPU.
- Python >= 3.8
- PyTorch >= 2.4 (with CUDA support)
- CUDA Toolkit >= 12.4 (matching your PyTorch version)
git clone https://github.com/JeffreyXiang/CuMesh.git --recursive
pip install CuMesh --no-build-isolationSee the examples directory for more detailed usage.
init(vertices, faces): Initialize mesh with[V,3]and[F,3]CUDA tensors.read(): Return current(vertices, faces)tensors.simplify(target_num_faces, verbose=False, options={}): Fast GPU-accelerated mesh decimation.uv_unwrap(verbose=False, ...): Generate UVs using accelerated clustering and Xatlas.fill_holes(max_hole_perimeter): Triangulate and close boundary loops.repair_non_manifold_edges(): Split edges to resolve non-manifold geometry.remove_degenerate_faces(): Remove zero-area faces or those with NaN normals.remove_duplicate_faces(): Remove faces with identical vertex indices.remove_small_connected_components(min_area): Delete isolated components below area threshold.unify_face_orientations(): Reorient faces to have consistent winding order.compute_face_normals(),compute_vertex_normals(): Trigger normal calculation (access viaread_*_normals).get_connected_components(): Compute connectivity (access viaread_connected_components).get_boundary_loops(): Detect boundaries (access viaread_boundary_loops).- Properties:
num_vertices,num_faces,num_edges,num_boundaries.
remesh_narrow_band_dc(...): Performs Dual Contouring reconstruction based on the UDF of the input mesh.
NOTE: This is a wrapper around the cubvh library.
NOTE: This is a wrapper around the xatlas library.
add_mesh(vertices, faces, normals=None, uvs=None): Register mesh geometry (Must be CPU tensors).compute_charts(max_chart_area, ...): Segment mesh into UV charts (parameterization).pack_charts(resolution, padding, ...): Pack generated charts into a texture atlas.get_mesh(index): Retrieve processed data as(vertex_map, faces, uvs).vertex_map: Maps new vertex indices to original input indices.
This package builds upon and integrates code from several excellent open-source libraries. We would like to express our gratitude to the authors of: