Ask the assistant
0/400
Your question is processed by an AI service and kept to improve answers. Do not enter personal data.

    Render3dViewport

    New scenes are written in markup — `.Scene` . This element shows a scene from a JSON file (engine format v1) together with a toolbar.

    The editor's 3D viewport: shows a v1 scene through the REEEL 3D engine (the editor downloads it by itself on first launch and keeps it up to date). One element is a whole panel: scene source, resolution, live preview or a still frame. The element is available only in the REEEL editor on Windows and macOS.

    Type: leaf

    // Minimal example — a live preview of a scene from a project file
    Render3dViewport scenePath:"data/scenes/hero.json"

    Parameters

    Parameter Type Default Description
    scenePath string — The scene's JSON document, a path from the project root ( data/scenes/hero.json ). An absolute path opens only in the editor.
    scene string — An inline scene (a JSON string); takes priority over scenePath .
    paused bool false Single-frame mode: draw one still frame and hold it.
    time double 0 The moment of the still frame, in seconds; used only with paused:true .

    Any scene parameter turns on autostart (in embedded form there is nobody to press the button). Without paused the panel runs a live preview with a time slider, a track editor and an Export button.

    Scene format

    A scene is one JSON document. The essentials:

    • Closed objects: an unknown field is an error with its path in the document ( entities[0][name="cube"].transform.scale: each component must be > 0 ).
    • Units: meters, seconds, radians ( fov is vertical, in radians).
    • Colors: hex is sRGB ( "#RRGGBB[AA]" ), rgba arrays are linear 0..1.
    • Exactly one mesh source per entity: cube / sphere / plane / glb .
    • activeCamera is required if the scene declares cameras.
    • Animation is keyframe tracks: a key's easing applies to the segment that STARTS at it; keys are sorted, at least one per track.

    A minimal document (valid as is):

    {
      "version": 1,
      "entities": [{ "name": "cube", "mesh": { "cube": { "size": [1, 1, 1] } } }],
      "activeCamera": "main",
      "tracks": []
    }

    Examples

    A still frame for a screenshot

    // One frame at t=0.5 — the same every time
    Render3dViewport scenePath:"data/scenes/hero.json" paused:true time:0.5

    Interactive preview with a timeline

    // When the editor's timeline drives the time,
    // the panel's own slider is hidden.
    Render3dViewport scenePath:"data/scenes/hero.json"

    Bad practices

    // BAD — `time` without `paused` is silently ignored: the live preview owns the clock.
    Render3dViewport scenePath:"data/scenes/hero.json" time:0.5
    // GOOD — single-frame mode needs both parameters.
    Render3dViewport scenePath:"data/scenes/hero.json" paused:true time:0.5
    // BAD — multi-line JSON inside a string breaks the markup; `scene` is
    // ONE line with escaped quotes, and it is rarely needed.
    Render3dViewport scene:"{
      "version": 1,
      ...
    }"
    // GOOD — the scene lives in a project file, the element gets the path.
    Render3dViewport scenePath:"data/scenes/hero.json"

    (Inline scene:"..." is for markup written by a program: then the JSON is encoded as a single line with \" .)

    Best practices

    • paused:true time:0 is the cheapest way to see an "empty scene": a camera with lookAt at zero looks into nowhere, and the markup looks broken although it is simply in the wrong place.
    • Export (the panel button) writes an mp4: from 0 to the end of the tracks, 30 frames per second, and does not interrupt the live preview.

    See also

    • 3D scenes — scenes in markup: .Scene and its family
    • Video — 2D video