Motion SDK

Instancing

Draw any number of copies of a mesh in a single draw call.

Many copies of one mesh should be one node with mesh.instances, not many nodes. It's one draw call however many copies there are.

96 rounded cubes in a grid and 24 spheres on a ring: two draw calls.
{
  "camera": { "position": [0, 7, 12], "target": [0, 0, 0], "fov": 40 },
  "lighting": { "rig": "golden_hour" },
  "environment": {
    "background": {
      "radial_gradient": { "inner": "#1b2233", "outer": "#07090f" }
    }
  },
  "nodes": {
    "cubes": {
      "mesh": {
        "geometry": {
          "rounded_box": { "size": [0.8, 0.8, 0.8], "radius": 0.12 }
        },
        "material": "preset:ceramic",
        "instances": {
          "grid": { "count": [12, 1, 8], "spacing": [1.1, 1, 1.1] }
        }
      }
    },
    "ring": {
      "transform": { "position": [0, 1.5, 0] },
      "mesh": {
        "geometry": { "sphere": { "radius": 0.25 } },
        "material": "preset:chrome",
        "instances": { "ring": { "count": 24, "radius": 5 } }
      }
    }
  }
}
96 rounded cubes in a grid and 24 spheres on a ring: two draw calls. apps/docs/examples/instancing.json · render it with motion-sdk render apps/docs/examples/instancing.json -t 1 -o instancing.png

Layouts

  • list: explicit positions, rotations and scales.
  • grid: count copies along x, y and z, spacing apart.
  • array: a row of copies. Copy k sits at start + k * step and turns k * rotate. Lane dashes, fence posts, windows.
  • ring: copies on a circle, optionally facing the centre.
  • scatter: seeded random copies in a radius.
  • path: copies riding a path, like traffic and crowds. See Paths.
  • on_terrain: copies scattered on a terrain. See Scatter.

Every copy shares the node's material. Per-copy colors are available on the path and on_terrain layouts.

API Reference

Instances

Copies of a mesh, drawn with a single instanced draw call.

{"list": Instance[]}Explicit per-instance transforms (relative to the node).

{"grid": { … }}Regular 3D grid centered on the node.

PropertyTypeDefaultDescription
count*integer[]requiredCopies along x, y, z.
spacing[x, y, z][1,1,1]Distance between copies along x, y, z.

{"array": { … }}A straight row of copies: copy k sits at start + k * step and is rotated by k * rotate (degrees). Lane dashes, fence posts, windows.

PropertyTypeDefaultDescription
count*integerrequiredNumber of copies.
rotate[x, y, z][0,0,0]Rotation added per copy, in degrees: copy k turns k * rotate.
start[x, y, z][0,0,0]Position of the first copy.
step[x, y, z][1,0,0]Offset between consecutive copies.

{"path": PathInstances}Copies riding a path (crowds, traffic); placed every frame.

{"ring": { … }}Copies evenly spaced on a circle in the XZ plane.

PropertyTypeDefaultDescription
count*integerrequiredNumber of copies.
face_centerbooleantrueRotate each copy to face the center.
radiusnumber2Circle radius.

{"on_terrain": TerrainScatter}Seeded placement on a terrain mesh node: rocks, pebbles, brush. Make this node a child of the terrain node (or give it the same transform) so copies sit on the ground.

{"scatter": { … }}Seeded random placement inside a sphere.

PropertyTypeDefaultDescription
count*integerrequiredNumber of copies.
radiusnumber2Radius of the area copies are scattered in.
random_rotationbooleantrueRandom rotation per copy.
scale_jitternumber0Random scale variation 0..1.
seedinteger—Overrides the scene seed.

Instance

One instance's transform (and optional tint).

PropertyTypeDefaultDescription
colorColor—Per-instance color multiplier.
position[x, y, z][0,0,0]Offset from the node.
rotation[x, y, z][0,0,0]Euler degrees.
scale[x, y, z][1,1,1]Scale of this copy.