Skip to content

Conversation

@sebcrozet
Copy link
Member

This PR adds contact manifold reduction, ensuring that each contact manifold only result in up to 4 solver contacts (in 3D). This simplifier the solver code further by ensuring a 1-to-1 matching between solver contact manifolds and contact constraints. Two manifold reductions strategies are implemented:

  • One "naive" approach that takes the deepest contact, the one furthest to it, and the two contacts furthest to the segment formed by the first two.
  • A more complex approach (albeit similar to the first one) that is a port of Bepu’s manifold reduction. This has been implemented for comparison purpose.

In practice, I selected the first approach as it appeared to work well with less operations than the more complex one. I’m keeping the second approach around for now for additional future experiments.


This PR also adds persistent islands. Instead of recalculating the simulation islands at each simulation step, both awake and sleeping islands are persisted across frames and updated incrementally. Whenever a rigid-body desires to sleep, it triggers (in some future frame) a connected-component traversal of the contact/joint graphs in order to attempt to extract a sleeping island.

In addition, an islands optimizer (that could use a bit more tuning) has been implemented to ensure (as long as it doesn’t affect correctness) that islands are neither too small nor too big. This results in generally better performances due to better cache utilisation. The island optimizer runs a small amount of work at each frame, progressively balancing the islands sizes.

The persistent islands optimization results in a performance improvement between 10% to 20% depending on the stress test. The graph below are examples of perf improvements (blue is current master, red is this PR) on some of our stress tests (all_benchmarks3):
balls-times
capsules-times
stacks-times

@Ughuuu
Copy link
Contributor

Ughuuu commented Nov 29, 2025

Can the same contact manifold reduction be applied to 2d also? Or is it specific to 3d only? Thanks. Cool stuff also!

@sebcrozet
Copy link
Member Author

@Ughuuu 2D contact manifold are already limited to up to 2 points, so no additional reduction is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants