Skip to content

Commit

Permalink
Fix point size artifacts in Record3D example
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi committed Nov 11, 2024
1 parent d1e417e commit 9e91ff9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
14 changes: 11 additions & 3 deletions docs/source/examples/07_record3d_visualizer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ Parse and stream record3d captures. To get the demo data, see ``./assets/downloa
nonlocal prev_timestep
current_timestep = gui_timestep.value
with server.atomic():
# Update point size.
point_nodes[current_timestep].point_size = gui_point_size.value
# Toggle visibility.
frame_nodes[current_timestep].visible = True
frame_nodes[prev_timestep].visible = False
Expand Down Expand Up @@ -158,9 +155,20 @@ Parse and stream record3d captures. To get the demo data, see ``./assets/downloa
# Playback update loop.
prev_timestep = gui_timestep.value
while True:
# Update the timestep if we're playing.
if gui_playing.value:
gui_timestep.value = (gui_timestep.value + 1) % num_frames
# Update point size of both this timestep and the next one! There's
# redundancy here, but this will be optimized out internally by viser.
#
# We update the point size for the next timestep so that it will be
# immediately available when we toggle the visibility.
point_nodes[gui_timestep.value].point_size = gui_point_size.value
point_nodes[
(gui_timestep.value + 1) % num_frames
].point_size = gui_point_size.value
time.sleep(1.0 / gui_framerate.value)
Expand Down
14 changes: 11 additions & 3 deletions examples/07_record3d_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ def _(_) -> None:
nonlocal prev_timestep
current_timestep = gui_timestep.value
with server.atomic():
# Update point size.
point_nodes[current_timestep].point_size = gui_point_size.value

# Toggle visibility.
frame_nodes[current_timestep].visible = True
frame_nodes[prev_timestep].visible = False
Expand Down Expand Up @@ -148,9 +145,20 @@ def _(_) -> None:
# Playback update loop.
prev_timestep = gui_timestep.value
while True:
# Update the timestep if we're playing.
if gui_playing.value:
gui_timestep.value = (gui_timestep.value + 1) % num_frames

# Update point size of both this timestep and the next one! There's
# redundancy here, but this will be optimized out internally by viser.
#
# We update the point size for the next timestep so that it will be
# immediately available when we toggle the visibility.
point_nodes[gui_timestep.value].point_size = gui_point_size.value
point_nodes[
(gui_timestep.value + 1) % num_frames
].point_size = gui_point_size.value

time.sleep(1.0 / gui_framerate.value)


Expand Down

0 comments on commit 9e91ff9

Please sign in to comment.