-
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
Added GFX Blender Replay Script #1041
base: main
Are you sure you want to change the base?
Conversation
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.
Thank you, Andrew!
Several comments:
- Let's add link to GFX as that's not clear what it is for users working with HabLab.
- Let's add the scrip description to Argument parser as well.
- is there an option to add some smoke test for the scrip to make sure it won't be outdated?
Except for this, I addressed your comments. |
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 left a bunch of comments. Thanks for starting this PR! If you don't have time to tackle my suggested refactors, I suggest just leaving this PR open and we'll get to them soon. (Let's not merge stuff to main
until it's bulletproof.)
if len(bpy.context.selected_objects) == 0: | ||
raise ValueError("No objects found in scene") | ||
bpy.context.view_layer.objects.active = bpy.context.selected_objects[0] | ||
if "Stage" in item.filepath: |
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.
Let's make this a command-line option for the script. Some people definitely will want the ceiling and they'll be super-confused that it is missing. You could even make it entirely command-line-driven (force the user to specify "Light" and "ceiling" on the command line).
At a high level, think of this as a general-purpose tool for getting Habitat scenes/episodes into Blender. Let's not overfit to your specific use case (visualizing trajectories with an overhead camera).
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.
For future reference: a more robust way to cull the ceiling would be the Bisect tool, with a user-specified height. See this tutorial for how it works: https://aihabitat.org/tutorial/editing_in_blender/ . I assume it could be scripted. But no need to add this feature in this PR.
m.show_transparent_back = False | ||
|
||
add_lights = settings.get("lights", []) | ||
for light in add_lights: |
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 pretty messy. I hate introducing yet another JSON format file. @0mdc has already added light support to gfx-replay. Can we just use that? I.e. update the keyframe parsing here to parse the lights. And then your command line could parse multiple gfx-replay files. And one of them just specifies the lights.
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.
Btw, I find that Blender area lights produce the prettiest results, and we can't currently represent them directly in gfx-replay (it only supports point lights). Not sure what to do about that. What about loading an additional Blender file as a kind of template?
Again, what I really don't like is introducing yet another proprietary JSON format file.
light_object.location = light["location"] | ||
|
||
print("") | ||
if len(keyframes) > 1: |
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.
We should update this message to include (1) if the ceiling or anything else was culled, and (2) what lights were spawned. This will help users troubleshoot when using this script.
filepath = filepath.replace(".dae", ".glb") | ||
raw_filepath = raw_filepath.replace(".dae", ".glb") | ||
if not os.path.exists(filepath): | ||
os.system(f"assimp export {orig_filepath} {filepath}") |
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.
Let's make this more robust. Check if assimp
is available. If not, print a warning message and instructions for installing Assimp (it's just pip install assimp
, right?).
r""" | ||
Script for loading a GFX replay file into Blender. This allows playing back a trajectory from Habitat in Blender. | ||
|
||
See the following tutorial for more information on GFX: https://colab.research.google.com/github/facebookresearch/habitat-sim/blob/main/examples/tutorials/colabs/replay_tutorial.ipynb |
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.
Rewrite this to more information on gfx-replay
. GFX
is a generic abbreviation for graphics and is too vague.
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
r""" | ||
Script for loading a GFX replay file into Blender. This allows playing back a trajectory from Habitat in Blender. |
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.
Rewrite to loading a gfx-replay
. I just want to be consistent.
@@ -0,0 +1,348 @@ | |||
#!/usr/bin/env python3 |
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.
Let's rename to PR from Added GFX Blender Replay Script
to Added Blender Gfx-replay Script
. I want to be consistent. GFX
is just an abbreviation for graphics and is too vague.
Motivation and Context
Used for viewing the generated GFX replay files in Blender. This is @eundersander's PR here with additional small changes.
How Has This Been Tested
Types of changes
Checklist