Skip to content

Commit

Permalink
Minor: faster Gaussian loading, fix refresh rate edge case, improve file
Browse files Browse the repository at this point in the history
playback timing
  • Loading branch information
brentyi committed Aug 13, 2024
1 parent ba17c7c commit baa408a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/experimental/gaussian_splats.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def load_splat_file(splat_path: Path, center: bool = False) -> SplatFile:
)
scales = splat_uint8[:, 12:24].copy().view(onp.float32)
wxyzs = splat_uint8[:, 28:32] / 255.0 * 2.0 - 1.0
Rs = onp.array([tf.SO3(wxyz).as_matrix() for wxyz in wxyzs])
Rs = tf.SO3(wxyzs).as_matrix()
covariances = onp.einsum(
"nij,njk,nlk->nil", Rs, onp.eye(3)[None, :, :] * scales[:, None, :] ** 2, Rs
)
Expand Down
6 changes: 5 additions & 1 deletion src/viser/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,11 @@ function AdaptiveDpr() {
ms={100}
iterations={5}
step={0.1}
bounds={(refreshrate) => (refreshrate > 90 ? [40, 85] : [40, 55])}
bounds={(refreshrate) => {
const max = Math.min(refreshrate * 0.9, 85);
const min = Math.max(max * 0.5, 38);
return [min, max];
}}
onChange={({ factor, fps, refreshrate }) => {
const dpr = window.devicePixelRatio * (0.2 + 0.8 * factor);
console.log(
Expand Down
6 changes: 5 additions & 1 deletion src/viser/client/src/FilePlayback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,13 @@ export function PlaybackFromFile({ fileUrl }: { fileUrl: string }) {
useEffect(() => {
const playbackMultiplier = parseFloat(playbackSpeed); // '0.5x' -> 0.5
if (recording !== null && !paused) {
let lastUpdate = Date.now();
const interval = setInterval(() => {
const now = Date.now();
playbackMutable.current.currentTime +=
(1.0 / 120.0) * playbackMultiplier;
((now - lastUpdate) / 1000.0) * playbackMultiplier;
lastUpdate = now;

updatePlayback();
if (
playbackMutable.current.currentIndex === recording.messages.length &&
Expand Down

0 comments on commit baa408a

Please sign in to comment.