diff --git a/genesis/engine/mesh.py b/genesis/engine/mesh.py index 2afe406e1c..95f5d55fde 100644 --- a/genesis/engine/mesh.py +++ b/genesis/engine/mesh.py @@ -93,23 +93,15 @@ def decimate(self, decimate_face_num, decimate_aggressiveness, convexify): """ if self._mesh.vertices.shape[0] > 3 and self._mesh.faces.shape[0] > decimate_face_num: self._mesh.process(validate=True) - # TODO: lossless option support is pending on fast_simplification package. - # NOTE: https://github.com/pyvista/fast-simplification/pull/71 - if decimate_aggressiveness == 0: - gs.logger.debug("Lossless simplification is not supported yet. Not applying simplification.") - self._mesh = trimesh.Trimesh( - vertices=self._mesh.vertices, - faces=self._mesh.faces, - ) - else: - self._mesh = trimesh.Trimesh( - *fast_simplification.simplify( - self._mesh.vertices, - self._mesh.faces, - target_count=decimate_face_num, - agg=decimate_aggressiveness, - ) + self._mesh = trimesh.Trimesh( + *fast_simplification.simplify( + self._mesh.vertices, + self._mesh.faces, + target_count=decimate_face_num, + agg=decimate_aggressiveness, + lossless=(decimate_aggressiveness == 0), ) + ) # need to run convexify again after decimation, because sometimes decimating a convex-mesh can make it non-convex... if convexify: diff --git a/genesis/utils/terrain.py b/genesis/utils/terrain.py index f790c667e4..2268670ce7 100644 --- a/genesis/utils/terrain.py +++ b/genesis/utils/terrain.py @@ -386,14 +386,12 @@ def convert_heightfield_to_watertight_trimesh( # This is the mesh used for non-sdf purposes. # It's losslessly simplified from the full mesh, to save memory cost for storing verts and faces. - # TODO: lossless option support is pending on fast_simplification package. - # v_simp, f_simp = fast_simplification.simplify( - # sdf_mesh.vertices, - # sdf_mesh.faces, - # target_count=0, - # lossless=True, - # ) - v_simp, f_simp = sdf_mesh.vertices, sdf_mesh.faces + v_simp, f_simp = fast_simplification.simplify( + sdf_mesh.vertices, + sdf_mesh.faces, + target_count=0, + lossless=True, + ) if uvs is not None: idx_map = np.empty(len(v_simp), dtype=np.int64) diff --git a/pyproject.toml b/pyproject.toml index 81f75a4893..94efedcf2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,7 +60,7 @@ dependencies = [ # Native batch renderer specifically designed for Genesis "gs-madrona>=0.0.2; platform_system == 'Linux' and (platform_machine == 'x86_64' or platform_machine == 'AMD64')", # Used for mesh simplification - "fast_simplification", + "fast_simplification>=0.1.12", ] [project.optional-dependencies]