ithaca-4dgs-js-player
v0.4.0
Published
ITHACA 4D Gaussian Splatting videos (.4dgs, .ftgsz, .trgz) as three.js / A-Frame objects for WebXR scenes and metaverses
Maintainers
Readme
Ithaca 4DGS JS player (WebGL2)
4D Gaussian Splatting videos made with ITHACA as objects for WebGL2 3D apps, WebXR scenes
and metaverses — not a viewer page. Add an Ithaca4DGS to your three.js (or A-Frame) scene, next to your other
objects: move, rotate and scale it like any Object3D, and it plays by itself, with spatial sound, in VR, AR or on a
flat screen.
Hello ITHACA 4DGS!, played by this player (watch it in 4D).
Examples to download: the ITHACA Featured 4DGS gallery — download button
on each video (.4dgs or .ftgsz, both read by this player), or play them directly by their share link.
- Files:
.4dgs(one file: sequences, sound, framing; streamed by HTTP ranges),.ftgszand.trgzsequences, raw.plysequences of ITHACA renders, ITHACAmanifest.json(sequences next to it) — from a URL or a localFile - ITHACA links: a share link (
https://www.ithaca.eu/?ithaca_partage=…) or its token plays directly - Featured 4DGS:
listFeatured()returns the videos of the ITHACA gallery (title, creator, thumbnails, duration…) - HD 4DGS (
.trgz, since 0.3.0), HD and Low Quality ITHACA renders. HD 4DGS gaussians keep their own motion: a rigid screw motion (rotation + translation) whose rate follows a quadratic Bézier curve over each gaussian's life, so both their centre and their orientation change over time; colours up to spherical harmonics degree 3 - Plays while loading: decoding and depth sorting run in Web Workers; the sequences ahead are fetched, decoded (several in parallel, as many as the device allows), sent to the GPU by small bands over the frames and pre-sorted before they are needed — no long frame at sequence changes; the sound is the master clock, followed smoothly
- Transitions: videos rendered with a transition between sequences (ITHACA expert setting) crossfade from one sequence to the next over the whole overlap, at constant density, both sequences sorted together; the others cut as before
- Light mode on phones and headsets (automatic): colours up to spherical harmonics degree 1, less memory and faster decoding, no gaussian removed
- WebGL 2, three.js ≥ 0.160 (peer dependency), MIT licence, no other dependency
Install it in your WebGL2 JavaScript 3D app
Requirements: a browser with WebGL 2 (all current desktop and mobile browsers, Meta Quest browser), three.js
0.160 or later in your app, and HTTPS for VR / AR (WebXR). The player uses your app's three.js: it must be the
same three module (one copy), as for any three.js add-on.
1. Add the package
With a bundler (Vite, webpack 5, Rollup, Parcel…)
npm install three ithaca-4dgs-js-playerThe two Web Workers of the player are written as new Worker(new URL(…, import.meta.url)): Vite and webpack 5 find
and bundle them by themselves, nothing to configure.
Without a build step (plain <script type="module">) — map three and the player in an import map, from a CDN or
from your own server:
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/",
"ithaca-4dgs-js-player": "https://cdn.jsdelivr.net/npm/[email protected]/src/index.js"
}
}
</script>Loaded from another site (a CDN), the workers start anyway: the player starts them through a small same-origin stub.
To self-host instead, copy the src/ folder to your site and map ithaca-4dgs-js-player to /your/path/src/index.js.
2. Add a video to your scene
import * as THREE from "three";
import { Ithaca4DGS } from "ithaca-4dgs-js-player";
// your app: renderer, scene, camera (any setup works)
const renderer = new THREE.WebGLRenderer({ antialias: true }); // WebGL 2 (three.js default)
renderer.setSize(innerWidth, innerHeight);
document.body.appendChild(renderer.domElement);
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(50, innerWidth / innerHeight, 0.05, 500);
camera.position.set(0, 1.6, 3);
// spatial sound (optional): one listener on the camera
const listener = new THREE.AudioListener();
camera.add(listener);
// the 4D video: an object of the scene
const video = new Ithaca4DGS({ src: "https://www.ithaca.eu/?ithaca_partage=FTTN757OptLt3aresYXUV9B-", listener });
video.position.set(0, 0, -1); // framed ITHACA videos stand on y = 0, in metres
video.rotation.y = Math.PI / 6;
scene.add(video);
video.addEventListener("ready", () => console.log("on screen,", video.duration.toFixed(1), "s"));
video.addEventListener("error", (e) => console.error(e.error));
// your render loop: nothing to call for the video, it updates itself when the scene is rendered
renderer.setAnimationLoop(() => renderer.render(scene, camera));That is all. Several videos can play in the same scene; each one is an independent object (video.visible = false
hides it, scene.remove(video); video.dispose() frees it).
3. VR and AR (WebXR)
Nothing specific to the player: enable WebXR on your renderer as usual, the video is drawn for each eye.
import { VRButton } from "three/addons/webxr/VRButton.js"; // or ARButton for passthrough AR
renderer.xr.enabled = true;
document.body.appendChild(VRButton.createButton(renderer));4. Sound and autoplay
Browsers start sound only after a user gesture. If the sound is blocked the video still plays; call video.play()
from a click, a tap or a controller button to start the sound.
5. Your own servers
To play files hosted on your servers from your app's pages:
- CORS: the files must be readable from your app's origin (
Access-Control-Allow-Origin). .4dgs: the server must answer HTTP range requests (Range/206 Partial Content, as every static server and S3-like storage do), exposeContent-Rangeto the page (Access-Control-Expose-Headers: Content-Range) and accept theRangeheader in CORS preflights (Access-Control-Allow-Headers: Range)..ftgsz,.plyandmanifest.jsonare read in one piece: plain CORS is enough.
ITHACA share links and the Featured 4DGS gallery are read from www.ithaca.eu, which serves them to any site.
Sources
| src | What is read |
|---|---|
| "video.4dgs" | the whole video: sequences, sound, framing (by HTTP ranges, while it plays) |
| "https://www.ithaca.eu/?ithaca_partage=<token>", "ithaca:<token>" or "<token>" | an ITHACA share: its .4dgs, or its sequences and sound, with the framing set by its owner. Each opening counts one view of the share. Signed links are refreshed when they expire |
| "…/manifest.json" | an ITHACA render folder (HD or Low Quality sequences listed in the manifest) |
| "seq001.ftgsz", "seq001.ply" | one HD sequence |
| "seq001.trgz" | one HD 4DGS sequence |
| "seg1.ftgsz" / "seg1.ply" with frames: 65 | one Low Quality sequence: its file does not say its frame count, give it |
| a File or Blob (file picker, drag and drop) | any of the formats above; use format when the name does not tell |
Raw sequences, manifests and .ftgsz carry no framing: position, rotate and scale the object yourself (a raw Low
Quality sequence also holds the whole captured room). .4dgs files and share links come framed (the platform's position,
rotation and crop box) unless applyFraming: false.
// a file chosen by the user
input.onchange = () => scene.add(new Ithaca4DGS({ src: input.files[0] }));
// a lone Low Quality sequence
scene.add(new Ithaca4DGS({ src: "seg1.ply", frames: 65 }));Featured 4DGS gallery
import { listFeatured, Ithaca4DGS } from "ithaca-4dgs-js-player";
const { total, videos, categories } = await listFeatured({ sort: "popular", perPage: 20, headset: true });
for (const v of videos) {
// v: { token, title, creator, views, category, type, headset, download, duration, gaussians, bytes,
// thumbnail, animatedThumbnail, pageUrl }
addMenuItem(v.title, v.thumbnail, () => scene.add(new Ithaca4DGS({ src: v.token, listener })));
}Options: query (search), sort ("recent", "popular", "name"), perPage (20 or 50), page, category and
type (keys of categories / types in the answer), headset (only the videos made for headsets).
resolveShare(token) returns the description of a share (title, fps, frames, framing, sequence and sound links) without
playing it; shareToken(url) extracts the token of a share link; shareUrl(token) builds its page address.
Ithaca4DGS reference
Options
| Option | Default | |
|---|---|---|
| src | — | a source (see above); or call load(src) later |
| autoplay | true | start as soon as the first sequence is on screen |
| loop | true | loop the video |
| listener | null | a THREE.AudioListener for spatial sound (no sound without it) |
| fps | 30 | frame rate when the source does not say |
| applyFraming | true | apply the framing set on the ITHACA platform (.4dgs, share links) |
| frames | null | frame count of a lone Low Quality sequence |
| crossfade | "auto" | crossfade between sequences in videos rendered with a transition (false: hard cut; "auto": on, except in light mode; true forces it in light mode too) |
| light | "auto" | light mode: colours up to SH degree 1 (degree-1 colours of HD 4DGS in the compact 8-bit layout of the Fast videos), less GPU memory, faster decoding; "auto": on for phones, tablets and headsets (Meta Quest), off on computers |
| decoders | "auto" | sequences decoded in parallel (Web Workers): computers one per 4 cores, 2 to 8 (bounded by the declared memory); phones 2 to 4 |
| memoryBudgetMB | "auto" | memory granted to the sequences kept loaded ahead (GPU textures + sort data): computers with a dedicated GPU 8 000, Apple 4 000, others 3 000, phones 1 800 |
| format | null | "4dgs", "manifest", "ftgsz", "trgz" or "ply" when the name does not tell (a Blob) |
| server | "https://www.ithaca.eu" | ITHACA site that resolves share links |
| fetchFn | fetch | custom fetch (headers, credentials, signed URLs…) |
Properties and methods
play(),pause(),currentTime(seconds, read / write),duration,playing,ready,waitingload(src, { frames, format })— open a videoshare— the share description when playing an ITHACA link (title, page URL…)boundingSphere()— sphere of the video in world space (to place or frame it)stats— worker timings (sortMs,decodeMs,packMs, …), visible and total gaussians; since 0.4.0 alsouploadMB(sent to the GPU),forcedUploads(sequences that had to be sent at once: should stay 0),hardSyncs/softSyncFrames(sound clock),junctions(crossfade models built),decoders,capacity(sequences kept loaded),sequenceMB,lightdispose()— frees the GPU memory, the workers and the sound
Events (addEventListener)
load (index read; share for ITHACA links), ready (first sequence on screen), waiting / playing (buffering),
progress ({ loaded, total } sequences), ended, error ({ error }).
A-Frame
<script src="https://aframe.io/releases/1.6.0/aframe.min.js"></script>
<script type="module">
import "ithaca-4dgs-js-player/aframe"; // registers the ithaca-4dgs component (after A-Frame)
</script>
<a-scene>
<a-entity ithaca-4dgs="src: https://www.ithaca.eu/?ithaca_partage=FTTN757OptLt3aresYXUV9B-; loop: true; sound: true"
position="0 0 -2"></a-entity>
</a-scene>Schema: src, loop, autoplay, sound, frames, light, crossfade, decoders (auto, true / false, or a
number of decoders). The entity emits ithaca-4dgs-ready, ithaca-4dgs-ended, … (the
events above, prefixed).
Other exports
SplatMesh— the WebGL2 renderer alone (one packed sequence on the GPU), for custom playersTurntableControls— level turntable camera (orbit, pan, zoom, WASD flight), used by the example pageopen4dgs(url, { signal, fetchFn })—.4dgsindex reader;is4dgs(src)— a.4dgsaddress or file
Example and tests
npm install
npm run serve # http://localhost:8770/examples/?src=<a .4dgs, a share link…>
python3 test/sources.py # every kind of source, headless Chromium (Playwright)
python3 test/render.py <file.4dgs> [time_s] # headless render, screenshots in test/sortie/
python3 test/perf.py <file.4dgs> <name> # worker timingsTest files are not included: download examples from the Featured 4DGS gallery
or use your own ITHACA renders (test/data/).
Changes
See CHANGELOG.md. 0.4.0: smooth playback of long and heavy videos (no long frame at sequence
changes), true crossfade at constant density, smooth sound clock, light mode on phones and headsets; new options
light, decoders, memoryBudgetMB, crossfade: "auto". No change needed in existing code.
Licence
MIT — © 2026 French Touch Factory / ITHACA. See LICENSE.

