google / neuroglancer

WebGL-based viewer for volumetric data
Apache License 2.0
1.02k stars 283 forks source link

Feature - adaptive downsampling of volume rendering based on framerate #591

Closed seankmartin closed 4 days ago

seankmartin commented 1 month ago

The overall idea is that a setting (currently on by default) would allow a global downsampling in XY resolution for 3D panels of transparent layers during camera movement if the framerate drops below a certain threshold.

All of this is open to change, but currently:

Target FPS is 60 The mean framerate over a running 6 frames after a camera move is initiated is calculated If this median framerate drops below 60, a downsampling rate of 2, 4, or 8 is chosen based on how far from 60 the framerate is. If a downsample is detected, then during this camera movement, the downsampling rate will never go back above the highest downsample rate detected for about the last second When the camera stops moving, a fresh full resolution drawing is requested after 300ms

To update:

  1. Only DS for VR, new buffer
  2. Make timing easy to change so that GL query can slot in as needs be
  3. More global setting for camera in constant movement. Discrete movements won't trigger DS