Skip to main content

A viser extension with out-of-the-box support for the time dimension

Project description

viser4d

viser4d is a small extension of viser for recorded 3D scenes with a time dimension.

Features include:

  • Record scene updates across discrete timesteps with with server.at(t):.
  • Play, pause, scrub, and step through the timeline directly in the browser.
  • Stream long recordings in chunks and preload nearby timeline blocks for responsive scrubbing.
  • Keep playback client-local so different browser tabs can explore the same recording independently.
  • Attach timeline-synced audio tracks.
  • Export recordings as .viser files or standalone HTML.

The goal is to keep viser's live scene API while adding a separate recorded timeline API for playback and export.

Chunking is controlled by viser4d.ChunkStreamingConfig. By default, Viser4dServer populates it from VISER4D_BLOCK_SIZE and VISER4D_CLIENT_CHUNK_CACHE_SIZE, falling back to 32 steps per block and a 1GB per-client preload budget. You can also pass chunk_streaming=viser4d.ChunkStreamingConfig(...) for one server instance.

Installation

You can install viser4d with pip:

pip install viser4d

Quickstart

import numpy as np
import viser4d

server = viser4d.Viser4dServer(num_steps=10, fps=10)

server.scene.add_frame("/origin", axes_length=0.25)
server.scene.add_grid("/ground", width=10.0, height=10.0)

point_cloud = None
for t in range(10):
    with server.at(t) as timeline:
        points = np.random.uniform(-1.0, 1.0, size=(200, 3))
        if point_cloud is None:
            point_cloud = timeline.scene.add_point_cloud(
                "/points",
                points=points,
                colors=(255, 200, 0),
            )
        else:
            point_cloud.points = points

server.sleep_forever()

Open the viewer in your browser and use the built-in Playback controls to play, pause, scrub, and step through the recorded timeline.

Outside server.at(t), server.scene behaves like normal viser. Inside server.at(t), writes to timeline.scene and timeline.audio are recorded into the timeline.

More Examples

Export

blob = server.serialize()
html = server.as_html()

Use server.serialize() to export a .viser recording and server.as_html() to export a self-contained HTML viewer.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

viser4d-0.17.3.tar.gz (71.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

viser4d-0.17.3-py3-none-any.whl (78.5 kB view details)

Uploaded Python 3

File details

Details for the file viser4d-0.17.3.tar.gz.

File metadata

  • Download URL: viser4d-0.17.3.tar.gz
  • Upload date:
  • Size: 71.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for viser4d-0.17.3.tar.gz
Algorithm Hash digest
SHA256 78aa7f2cf469cad6d854ac9c7d1c58eadb6ef94ba80ad1399c55b9a0abae8e48
MD5 4b62e0bbb2a3d0a1c4a92a4e8e07c480
BLAKE2b-256 ef53f6e4666c57a513ea12059607faea13ff9803ad3fa9e1cd6c325bc9be9ae4

See more details on using hashes here.

File details

Details for the file viser4d-0.17.3-py3-none-any.whl.

File metadata

  • Download URL: viser4d-0.17.3-py3-none-any.whl
  • Upload date:
  • Size: 78.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for viser4d-0.17.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a474aa83ad200a965474272a215ae8b6bd1c2659d6b3163e83cd829c1eb34d94
MD5 5df8e386af092756da977b0a427e4eed
BLAKE2b-256 9db2711049a07b2e5cd55de897f0cc56fec65881278743ca70737fb26b39404c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page