Skip to content

[Feature] Render and encode Replay HQ in a dedicated OffscreenCanvas Worker #485

Description

@chdenat

Context

Replay HQ export currently uses a dedicated but main-thread Cesium host. The
standard workspace cannot be used freely during export because Cesium rendering,
tile readiness, composition, and encoding still compete with the UI event loop.

This issue proposes full execution isolation: the dedicated HQ Cesium runtime,
fixed frame timeline, scene readiness, composition, and encoding run in a
Worker. The HQ camera remains dedicated to the export and is never the
interactive Studio camera.

This issue does not add or restore a Visible map camera mode.

Requested behavior

Create a Worker-side HQ render host using OffscreenCanvas. The Worker must
own the deterministic HQ frame pipeline from the immutable export snapshot to
the encoded output. The main thread keeps the standard Studio workspace,
recording monitor, export controls, and final download handling.

DOM-based video widgets must be represented by a documented capture contract:
either a serializable Worker renderer or a frozen raster snapshot produced
before the Worker starts.

Acceptance criteria

  • Capability detection validates the required Worker, OffscreenCanvas, WebGL,
    Cesium, and encoding features before export starts.
  • The Worker owns the dedicated Cesium scene, camera, canvas, imagery, terrain,
    supported 3D Tiles, frame timeline, readiness, composition, and encoding.
  • No DOM node, React object, Valtio proxy, live Cesium object, or application
    singleton crosses the Worker boundary.
  • The standard Studio workspace remains visible and responsive during export.
  • Interactive camera and scene edits cannot change the immutable HQ export
    snapshot or dedicated HQ camera.
  • Video widget output is deterministic, correctly scaled, and frozen or
    rendered from a declared Worker-compatible representation.
  • Worker back-pressure bounds frame, pixel, and encoded-data memory.
  • Cancellation, context loss, readiness failure, encoding failure, and normal
    completion release the Worker, WebGL context, tile resources, and buffers.
  • The recording monitor receives progress, remaining time, errors, and
    cancellation state without becoming a replay clock or render authority.
  • A real HQ visual validation run proves camera motion, trace and marker
    progression, tile quality, widget composition, frame count, duration, and
    first/final frame correctness.
  • The benchmark compares this implementation with the current isolated
    main-thread baseline, including UI latency, export time, memory, GPU/context
    pressure where available, and tile requests.

Notes or questions

  • The existing canonical replay frame contract remains the only replay clock.
  • The crop rectangle and widget composition inputs must be frozen before the
    first Worker frame.
  • Unsupported capability must produce an explicit user-visible state; a silent
    change of camera or render authority is not acceptable.
  • This issue should follow a small feasibility spike if Cesium or the selected
    encoder path has not yet been proven in a Worker.

Technical notes

  • Define a versioned serializable scene descriptor and frame protocol.
  • Use OffscreenCanvas, transferables, and VideoFrame where supported.
  • Define Worker-side equivalents for scene readiness and overlay composition.
  • Add focused capability, protocol, cancellation, context-loss, memory, and
    lifecycle tests.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions