Motion SDK

Gaussian Splats

Draw surfaces as clouds of soft discs, sampled from signed-distance shapes with baked light or loaded from .ply and .splat captures.

A splats node draws a surface as thousands of small oriented discs ("Gaussian splats"). They come from signed-distance shapes that Motion samples at a spacing you choose (a procedural city block, a hut, a rock), from a .ply or .splat capture, or both. Light is baked into the colours once, when the scene loads, so shadows and lamp pools cost nothing per frame.

{
  "camera": { "position": [0, 2.4, 9], "target": [0, 1.3, 0], "fov": 34 },
  "lighting": { "rig": null },
  "environment": {
    "background": {
      "linear_gradient": { "from": "#2a2050", "to": "#0b0912", "angle": 180 }
    }
  },
  "post": { "tone_mapping": "none", "vignette": 0, "bloom": 0.25, "msaa": 1 },
  "nodes": {
    "street": {
      "splats": {
        "spacing": 0.07,
        "falloff": 1,
        "light": {
          "sun_direction": [-0.5, 0.7, 0.5],
          "sun_color": "#8a9cff",
          "sun_intensity": 0.7,
          "sky": "#3a3a7a",
          "ground": "#1a1424",
          "lamps": [
            {
              "position": [1.9, 2.5, 1.2],
              "color": "#ffb060",
              "intensity": 3,
              "radius": 6
            }
          ]
        },
        "shapes": [
          {
            "shape": { "box": { "size": [14, 0.2, 8] } },
            "position": [0, -0.1, 0],
            "color": "#3b4252",
            "noise": 0.5,
            "spacing": 0.1
          },
          {
            "shape": { "box": { "size": [4, 4.5, 3], "round": 0.05 } },
            "position": [-2.4, 2.25, -1],
            "color": "#7a5a52",
            "noise": 0.6
          },
          {
            "shape": { "box": { "size": [0.9, 1.3, 0.8] } },
            "position": [-2.4, 1.6, 0.5],
            "subtract": true,
            "color": "#ffc070",
            "emissive": true
          },
          {
            "shape": { "cylinder": { "radius": 0.07, "height": 3 } },
            "position": [1.9, 1.5, 1.2],
            "color": "#202230"
          },
          {
            "shape": { "sphere": { "radius": 0.22 } },
            "position": [1.9, 3.1, 1.2],
            "color": "#ffd090",
            "emissive": true
          }
        ]
      }
    }
  }
}
A lamp-lit corner made of box and cylinder shapes sampled into splats: moonlight with soft shadows, a warm street lamp baked in, and a glowing window carved into the wall. apps/docs/examples/splats.json · render it with motion-sdk render apps/docs/examples/splats.json -t 1 -o splats.png
"nodes": {
  "street": {
    "splats": {
      "spacing": 0.08,
      "falloff": 1,
      "light": { "sun_direction": [-0.5, 0.7, 0.5], "sun_intensity": 0.7, "shadows": true,
                 "lamps": [{ "position": [1.9, 2.5, 1.2], "color": "#ffb060", "intensity": 3, "radius": 6 }] },
      "shapes": [
        { "shape": { "box": { "size": [14, 0.2, 8] } }, "position": [0, -0.1, 0], "color": "#3b4252", "noise": 0.5, "spacing": 0.1 },
        { "shape": { "box": { "size": [4, 4.5, 3], "round": 0.05 } }, "position": [-2.4, 2.25, -1], "color": "#7a5a52" },
        { "shape": { "box": { "size": [0.9, 1.3, 0.8] } }, "position": [-2.4, 1.6, 0.5], "subtract": true, "color": "#ffc070", "emissive": true }
      ]
    }
  }
}

Shapes

  • shape is one of sphere, box (with rounded edges), cylinder and capsule (upright, along Y) or ellipsoid. position and rotation (degrees) place it in the node's space.
  • Shapes are united in order. blend is a smooth-union radius, so two shapes can melt into each other. A shape with subtract is carved out of the union of all the others, and the faces it opens up take the carving shape's own color. Make it emissive and the opening glows: a lit window, a doorway.
  • color sets the surface; noise (0 to 1, at noise_scale world units) breaks it up with stone-like variation.
  • Only the visible surface becomes splats: whatever is buried inside another shape is dropped, so overlapping shapes cost nothing extra.

Meshes

