Skip to content

Splats

Updated

A Gaussian splat is a photoreal capture of a real place or object, made of millions of small, soft, coloured blobs instead of triangles. You make one by scanning a real space with a phone or a camera and processing the photos into a splat file. The Splat Mesh shows that capture in your world, sorted and drawn on desktop, phones and headsets.

Use splats for real places and objects that would take weeks to model: a courtyard, a statue, a shop interior, a product. Scripts fade captures in once they are ready, tint them, choose their quality per device, and switch between them.

  • Entities and transforms. A splat’s size and placement are its entity’s transform. See Working with entities.
  • Async hooks. Waiting for a capture to appear uses await inside an async startup. See Scripting.
  • Tweens. Fades use Tween.value. See Animation.
ComponentTypeWhat it does
Splat Meshcomp-splat-meshShows a Gaussian splat capture.

SplatMeshComponent is required on a Splat Mesh entity (ent-splat-mesh).

Prop Type Default Description
src string none The splat file, .ply, .spz, .sog or .rad, as a URL or an ASSET-<uuid> reference. Any other file type is refused. Changing it reloads the splat.
color string '#ffffff' Tint multiplied over every splat. Applied live.
opacity number 1 0 to 1. Applied live, without reloading.
quality 'flat' | 'low' | 'medium' | 'high' 'low' How much view-dependent colour is kept (below). Changing it reloads the splat.
Member What it does
whenDrawn() Returns a promise that resolves once the splat is drawn. It resolves at once when there is nothing to draw, when the splat is out of view, or when its scene is not up.
setProps(patch) Change props. color and opacity apply live; src and quality reload.
setEnabled(on) Show or hide the capture.

A splat takes no material, and Mask, Decal and Cache Mesh do not apply to it. The entity supports Selectable, Grabbable, Pivotable, Outline and Silhouette (a border around its bounds), Billboard, Signal Emitter, Enable on Signal and animation timelines.

File Format
.ply Gaussian PLY, including compressed .compressed.ply files
.spz SPZ, versions 1 to 4
.sog SOG, versions 1 and 2, bundled in one file
.rad RAD, in one file

Any other file type is refused before anything loads, including .splat and .ksplat. A source without a file extension, such as an ASSET-<uuid> reference, is loaded and its format is read from the file itself.

A capture stores, for each blob, how its colour shifts with the viewing angle: glossy highlights, reflections, sheen. This is called view-dependent colour. quality sets how much of it is loaded and drawn. It never changes the number of blobs, their shape or their sharpness.

Quality Use it for
flat One colour per blob from every angle, about a quarter of high’s memory. Best for captures without shiny surfaces.
low The default. A little of the shine at a fraction of the memory; fast on every device.
medium Most of the shine.
high Everything the file stores, for close-up views of glossy captures on desktop.

Captures that share a file and a quality share one decoded copy in memory.

  • Distance detail. A far capture draws fewer blobs: all of them up close, half from 3 bounding radii away and a quarter from 6.
  • Close up. A blob never grows past 512 pixels across on screen (96 in a headset), so walking into a capture stays smooth.
  • Out of view. In play, a capture whose bounds are out of the camera’s view is not sorted or drawn.
  • Picking. Rays hit a splat like any mesh, so Selectable and Grabbable work on it. To let rays pass through, put it on a layer that is not raycastable (see Layers).
  • Memory. Destroying a splat frees its mesh. The decoded file stays cached until the app closes, so returning to a scene loads nothing. Each quality of a file is a separate copy.

A capture can take a moment to download and decode. This script keeps it invisible until it is drawn, then fades it in over two seconds instead of letting it pop in.

FadeInCapture.jx
#pragma lifecycle(startup)
async function startup() {
const capture = self.parent.getComponent(SplatMeshComponent);
capture.setProps({ opacity: 0 });
await capture.whenDrawn();
log('Capture drawn: fading it in');
Tween.value(0, 1, (value) => capture.setProps({ opacity: value }), { duration: 2, ease: Ease.InOutSine });
}
  • The Behavior sits on the Splat Mesh entity, so self.parent.getComponent(SplatMeshComponent) finds the capture.
  • opacity: 0 hides it without unloading it; opacity changes never reload the file.
  • await capture.whenDrawn() pauses startup until the capture is drawn. await is allowed because startup is async.
  • Tween.value(0, 1, …) raises the opacity smoothly. Each step is a live prop change.

A before-and-after view: the same room captured before and after a renovation. Pressing Space cross-fades from one capture to the other.

BeforeAfter.jx
#pragma lifecycle(startup, update)
let before;
let after;
let showingAfter = false;
let fade = null;
async function startup() {
before = findEntity('Room Before').getComponent(SplatMeshComponent);
after = findEntity('Room After').getComponent(SplatMeshComponent);
before.setProps({ opacity: 1 });
after.setProps({ opacity: 0 });
await Promise.all([before.whenDrawn(), after.whenDrawn()]);
}
function update() {
if (!Input.keyboard.isKeyReleased(Key.Space)) return;
showingAfter = !showingAfter;
if (fade) fade.stop();
const start = after.props.opacity;
const end = showingAfter ? 1 : 0;
fade = Tween.value(start, end, (value) => {
after.setProps({ opacity: value });
before.setProps({ opacity: 1 - value });
}, { duration: 1.5, ease: Ease.InOutQuad });
}
  • Both captures are placed at the same transform. One starts fully visible, the other at opacity 0.
  • Promise.all waits until both have been drawn once, so the first switch does not wait on a download.
  • Each Space press flips showingAfter. The fade starts from the current opacity, so pressing Space in the middle of a fade turns it around smoothly; the previous tween is stopped first.
  • One tween drives both captures, so their opacities always add up to 1.

A capture’s colours come from the photographs it was made from, and a splat takes no material. To match a time of day, tint it. This script blends a capture’s tint from white to a warm dusk colour when a signal arrives.

DuskTint.jx
#pragma lifecycle(startup)
const DAY = new THREE.Color('#ffffff');
const DUSK = new THREE.Color('#ffb27a');
const mixed = new THREE.Color();
function startup() {
const capture = self.parent.getComponent(SplatMeshComponent);
on('sky/dusk', () => {
Tween.value(0, 1, (t) => {
mixed.copy(DAY).lerp(DUSK, t);
capture.setProps({ color: `#${mixed.getHexString()}` });
}, { duration: 6, ease: Ease.InOutSine });
});
}
  • THREE.Color holds the two end colours; lerp blends between them by t.
  • color takes a hex string, so the blend is written with getHexString().
  • The colours are made once at the top of the script and reused every step.

Phones and standalone headsets have less memory than a desktop. This script picks a lighter quality there and a richer one on desktop, for every capture in a list.

SplatQualityByDevice.jx
#pragma lifecycle(startup)
const CAPTURES = ['Courtyard', 'Fountain', 'Statue'];
function startup() {
let quality = 'medium';
if (Device.isHeadset()) quality = 'flat';
else if (Device.isMobile()) quality = 'low';
for (const name of CAPTURES) {
const entity = findEntity(name);
if (!entity) continue;
const capture = entity.getComponent(SplatMeshComponent);
if (capture.props.quality !== quality) capture.setProps({ quality });
}
log(`Splat quality: ${quality}`);
}
  • Device.isHeadset() and Device.isMobile() describe the device the app runs on.
  • quality reloads the capture, so the script changes it only when it differs from the saved value (capture.props.quality).
  • Running this in startup, before the player looks around, keeps the reload out of sight. Better still, save scenes with the lightest quality you accept and raise it only where the device allows.
  • Blob count and overdraw drive the cost. Use trimmed captures: crop away the parts nobody will see before importing them.
  • Lower quality saves memory, not blob count.
  • Out-of-view captures are skipped in play, so several captures spread across a scene cost little while they are behind the camera.
  • The splat renderer loads with the first splat, so scenes without one pay nothing.
  • Using .splat or .ksplat files. Only .ply, .spz, .sog and .rad load. Convert other formats first.
  • Changing quality or src for a quick effect. Both reload the capture. Use color and opacity for live effects.
  • Expecting a material to restyle a capture. A splat takes no material: its colours come from the capture. Use color to tint it.
  • Giving it a material, a Mask or a Decal. None of these apply to splats.
  • Hiding a capture with opacity alone. A capture at opacity 0 is still in the scene and still a pickable object. To take it out of play, disable it; to let rays pass through it, put it on a layer that is not raycastable.