Rate-limit drags from the start of the previous render, not its end
Browse filesDuring a drag the render loop skipped a render until 0.9 x the usual
iteration time had passed since last_render_t, and last_render_t was
stamped when a render finished. A new render therefore started every
(render time + 0.9 x iteration time), about half the image rate the FPS
readout shows: at Max W 960 on ZeroGPU one image per ~100 ms instead of
~52 ms. Stamp last_render_t when the render starts.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- viser_app/viewer.py +5 -1
viser_app/viewer.py
CHANGED
|
@@ -252,6 +252,11 @@ def render_loop(
|
|
| 252 |
time.sleep(0.020)
|
| 253 |
continue
|
| 254 |
iter_t0 = time.monotonic()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
|
| 256 |
intr, c2w_r, c2w_t = viser_cam_to_dvsm(
|
| 257 |
position, wxyz, fov_y, aspect, device="cuda", dtype=torch.float32
|
|
@@ -274,7 +279,6 @@ def render_loop(
|
|
| 274 |
time.sleep(0.1)
|
| 275 |
continue
|
| 276 |
dt_ms = (time.perf_counter() - t0) * 1000.0
|
| 277 |
-
last_render_t = time.monotonic()
|
| 278 |
|
| 279 |
rgb = (
|
| 280 |
img[0, 0].clamp(0.0, 1.0).mul(255.0).to(torch.uint8)
|
|
|
|
| 252 |
time.sleep(0.020)
|
| 253 |
continue
|
| 254 |
iter_t0 = time.monotonic()
|
| 255 |
+
# Rate-limit clock: stamped when this render STARTS. Stamped at the end,
|
| 256 |
+
# the check above made the next render wait another 0.9 x iteration
|
| 257 |
+
# time after this one finished, so frames came out at about half the
|
| 258 |
+
# rate the FPS readout shows.
|
| 259 |
+
last_render_t = iter_t0
|
| 260 |
|
| 261 |
intr, c2w_r, c2w_t = viser_cam_to_dvsm(
|
| 262 |
position, wxyz, fov_y, aspect, device="cuda", dtype=torch.float32
|
|
|
|
| 279 |
time.sleep(0.1)
|
| 280 |
continue
|
| 281 |
dt_ms = (time.perf_counter() - t0) * 1000.0
|
|
|
|
| 282 |
|
| 283 |
rgb = (
|
| 284 |
img[0, 0].clamp(0.0, 1.0).mul(255.0).to(torch.uint8)
|