meshes samples glTF models (a Blender export, or kit output from @motion-sdk/scene/kits) into the same cloud. Each entry has a src (a path, a URL in the browser or a data:model/gltf-binary;base64, URI), an optional fit, position, rotation and scale, and parts: a colour (with noise and emissive) per glTF mesh or node name. Triangles are covered evenly by a fixed low-discrepancy pattern, so the cloud is the same every run, and the cloud's light is baked in; shadows and ambient occlusion come from the shapes, so a mesh does not shade itself. Later parts cover earlier ones where they overlap (glass on a body, clothes on skin). Without parts, the whole model is sampled in grey.

"splats": {
  "spacing": 0.05,
  "light": { "sun_intensity": 0.6 },
  "meshes": [{ "src": "chair.glb", "position": [1, 0, 0],
               "parts": { "seat": { "color": "#8a5a3a", "noise": 0.2 }, "legs": { "color": "#222" } } }]
}

Density and speed

spacing is the distance between neighbouring splats on a surface, in world units. Halving it quadruples the splats. Give big flat things (a road, a far wall) their own coarser spacing and faces the camera comes close to a finer one. A hundred thousand splats is comfortable; a million is for powerful GPUs.

The bake runs once per load (and when the node's shapes change), on the CPU. A 150,000-splat street with four lamps takes a few seconds native and noticeably longer in the browser; the scene shows when it is done.

Light

light bakes colour into the splats; without it they keep their shape colours. It has a sun (direction, colour, intensity), a sky and ground ambient, optional point lamps (position, colour, intensity, radius) and shadows, which marches each splat toward every light through the shapes. Ambient occlusion darkens creases. emissive shapes skip the light and are drawn 4x brighter, so they bloom.

The mesh lights, fog and shadow maps of the rest of the scene do not touch splats, and splats cast no shadow maps; bake any light that should be on them.

Solid or soft

  • falloff 1 (the default) draws Gaussians that fade into their neighbours. They blend, so they are sorted back to front on the CPU whenever the view changes, and separate soft clouds are ordered by their centres.
  • falloff 0 draws solid discs that write depth and are never sorted or blended. They intersect meshes and each other exactly, and they stay crisp: pair them with post.pixel_art.

Files

src points at a .ply (a 3D Gaussian Splatting export, binary little endian) or a .splat file: a path relative to the scene, a URL in the browser or a data URI. The browser loader and the CLI fetch it after the scene starts; until then only the shapes draw. File splats are drawn as captured and are not re-lit. scale and opacity apply to every splat. Files up to 4 million splats load.

Where it Runs

Splats are opt-in, so the default bundles do not grow:

  • The CLI, the exporter and native renders have them (feature splat).
  • In the browser, createPlayer loads the separate webgpu-splat or webgl-splat bundle for a scene with a splats node (or when you pass splats: true). They are the authoring bundles plus the splat module and are fetched only then.
  • The small player, the authoring bundle, the standard WebGL2 bundle and the WebXR bundles do not know splats. validate() in @motion-sdk/core uses the authoring bundle, so it reports splats as an unknown field; motion-sdk validate knows it.

The rain street

examples/ts/rain-street-splats.ts rebuilds the rain street's architecture as splat shapes with the moon, neon, doorway and street lamp baked in, samples the woman and the parked sedan (modelled with the kits) as meshes, and keeps the passing wagon, the rain and the neon letters as meshes and particles, all under the pixel-art pass. Render it with motion-sdk render examples/rain-street-splats.json --frame 12 -o frame.png.

Credits

The sampling and baked lighting follow pixelart-gaussiansplat and the file formats and projection follow Spark (both MIT); see THIRD_PARTY.md.

API Reference

Splats

A node's cloud of Gaussian splats.

PropertyTypeDefaultDescription
falloffnumber (0 to 1)1Edge softness, 0..1. 1 is a Gaussian that fades into its neighbours (sorted back to front and blended); 0 is a solid disc that writes depth, with no sorting and no blending, which keeps pixel-art frames crisp.
lightSplatLight—Light baked into the procedural splats' colours once, when the scene loads: sun with soft shadows, sky and lamps. Without it the splats keep their plain shape colours.
meshesSplatMesh[]—Triangle meshes (glTF or GLB: Blender and modelling-kit exports) sampled into splats at the cloud's spacing, with the cloud's baked light. The shapes' signed-distance field casts their shadows.
opacitynumber (0 to 1)1Opacity multiplier, 0..1.
scalenumber (0.05 to 20)1Size multiplier for every splat (procedural and loaded).
shapesSplatShape[]—Signed-distance shapes, combined into one surface that is sampled into splats. Shapes with subtract are carved out of the union of the others.
spacingnumber (0.01 to 2)0.08Distance between neighbouring splats on a shape's surface, in world units (0.01 to 2). Smaller is denser and slower.
srcstring—A .ply (3D Gaussian Splatting export) or .splat file: a path relative to the scene, a URL (browser) or a data URI. Its splats are drawn along with the shapes' and are not re-lit.

SplatShape

One signed-distance shape of a splat cloud.

PropertyTypeDefaultDescription
blendnumber (0 to 4)—Smooth-union radius with the shapes before it, in world units (0 is a hard union).
colorColor"#cccccc"Surface colour.
emissiveboolean—Skip the baked light for this shape: lamp glass, neon or a lit window keeps its colour, drawn 4x brighter so it can glow.
noisenumber (0 to 1)—Colour variation from 3D noise, 0..1: stonework, plaster, grain.
noise_scalenumber (0.01 to 100)0.3Size of the noise features in world units.
position[x, y, z][0,0,0]Centre of the shape in the node's space.
rotation[x, y, z][0,0,0]Euler rotation in degrees (XYZ).
shape*SplatSdfrequiredThe primitive.
spacingnumber (0.01 to 2)—Splat spacing for this shape (a coarse one for a big flat road, a fine one for a face). Defaults to the cloud's spacing.
subtractboolean—Carve this shape out of the shapes before it instead of adding it.

SplatMesh

A glTF/GLB model whose surface is sampled into splats.

PropertyTypeDefaultDescription
fitnumber (0.001 to 1000)—Scale the model so its largest side is this long, standing on its base (as model.fit does).
partsmap of SplatPart—Colour and noise per glTF mesh or node name. Only the named parts are sampled; when empty, every part is, in the default grey.
position[x, y, z][0,0,0]Offset of the model in the node's space.
rotation[x, y, z][0,0,0]Euler rotation in degrees (XYZ).
scalenumber (0.001 to 1000)1Uniform scale.
spacingnumber (0.01 to 2)—Splat spacing for this model. Defaults to the cloud's spacing.
src*stringrequiredThe model: a path relative to the scene, a URL (browser) or a data:model/gltf-binary;base64, URI.

SplatPart

Look of one part of a [SplatMesh].

PropertyTypeDefaultDescription
colorColor"#cccccc"Surface colour.
emissivebooleanfalseGlows: skips the baked light.
noisenumber (0 to 1)0Colour variation from 3D noise, 0..1.
noise_scalenumber (0.01 to 100)0.3Size of the noise features in world units.

SplatSdf

A signed-distance primitive, centred on the shape's position. Single key, like the mesh geometries.

{"sphere": { … }}A ball.

PropertyTypeDefaultDescription
radiusnumber1Ball radius in world units.

{"box": { … }}A box with optionally rounded edges.

PropertyTypeDefaultDescription
roundnumber0Edge rounding radius.
size[x, y, z][1,1,1]Width, height and depth in world units.

{"cylinder": { … }}An upright (Y axis) cylinder.

PropertyTypeDefaultDescription
heightnumber1Height in world units.
radiusnumber0.5Radius in world units.
roundnumber0Edge rounding radius.

{"capsule": { … }}An upright (Y axis) capsule: a cylinder of length between two hemispheres.

PropertyTypeDefaultDescription
lengthnumber1Length of the straight part between the caps, in world units.
radiusnumber0.5Radius of the cylinder and its caps, in world units.

{"ellipsoid": { … }}A stretched ball.

PropertyTypeDefaultDescription
radii[x, y, z][1,1,1]Radius along each axis, in world units.

SplatLight

Light baked into splat colours.

PropertyTypeDefaultDescription
groundColor"#4d474d"Ambient light from below (surfaces facing down).
lampsSplatLamp[]—Point lights that colour what is near them.
shadowsbooleantrueSoft shadows from the sun and the lamps, marched through the shapes' distance field.
skyColor"#8c9ecc"Ambient light from above (surfaces facing up).
sun_colorColor"#fff2d9"Sunlight colour.
sun_direction[x, y, z][0.45,0.8,0.4]Direction toward the sun.
sun_intensitynumber (0 to 16)1Sun strength (0 turns the sun off).

SplatLamp

A point light baked into splat colours.

PropertyTypeDefaultDescription
colorColor"#cccccc"Light colour.
intensitynumber (0 to 64)1Strength at the lamp's own surface.
position*[x, y, z]requiredWhere the lamp is, in the node's space.
radiusnumber (0.05 to 100)3Distance at which its light has faded out, in world units.