Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mesh joining for unstable Bullet collision compounds. #317

Merged
merged 47 commits into from
Dec 16, 2019

Conversation

aclegg3
Copy link
Contributor

@aclegg3 aclegg3 commented Oct 22, 2019

Motivation and Context

Related to Issue #301

Blocked by: PRs #309, #310. (diff includes these)

This PR addresses remaining physics instabilities when loading hierarchal meshes as Bullet rigid object by introducing optional but default mesh joining for more stable simulation of compound objects.

Mesh joining:

Creating compound shapes as combinations of convex components can be an effective way of introducing macro concavities efficiently into simulation. PR #310 added this functionality by computing convex hulls for each mesh in a loaded collision mesh hierarchy and combining them into a single btCompoundShape object. However, when individual convex hulls overlap significantly, this treatment can result in unstable simulation artifacts.
This is demonstrated by simulation of a compound box shape with 2 convex sub-boxes only slightly offset from one another:
cube_compound_jitter_example
To remedy this, meshes can be joined into one convex hull, losing any concavity for improved stability and efficiency:
joined_cubecube

The mesh join option is added to the physics object config with default true for stability.

How Has This Been Tested

Local testing.

Simulating random hierarchal objects after mesh joining and COM shift:
joined_convex_test_short

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

…oggle in phyisics manager. Updated viewer with BB toggle function.
@aclegg3 aclegg3 self-assigned this Oct 22, 2019
@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Oct 22, 2019
Copy link
Contributor

@msbaines msbaines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add some CI tests for this.

@aclegg3 aclegg3 changed the title Mesh joining and bounding box COM shift for Bullet collision compounds. Mesh joining for unstable Bullet collision compounds. Oct 29, 2019
src/esp/assets/MeshMetaData.h Outdated Show resolved Hide resolved
src/esp/assets/MeshMetaData.h Show resolved Hide resolved
src/esp/assets/ResourceManager.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@erikwijmans erikwijmans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aclegg3 what's the status of this PR, is it good to land?

@aclegg3
Copy link
Contributor Author

aclegg3 commented Dec 3, 2019

@aclegg3 what's the status of this PR, is it good to land?

Waiting on C++ test coverage for new functions. Functionality is fine. I'll look into this soon.

@codecov-io
Copy link

codecov-io commented Dec 9, 2019

Codecov Report

Merging #317 into master will increase coverage by 0.83%.
The diff coverage is 87.4%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #317      +/-   ##
==========================================
+ Coverage   56.89%   57.73%   +0.83%     
==========================================
  Files         153      154       +1     
  Lines        7067     7143      +76     
==========================================
+ Hits         4021     4124     +103     
+ Misses       3046     3019      -27
Impacted Files Coverage Δ
src/esp/assets/MeshMetaData.h 81.81% <ø> (-4.39%) ⬇️
src/esp/assets/ResourceManager.h 100% <ø> (ø) ⬆️
src/esp/physics/PhysicsManager.cpp 45.04% <0%> (+6.68%) ⬆️
src/esp/physics/bullet/BulletPhysicsManager.cpp 45.74% <100%> (ø) ⬆️
src/esp/assets/Attributes.cpp 36.46% <100%> (+4.82%) ⬆️
src/esp/physics/bullet/BulletRigidObject.cpp 61.13% <100%> (+6%) ⬆️
src/tests/PhysicsTest.cpp 100% <100%> (ø)
src/esp/physics/PhysicsManager.h 51.85% <100%> (+1.85%) ⬆️
src/esp/assets/ResourceManager.cpp 59.13% <73.07%> (+0.39%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce5a4b8...cf919e9. Read the comment docs.

… assets. Modified object asset loading pipeline to allow programmatic object template generation. Fixed some bugs.
@aclegg3 aclegg3 merged commit d725829 into master Dec 16, 2019
@aclegg3 aclegg3 deleted the bounding-box-com-shift branch December 16, 2019 17:59
Ram81 pushed a commit to Ram81/habitat-web-sim that referenced this pull request Dec 10, 2020
…ch#317)

* Building bullet compound collision object from hierarchies of convexified meshes.

* Added join mesh default for stable collision behavior.

* Added physics object parser option for collision mesh joining

* Added physics C++ test for mesh joining. Added small test assets. Modified object asset loading pipeline to allow programmatic object template generation. 

* Fixed some bugs.

* Added some docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants