- Docs
- Tools
Host your scene
A scene is a folder of files: the scene.json, the target files, and the models, pictures, videos and sounds it names. Put the folder on any static host (Vercel, Netlify, Cloudflare Pages, GitHub Pages or R2) and open it with loadScene('https://your-host/scene.json') or tempusxr-scene="src: https://your-host/scene.json".
The files
- Paths in
scene.jsonare relative to the scene file, or fullhttpsaddresses. - Keep the total light: about 2 MB is what opens in 4 seconds on 4G. Resize pictures to 2048 pixels at most, and keep videos short.
- Name a file after its content when you can (
chair.3f9a1c2b.glb): a name that never changes for the same content can be cached for a year.
The headers
| What | Rule | Why |
|---|---|---|
| Files with a hash in the name | Cache-Control: public, max-age=31536000, immutable | They never change: the phone keeps them. |
scene.json | Cache-Control: public, max-age=60, stale-while-revalidate=600 | An update shows within a minute. |
| Everything | Access-Control-Allow-Origin: *, Cross-Origin-Resource-Policy: cross-origin | WebGL refuses a texture or a video from another address without them. |
| Everything | Accept-Ranges: bytes | Videos start before they are fully loaded. |
Most hosts send open CORS headers for static files by default; check yours if a picture or a video does not show. On Vercel, add the rules to vercel.json under headers.
Check it
Open the page on a phone with ?test in the address: the Test console lists each file the scene loads and any that fails. A scene that is not valid lists every problem with its place in the file.