Models and objects

Load model files, place copies of them, and link the objects in them to parameters: every option of files, objects and links.

files says which models the widget loads and where it puts them. objects then finds objects in those models by name and links them to your application’s parameters. This page lists every option of both, with the 3D models page as the starting point.

Model files

Each entry in files loads one glTF file (.glb, or .gltf with its data embedded), in the order of the list. The path is relative to the JSON file.

Field What it does Default
file The model file. Required. Write file_ instead to skip the entry and keep its settings
name The name of the model in the scene. A list of names adds the model once per name, all at the same place The name in the file
instances Copies of the model, each with its own name and place, see Several copies of one model
parent The object the model becomes a child of, by name or search pattern The scene
position Position [x, y, z] in m, relative to parent when set As in the file
rotationZYX Rotation [rz, ry, rx] in rad, applied z first, relative to parent when set As in the file
scale Uniform scale: 1 is the size in the file 1
instancing Draws the copies with GPU instancing, see below true for { name, count }, false otherwise
animate Plays the animations in the model, see Animations Not animated

With parent, the model keeps its place in the world when it is attached, unless you set position and rotationZYX: those place it relative to the parent. Use this to mount a gripper model on the flange of a robot model, for example.

Several copies of one model

A model that appears more than once, such as a row of identical axes or boxes on a conveyor, is downloaded and read once. There are three ways to add the copies:

"files": [
  { "file": "axis.glb", "name": ["AxisA", "AxisB"] },
  { "file": "box.glb", "instances": [
      { "name": "Box_left", "position": [0.5, -0.3, 0] },
      { "name": "Box_right", "position": [0.5, 0.3, 0], "rotationZYX": [1.57, 0, 0] }
  ] },
  { "file": "ball.glb", "instances": { "name": "ball", "count": 1000 } }
]
  • A name list adds one copy per name, all with the entry’s parent, position, rotationZYX and scale.
  • An instances list gives each copy its own name and place. A field an item leaves out is taken from the file entry.
  • instances with count adds count copies named ball_1, ball_2 and so on (start sets the first number, default 1), all at the same place. Links then move them, see Numbered objects.

Copies share the geometry and textures, but each has its own materials, so a colour or opacity link on one copy does not change the others. Find a part inside a copy with a search pattern: Box_left*Lid.

GPU instancing draws all copies of a mesh in one go, which keeps the dashboard fast with hundreds or thousands of copies. It is on by default for { name, count }. The cost: the copies share one material. A colour link per copy still works, but opacity, glow and shadow settings apply to all copies together. Set "instancing": false on the file entry to give each copy its own material, or "instancing": "off" in renderSettings to switch it off for the whole file. Models with lights, cameras, lines, skinned or morphed meshes, or meshes with several materials are always added as separate copies.

Objects

Each entry in objects applies settings and links to one object in the loaded models.

Field What it does Default
name The object, by name or search pattern. Required
castShadow The object and its children cast shadows false
receiveShadow Shadows fall on the object and its children false
links Parameters that move or change the object, see Links
count, start Make the entry a template for numbered objects, see Numbered objects

Shadows need a spotLight with castShadow, see Camera, lights and rendering.

Find objects by name

A name finds the first object with that name, anywhere in the scene. A search pattern finds an object inside another one: "Robot2*Link1" first finds Robot2, then Link1 below it. Patterns work in objects, parent, camera and animations.

If two models contain objects with the same names, give each model its own name in files and use patterns: duplicates across files are not renamed.

A link takes a value from a parameter, scales it, and applies it to an axis or a property of the object. The value is value × gain + offset.

Field What it does Default
link The parameter path
channel The element of an array parameter. Axes that take several values read the next elements too 0
axis What the value sets, see the table below. Use axis or property
property Any property of the object, see Properties
gain Multiplies the value. On axes with several values: one number for all, or a list with one gain per element 1
offset Added after the gain. On axes with several values: one number for all, or a list 0
value Used until the parameter has a value, or always when there is no link: a fixed value
magnitude Use the length of a vector instead of one element, see Vector lengths
start, stride Only in numbered objects

