-
Notifications
You must be signed in to change notification settings - Fork 53
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
how to generate the web app to embed a Viser visualization in another HTML #302
Comments
Hi @jhaoshao, thanks for your interest! Unfortunately this feature isn't fully stable so there's no documentation yet, and my time is currently quite constrained so it's hard to help much. If you want to try and figure it out anyways, I can provide some pointers though: The main recording function is here. Usage example: rec = server._start_scene_recording()
rec.set_loop_start()
for t in range(timesteps):
# [some updates here]
rec.insert_sleep(sleep_duration_handler.value)
server.send_file_download(
"recording.viser", content=handle.end_and_serialize()
) For how to embed you can see the source code for robot-see-robot-do.github.io: The |
Thanks for your timely reply! I'll figure it out |
@brentyi Sorry for my (amateur) question, but after building and running viser locally with
I figured I could visit Thanks! |
The If you want to just test with an existing
And then navigate to:
|
That worked great, thank you! I also generated my own .viser file for the
and I can play it in localhost and everything looks good. However, when I use the scrubber at the bottom to go backwards, all the previous point clouds and camera frustums stay visible and overlap: Screen.Recording.2024-11-13.at.9.46.29.PM.movDo you have any suggestions on how to fix this issue? |
The part that worked: great! The scrubbing problems: this is unfortunately a known issue (#292). You could check if the fix in that issue is performant enough for you; I plan to fix it properly before "releasing" the scene recording features. With some trial and error you could also hack it with some explicit state resetting immediately after for t in range(num_frames):
point_nodes[t].point_size = gui_point_size.value
# <new>
# prop updates are ignored if there's no change
# we want to make sure `node.visible = False` is recorded later, to be safe it might help to first set the visibility to `True`
for node in frame_nodes:
node.visible = True
# </new>
rec = server._start_scene_recording()
rec.set_loop_start()
# <new>
for node in frame_nodes:
node.visible = False
# </new>
for t in range(num_frames):
gui_timestep.value = t
rec.insert_sleep(1 / 30)
server.send_file_download("recording.viser", content=rec.end_and_serialize()) Somehow Junyi was also able to work around this for Monst3r but I'm not sure exactly what he did. |
Resetting the state totally fixes the issue, thank you! I'll definitely be staying tuned for the official release of the recording features. This is super useful. |
@lahavlipson @brentyi I am trying to generate the .viser file but after running the following code instead of the final while loop as suggested,
I do not see a .viser file generated. May I ask where is the .viser file being generated? |
The server.send_file_download("recording.viser", content=rec.end_and_serialize()) Should send the file to any connected clients (web browsers), and trigger a download there. If you'd like to to test that this works you can try running this example: https://github.com/nerfstudio-project/viser/blob/main/examples/19_get_renders.py If you want you can also just save the file normally: from pathlib import Path
Path("./some_path.viser").write_bytes(rec.end_and_serialize()) |
I am a bit confused on how to set |
Yeah, it's just a static webpage so you can host it the same way as any other static webpage. Standard GitHub pages is fine. Some more details:
Let me know if that's still unclear! |
Thanks for the swift response! My question has been addressed. Thanks! |
Hi Brent!
There is a nice embedded 4D demonstration in https://robot-see-robot-do.github.io/
Looks like there's a web app at
https://rsrd-anonymous.github.io/build/
that's tailored to run a.viser
file. I'm thinking of making my own web app to visualize viser stuff on the web. So, how do I go about designing this web app?The text was updated successfully, but these errors were encountered: