Skip to content

[Bug]: [CoacdOptions] Setting CoACDOptions with PCA=True causes collision detection collapse #2747

@TangYucopper

Description

@TangYucopper

Bug Description

When calling add_entity with pca=True in CoACDOptions, the underlying coacd actually applies a transformation to the mesh without transforming back, causing the collision body misaligned with the actual mesh

Steps to Reproduce

Run the following code snippet on my scenes with pca=True, and you will find that the stable scenes become unstable and collapse with weird collision performance. Sry I cannot provide the scene files as github does not support .glb file uploading

    obj = scene.add_entity(
        gs.morphs.Mesh(
            file=str(glb_file.absolute()),
            parse_glb_with_zup=True,
            fixed=fixed,
            decompose_object_error_threshold=0.001,
            coacd_options=gs.options.CoacdOptions(
                threshold = 0.03,
                max_convex_hull = -1,
                preprocess_mode = "auto",
                preprocess_resolution = 30,
                resolution = 2000,
                mcts_nodes = 20,
                mcts_iterations = 100,
                mcts_max_depth = 3,
                pca = True,
                merge = True,
                decimate = False,
                max_ch_vertex = 256,
                extrude = True,
                extrude_margin = 0.03,
                apx_mode = "ch",
                seed = 0,
            )
        ),
        material=gs.materials.Rigid(
            rho=rho,
        )
    )

Expected Behavior

I believe that the problem has already been raised by SarahWeiii/CoACD#100, although I haven't checked it myself. Until further updates by the CoACD official repo, maybe an assertion that pca=False when processing CoacdOptions is appropriate.

Screenshots/Videos

with pca=False, my scene is stable:

Image

otherwise, it collapses:

Image

I have been able to locate the problem to coacd's implementation. As you can see, the collision body does not align with the original mesh with pca=True.

Image

Relevant log output

Environment

  • OS: [e.g. Ubuntu 24.04, Windows 11 24H2]
  • GPU/CPU [e.g. A100, RTX 4090, M3pr, Intel I9-9900k, Ryzen 5900x] (N/A if no GPU/CPU)
  • GPU-driver version (N/A if no GPU)
  • CUDA / CUDA-toolkit version (N/A if non-Nvidia)

Release version or Commit ID

0.4.6

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions