Introducing a new way to review your PRs.

Read the announcement

visgl / luma.gl

High-performance Toolkit for WebGL-based Data Visualization

View on GitHub

30 documents · Updated Nov 20, 2026

docs / gaussian-splats

Gaussian splat rendering

The engine's splats system turns captured or generated Gaussian records into translucent 3D visual content. It keeps caller-owned batches identifiable, projects each 3D Gaussian into a screen-space ellipse, orders visible records for blending, and renders them through WebGPU or WebGL2. A separate picking path maps a visible pixel back to its source row. See data and visualization assets for the wider asset flow.

Splat representation

Gaussian shape

A splat is a small colored 3D Gaussian. Its center gives the world position. Its scale and quaternion rotation describe the uneven 3D shape. Color and opacity control the visible contribution of the shape.

Each source batch keeps these columns in matching row order. The prepared GPU data also keeps a stable global row index. This lets streaming, filtering, and picking refer back to the original source row without merging all batches.

References: modules/…/splat-data.ts• L14-48 modules/…/splat-data.ts• L87-116

View-dependent color

Optional spherical-harmonic coefficients add view-dependent radiance to the base color. The renderer evaluates these coefficients against the direction from the splat to the camera. A lower requested degree uses fewer authored bands and therefore gives a simpler color response.

The module supports non-DC bands through degree three. Input conversion reconstructs the base color from the glTF DC term and preserves complete higher-order bands when they are available.

References: modules/…/splat-spherical-harmonics.ts• L5-15 modules/…/splat-spherical-harmonics.ts• L35-45 modules/…/splat-gltf.ts• L152-170 modules/…/splat-gltf.ts• L329-380

Source identity

Source identity is part of the visual data contract. A batch index and a global row offset survive upload and allow the renderer to report the source row selected by a pick or filter.

Semantic IDs are optional labels attached to rows. A semantic filter can include or exclude labels and can apply an application-owned predicate to the stable source identity.

References: modules/…/splat-data.ts• L27-35 modules/…/splat-filter.ts• L7-24 modules/…/splat-picking.ts• L32-51

Asset preparation

Decoded source columns

The rendering layer consumes decoded columns rather than a file format. A source must provide matching rows for position, scale, rotation, color, and opacity. Optional semantic labels and spherical-harmonic coefficients extend the same row model.

The GPU preparation step uploads one source batch and keeps its CPU columns for camera-dependent visibility and ordering. Callers can replace complete rows in place. This supports updates without changing the batch's source identity.

References: modules/…/splat-data.ts• L14-36 modules/…/splat-data.ts• L120-180 modules/…/splat-data.ts• L251-307

glTF conversion

The glTF path recognizes the Khronos Gaussian-splat extension and converts its decoded attributes into the common source representation. It validates the point primitive, ellipse kernel, supported color space, and matching row counts before upload.

Compression decoding stays outside the splats module. When a compressed primitive lacks decoded attributes, the caller supplies a decoder and the module then continues with the same source conversion path.

References: modules/…/splat-gltf.ts• L47-90 modules/…/splat-gltf.ts• L101-127 modules/…/splat-gltf.ts• L217-263

Rendering workflow

The renderer converts source rows into blended screen-space contributions through a camera-dependent sequence. This diagram shows the main flow from source data to the final image.

flowchart LR
  A[Decoded splat batches] --> B[GPU source columns]
  B --> C[Semantic and opacity visibility]
  C --> D[Camera depth and screen-size checks]
  D --> E[Back-to-front ordering]
  E --> F[Projected ellipse quad]
  F --> G[Gaussian alpha and color]
  G --> H[Blended image]

Visibility and projection

Before drawing, the renderer removes rows that fail semantic, opacity, or numeric visibility checks. It can also remove splats whose projected size is below the screen threshold.

For each retained row, the scale and rotation become three world-space axes. The camera projects those axes into a 2D covariance ellipse. The renderer draws a quad around that ellipse, then evaluates a Gaussian weight across the quad's fragments.

References: modules/…/splat-renderer.ts• L694-796 modules/…/splat-covariance.ts• L28-81 modules/…/splat-shaders.ts• L143-210

Transparency ordering

Splat color uses alpha blending, so visible rows need a camera-dependent order. The default global mode sorts rows back to front. The tile mode groups rows by screen tile before depth ordering. The none mode keeps the current source order when ordering is not needed.

The renderer keeps source buffers unchanged while it builds ordered draw runs. It reuses those runs for backend draws and for picking. This is important for streamed batches because adding a batch does not require repacking earlier source data. When many batches interleave, it bounds the number of runs by grouping rows into depth slabs while keeping the broad back-to-front order.

References: modules/…/splat-sort.ts• L5-31 modules/…/splat-sort.ts• L49-76 modules/…/splat-renderer.ts• L613-640 modules/…/splat-renderer.ts• L798-902

Color and blending

The fragment stage multiplies source opacity by the Gaussian weight and the configured alpha scale. Fragments below the alpha cutoff are discarded. The remaining linear radiance receives exposure and optional Reinhard tone mapping before standard alpha blending.

Floating-point colors preserve high-range radiance. The renderer enables tone mapping for standard display targets unless the caller selects a policy or the output already supports extended range.

References: modules/…/splat-renderer.ts• L77-87 modules/…/splat-shaders.ts• L197-210 modules/…/splat-renderer.ts• L278-310

Scene pass integration

The renderer can place splats in a shared scene pass with ordinary meshes. It draws opaque meshes first so their depth can hide farther splats, draws the depth-tested splats, and then draws transparent meshes as overlays. The caller controls the mesh draw hooks while the splat renderer owns only its own resources.

References: modules/…/splat-renderer.ts• L85-96 modules/…/splat-renderer.ts• L411-445

Rendering backends

WebGPU graph path

The graph renderer moves projection, visibility, global ordering, and indirect drawing into a reusable WebGPU command graph. It borrows the independently prepared source batches and avoids CPU row walks or GPU readback during the main render flow.

For large paged scenes, the paged graph renderer keeps source pages intact, projects only active rows, performs one global depth order, and gathers the ordered result into bounded output segments. This lets the scene exceed one storage-buffer binding while preserving cross-page transparency order.

References: modules/…/gpu-splat-graph-renderer.ts• L115-121 modules/…/gpu-splat-graph-renderer.ts• L242-264 modules/…/gpu-paged-splat-renderer.ts• L201-207

WebGL2 fallback

The standard renderer provides an attribute-backed WebGL2 path with the same Gaussian projection and fragment behavior. When ordering or view-dependent color changes the source order or color data, it creates renderer-owned attribute data while leaving the caller's source batch intact. The renderer reports source and renderer-owned allocations separately so applications can inspect the cost of borrowed data and derived draw data.

The backend choice changes where data is bound and ordered. It does not change the source representation or the visual model of a rotated Gaussian.

References: modules/…/splat-renderer.ts• L203-232 modules/…/splat-renderer.ts• L485-519 modules/…/splat-renderer.ts• L932-965 modules/…/splat-shaders.ts• L338-475

Streaming and interaction

The module supports progressive visual content by appending independently owned batches or by selecting active rows from retained pages. Camera changes refresh visibility, radiance, and ordering while source ownership remains with the caller.

Batch updates

The renderer borrows prepared batches and keeps their GPU allocations under caller ownership. Applications can append batches or replace the retained batch list. A source revision causes the renderer to refresh camera-dependent visibility and ordering without changing the source row identity.

References: modules/…/splat-renderer.ts• L203-232 modules/…/splat-renderer.ts• L274-307 modules/…/splat-renderer.ts• L609-636

Picking workflow

The dedicated picker renders the same visible and ordered splats into a picking target. WebGPU and capable WebGL devices use exact integer source indices. Other WebGL devices use packed color slots. The result resolves to the stable source batch, global row, batch-local row, and optional semantic ID, so a screen-space selection can address the original asset record instead of a transient draw position.

This picker owns its picking model and readback state but borrows the renderer's batches and draw runs. A null pointer clears the selection. A callback runs only when the resolved source identity changes.

References: modules/…/splat-picking.ts• L32-51 modules/…/splat-picking.ts• L181-233 modules/…/splat-picking.ts• L245-319 modules/…/splat-picking.ts• L321-359 modules/…/splat-picking.ts• L433-459

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the source column row layout aligned with GPU formats and with glTF attribute conversion.
  • Keep source row identity consistent across batch offsets, sorting, picking, and semantic filtering.
  • Keep the WebGPU and WebGL2 shader paths aligned for projection, alpha cutoff, tone mapping, and spherical-harmonic degree.
  • Keep paged output segments globally ordered when storage limits or active-row selection changes.
  • Keep compressed glTF decoding outside the rendering contract so decoded and compressed assets reach the same source representation.
  • Keep mixed scene-pass order explicit: opaque meshes must precede depth-tested splats and transparent meshes must follow them.
  • Keep the picker aligned with renderer draw runs, visibility masks, and stable source-row offsets across both exact-index and packed-color modes.

Important failure modes

TriggerConsequenceGuard
Source columns contain different row countsUpload fails or rows no longer describe the same splatValidate matching column lengths before creating GPU data
A source uses unsupported glTF primitive or extension settingsThe asset cannot enter the common splat representationReject unsupported mode, kernel, projection, sorting, or color space
A compressed glTF primitive has no decoderLoading stops before GPU preparationSupply a caller-owned SPZ decoder when decoded attributes are absent
Camera order is stale for transparent contentSplats blend in the wrong depth orderRefresh visibility and ordering after camera or source revisions
A requested spherical-harmonic band is incompleteView-dependent color cannot be reconstructed reliablyRequire complete consecutive bands and a matching degree
A WebGL color-picking batch or packed slot exceeds its row limitThe affected rows cannot produce a portable color-pick resultUse exact index picking when supported or keep packed slots within their row limits
Picking uses a renderer after its batches or resources are destroyedThe pick is cleared or the picking pipeline cannot resolve a source rowKeep the picker lifetime within the live renderer lifetime

Key files

FileWhy to read it
modules/…/splat-data.tsDefines the shared per-splat representation, batch identity, and GPU preparation boundary.
modules/…/splat-gltf.tsShows how decoded Khronos Gaussian-splat assets enter that representation.
modules/…/splat-covariance.tsExplains how a rotated 3D Gaussian becomes a screen-space ellipse.
modules/…/splat-renderer.tsDescribes the common visibility, ordering, backend, scene-pass, and draw workflow.
modules/…/splat-shaders.tsShows the shared visual behavior for projection, Gaussian weighting, and blending.
modules/…/gpu-splat-graph-renderer.tsDescribes the WebGPU graph path for GPU-side projection and ordering.
modules/…/gpu-paged-splat-renderer.tsDescribes global ordering across active pages and bounded output segments.
modules/…/splat-picking.tsExplains the dedicated exact-index or packed-color picking pass and source identity resolution.