Web (Spark.js)
Render Gaussian splats and RGBD point clouds in React with Spark.
Use Spark to render Gaussian splats and point clouds in a React web app. Serve your files from your app's public directory.
The World Labs JavaScript client
exports TaskAsset for file references and PosedRGBDAsset for calibrated RGBD
frames. Each frame contains imageAsset, camera, and depth.
Gaussian splats
An .spz file is ready to render. For a TaskAsset, use its url to load the
file. Install three, @react-three/fiber, @react-three/drei, and
@sparkjsdev/spark in your React app:
Replace the example path with your SPZ file's URL and move the camera to
frame your scene. Add a Splats element for each additional file.
Point clouds from RGBD images
A PosedRGBDAsset contains the ingredients for a colored point cloud:
- RGB (
imageAsset) gives each point its color. - Depth (
depth.depthAssetfor linear EXR, ordepth.logDepthAssetfor log-depth PNG) gives each pixel its distance along the camera's forward axis. - Confidence (
depth.confidenceAsset), when present, lets you filter unreliable points.
Use camera.intrinsics to turn depth pixels into 3D points, then
apply each camera's pose to place them in the same world. See
Cameras and posed images for depth decoding and
coordinate conventions.
Once decoded, render the points as small spherical splats. This React component
accepts world-space points with { x, y, z, r, g, b } and RGB values from
0 to 255, after any confidence filtering:
In Scene, replace the SPZ Splats element with <PointCloud points={points} />;
keep the Spark renderer and controls. This previews the observed surfaces in
the RGBD images. For more, see Spark's
React example and
procedural splats.