-
Notifications
You must be signed in to change notification settings - Fork 524
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
TriangleMeshReceptacles and RearrangeGenerator Improvements #1108
Conversation
…nd improved debugging
.circleci/config.yml
Outdated
git fetch --all | ||
git checkout receptacle-test-assets |
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.
Testing only: this will be removed before merge.
), "Must be a triangle mesh." | ||
|
||
# zero-copy reference to importer datastructures | ||
mesh_data: Tuple[List[mn.Vector3], List[int]] = ( |
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.
If you'd want to be exact with the typing annotation, the actual type is cr.containers.StridedArrayView1D, not a List
, but right now I don't have the []
"templating" implemented so saying cr.StridedArrayView1D[mn.Vector3]
would probably cause Python to complain.... and without it it's maybe too nondescriptive (like np.ndarray
is). I'll investigate what can be done on that front (implementing __getitem__
on the typeclass? huh).
dblr.draw_transformed_line( | ||
verts[edge], verts[(edge + 1) % 3], color | ||
) | ||
dblr.pop_transform() |
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 FYI, the dedicated tool for drawing wireframes (without having to manually compose them out of line segments) is the MeshVisualizer shader. I think it was used somewhere in the C++ viewer already, but no idea how easy is it to make it available here.
In case the shader would be available, you'd keep the original MeshData (instead of taking just views on positions and indices from it) and draw it directly with the shader.
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.
Cool suggestion, I think this would be a cool way to do some debugging visualization in the future. Construct MeshData for the debug mesh and then register it for the MeshVisualizer shader.
Is this exposed to python in some way that it could draw on top of an existing framebuffer or would it need to be built into the Habitat rendering pipeline on the C++ side?
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.
The shader isn't exposed at the moment (but I could do that easily), and yes that would work as long as you either have the framebuffer currently bound or have a way to access & bind it for drawing.
On the other hand, such direct approach would be very incompatible with the batch renderer ... so for easier porting in the future it's probably best to just leave it as-is 😅 The debug line drawing will have to get ported to the batch renderer in any case, and I could then maybe expand it to handle also wireframe meshes somehow.
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.
Looks great. Left some comments, but I do not have much to say about the overall change.
# NOTE: We don't support mesh merging or multi-mesh parsing currently | ||
if importer.mesh_count > 1: | ||
raise NotImplementedError("TODO: multi-mesh receptacle support.") |
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.
# NOTE: We don't support mesh merging or multi-mesh parsing currently | |
if importer.mesh_count > 1: | |
raise NotImplementedError("TODO: multi-mesh receptacle support.") | |
# TODO: We don't support mesh merging or multi-mesh parsing currently | |
if importer.mesh_count > 1: | |
raise NotImplementedError("Importing multi-mesh receptacles (mesh merging or multi-mesh parsing) is not supported. ") |
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.
I could expose MeshTools::concatenate() and SceneTools::flattenMeshHierarchy() for doing this if you want.
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.
I think folks are hoping to eventually have multiple separate meshes in a single file which we'll split out here.
Generally happy to see more Magnum mesh tools in python though. 🙂
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.
Update: I think we want to store separate receptacle meshes as glTF nodes. So here we'll load the glTF file and iterate over all meshes in the scene, creating a TriangleMeshReceptacle for each one.
Thanks, I've addressed your comments and resolved those not containing additional discussion. |
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.
LGTM, I would prefer another approval from @mosra if possible.
@@ -0,0 +1,54 @@ | |||
--- |
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.
Where is this file used? I could not found a test that was using it.
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.
This is for users to test generation on their scenes with all receptacles defined without needing to define another custom generator config. I can remove it from this PR if that isn't a good enough reason to include it.
…research#1108) * updates to rearrange episode generation to support mesh receptacles and improved debugging * docstrings and typing for DebugVisualizer util * mesh receptacle debug_draw with global transforms * add some tests for sampling accuracy * bugfix - use default_sensor_uid instead of hardcoded "rgb" in DebugVisualizer * adjust debug peek target to bb center to better capture objects not centered at COM * add debug circles to the peek API * add peek_scene variant for easliy getting images of a full scene or stage.
* TriangleMeshReceptacles and RearrangeGenerator Improvements (#1108) * updates to rearrange episode generation to support mesh receptacles and improved debugging * docstrings and typing for DebugVisualizer util * mesh receptacle debug_draw with global transforms * add some tests for sampling accuracy * bugfix - use default_sensor_uid instead of hardcoded "rgb" in DebugVisualizer * adjust debug peek target to bb center to better capture objects not centered at COM * add debug circles to the peek API * add peek_scene variant for easliy getting images of a full scene or stage. * RearrangeGenerator cleanup and unstable object culling (#1248) * fix unstable object culling compatibility with target sampling and change default to use this feature * add comments and typing * fix bug where only the first of a target sampler's object samplers was used * Add support for glTF multi-receptacle assets (#1249) * add support for glTF multi-receptacle assets with each sub-mesh instantiating a unique Receptacle. * update receptacle names in test for new code * refactor to use Meshdata internally * convert triangle-like primitives to triangles. * refactor to use Receptacle unique_name for sample filtering. Add support for filter files configured in scene instance config user_defined fields. * refactor snapping functionality to improve stability by estimating consistency of support surface from bb corners projected in gravity direction * Update habitat-lab/habitat/sims/habitat_simulator/sim_utilities.py Co-authored-by: Aaron Gokaslan <[email protected]> * turn off additional stability culling for now * bugfix * fix margin issues * Add TODO comment * Misc changes to work with merge * Add missing import * Fix target sampling bug * Remove unneeded code * Add changes to test previously missed --------- Co-authored-by: Alexander Clegg <[email protected]> Co-authored-by: Aaron Gokaslan <[email protected]>
…research#1108) * updates to rearrange episode generation to support mesh receptacles and improved debugging * docstrings and typing for DebugVisualizer util * mesh receptacle debug_draw with global transforms * add some tests for sampling accuracy * bugfix - use default_sensor_uid instead of hardcoded "rgb" in DebugVisualizer * adjust debug peek target to bb center to better capture objects not centered at COM * add debug circles to the peek API * add peek_scene variant for easliy getting images of a full scene or stage.
…research#1108) * updates to rearrange episode generation to support mesh receptacles and improved debugging * docstrings and typing for DebugVisualizer util * mesh receptacle debug_draw with global transforms * add some tests for sampling accuracy * bugfix - use default_sensor_uid instead of hardcoded "rgb" in DebugVisualizer * adjust debug peek target to bb center to better capture objects not centered at COM * add debug circles to the peek API * add peek_scene variant for easliy getting images of a full scene or stage.
Motivation and Context
New features include:
Changes include:
How Has This Been Tested
Added unit tests specifically for parsing and sampling from
AABBReceptacle
s andTriangleMeshReceptacle
s.Must be tested against habitat-sim PR 1994 with modified test assets.
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)
Checklist