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
Bullet Physics Integration #1 #91
Bullet Physics Integration #1 #91
Conversation
… castle & teleport with key
Pull from fb master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some high-level comments. This should be rebased on master ASAP as that will make seeing how it interfaces with the current code easier.
src/esp/assets/ResourceManager.cpp
Outdated
@@ -227,15 +461,27 @@ bool ResourceManager::loadGeneralMeshData(const AssetInfo& info, | |||
MeshMetaData metaData; | |||
loadTextures(*importer, &metaData); | |||
loadMaterials(*importer, &metaData); | |||
loadMeshes(*importer, &metaData); | |||
loadMeshes(*importer, &metaData, shiftOrigin); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the origin shift needed? That will probably break all of our current episode datasets. We will also have to make sure we propagate the new origin to the annotations for MP3D.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default shift is false. If shifted, the transform is now stored for query. This is only expected to be used for object meshes, not static scenes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just quickly went through -- please have a look at the reinterpret_cast
s ;)
src/esp/assets/PhysicsManager.cpp
Outdated
} | ||
|
||
// TODO (JH) Bottom up search gives bus error because scene"s rootnode does | ||
// not point to nullptr, but something strange |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... or maybe it points to Scene
from Magnum's SceneGraph and so static_cast<const scene::SceneNode*>
will likely not work?
…gs, fixed dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As soon it's passing CI it looks good to be merged.
src/esp/assets/CMakeLists.txt
Outdated
tinyply | ||
PRIVATE | ||
Assimp::Assimp | ||
geo | ||
io | ||
) | ||
|
||
set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we need this?
(*cpu_vbo_3_)[i] = cpu_vbo_[i].head<3>(); | ||
} | ||
|
||
// create ibo converting quads to tris [0, 1, 2, 3] -> [0, 1, 2],[0,2,3] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// create ibo converting quads to tris [0, 1, 2, 3] -> [0, 1, 2],[0,2,3] | |
// create ibo converting quads to tris [0, 1, 2, 3] -> [0, 1, 2], [0, 2, 3] |
"FPS is below regression threshold: %0.1f < %0.1f" | ||
% (perf["fps"], args.test_fps_regression) | ||
) | ||
# assert perf["fps"] > args.test_fps_regression, ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aclegg3, maybe I missed the comment. Can you remind me why we commented out the speed regression check??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be there when not running with physics. May have been commented out in the rush to verify physics pybind, sorry for that. We will need a separate threshold for the new physics benchmarks, but we can add this back when enable_physics is false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aclegg3, no worries, just wanted to check there is no serious reason to disable it.
* Introduced esp/assets/PhysicsManager to track & manage states of kinematic and physically simulated objects in Habitat-sim. Functionality includes adding/removing objects, kinematic updates, applying forces/torques, getters/setters for physical properties. * Introduced esp/physics/BulletObject as an extended SceneNode. BulletObject interacts with PhysicsManager to create collision mesh, set object properties, and interface with specific physics engine implementations. * Introduced global and object specific physics config files (JSON), parsers, containers, and resource libraries in esp/assets/ResourceManager. * Introduced dynamic simulation of rigid objects through optional build with Bullet physics engine (build argument --bullet with Bullet3 installed). * Implemented python bindings for basic physics functionality exposed through simulator.py. * Implemented physics functionality demos in C++ (Viewer.cpp) and python (example.py).
Motivation and Context
Types of changes
esp/assets/PhysicsManager
(similar toesp/assets/ResourceManager
in style) to track & manage states of physics simulation, such as bulletWorld, FPS, timestep, objects etcesp/physics/BulletObject
as an extended SceneNode. BulletObject interacts with PhysicsManager to create collision mesh, set object properties, etc.loadObject(xyz, rotation)
setObject(ID, xyz, rotation)
removeObject(ID)
viewer.cpp
to habitat coreChallenges 💥
PHY_INTEGER
, incompatible withMagnum::UnsignedInt
)Checklist
getMeshData()
function can better interface with PhysicsManager to create collision meshView.cpp
with--enbable-physics
optionView.cpp
backward compatiblePhysicsManager
andResourceManager
loadObject
andaddObject
Support cloning object by cloning sceneNode(decided to push to next PR)PR Milestones
July 2 GLB Scene
July 4 Surreal Scene
July 5 Replica Scene
Tested on Gibson & MP3D