For example, "gain": [1, 1, 1, 0, 0, 0] on a pose link keeps the position and drops the rotation.

Axes

axis Sets Values read
x, y, z Position along one local axis, in m 1
rx, ry, rz Rotation about one local axis, in rad 1
position Position x, y, z 3
rotationZYX Rotation z, y, x 3
pose Position x, y, z, then rotation z, y, x 6
s Scale along all axes 1
sx, sy, sz Scale along one axis 1
scaleChildren Scales the first child by the first element, the second child by the second, and so on, while the object is visible 1 per child
visible Shows the object when the value is 0.5 or more 1
opacity From 0, invisible, to 1, opaque 1
color The colour of the object: a list gives r, g, b from 0 to 1, a number a 0xRRGGBB value, a text a CSS colour such as "red" 3, 1 or a text
emissiveIntensity How strongly emissive materials glow, for LEDs and lamps. With bloom they get a halo 1

visible and opacity work together, in any order: an object with opacity 0 is hidden, and it shows again when the opacity rises, unless a visible link hides it.

A fixed value without link sets something once, for example a see-through housing:

{ "name": "Housing", "links": [{ "axis": "opacity", "value": 0.4 }] }

Properties

property sets any property of the object directly: a name such as intensity for a light, or a path with dots such as material.emissive.r. The value is converted to the property’s type, and a property the object does not have is reported once. This example colours an LED strip from a four-element parameter, red, green, blue and brightness:

{
  "name": "LedStrip",
  "links": [
    { "property": "material.emissive.r", "link": "root/UserParameters/IO/LedColorEmissive", "channel": 0 },
    { "property": "material.emissive.g", "link": "root/UserParameters/IO/LedColorEmissive", "channel": 1 },
    { "property": "material.emissive.b", "link": "root/UserParameters/IO/LedColorEmissive", "channel": 2 },
    { "property": "material.emissiveIntensity", "link": "root/UserParameters/IO/LedColorEmissive", "channel": 3, "gain": 2 }
  ]
}

Vector lengths

magnitude uses the length of a vector instead of one element: true takes the whole array, { "start": 0, "length": 3 } a part of it. A twist [vx, vy, vz, wx, wy, wz] gives the linear speed with start 0 and the angular speed with start 3. gain and offset apply to the length, and channel is not used.

magnitude works for every axis or property that takes one number. On pose, position, rotationZYX, color and scaleChildren it is ignored, with a warning.

Numbered objects

When many objects are linked the same way, such as the axes of a gantry or a thousand balls, one entry with count stands for all of them. %d in name becomes the number (%02d pads it to two digits). The numbers start at start, default 1.

A link of such an entry reads its value in one of two ways:

  • One parameter per object. %d in the link path becomes the number of the parameter. The link’s own start sets the first one (default: the entry’s start), and stride the step (default 1):

    {
      "name": "Slider_%d", "count": 6,
      "links": [{
        "link": "root/AxesControl/actuatorControlLoops/actuatorControlLoop%02d/actuatorPositionActual",
        "axis": "x", "start": 0
      }]
    }
    

    Slider_1 to Slider_6 follow actuatorControlLoop00 to actuatorControlLoop05.

  • One array parameter for all objects. Without %d in the path, object number i reads from element channel + i × stride. Use stride 1 for one value per object, or 6 for one pose per object. Without stride, all objects read the same element:

    { "name": "ball_%d", "count": 1000, "links": [{ "link": "root/Balls/poses", "axis": "pose", "stride": 6 }] }
    

    ball_1 reads elements 0 to 5, ball_2 elements 6 to 11, and so on.

Older keys

Files made for earlier versions keep working. The widget still reads these keys, and the editor marks them with what to use instead:

Older key Use instead
file at the top level, a single model files
link, axis, channel, gain, offset, value, property directly on an object The same fields in an entry of links
channelStride stride
addEnvironmentMap, environmentMapIntensity on an object Nothing: the environment lights all objects. Its strength is set with intensity on the environment
properties at the top level Nothing: it has no effect