Skip to content

@modoki/engine / index / OffscreenCameraOverride

Interface: OffscreenCameraOverride

Offscreen scene capture registry (ELECTRON_PLAN Phase 5 — render_scene).

render_scene needs a live WebGPU renderer + ECS world, which exist only in the renderer process — so the active Scene3D registers a render function here on mount, and the agent bridge calls renderSceneOffscreen() to produce a deterministic, window-independent frame (caller-chosen size + camera) by rendering the live scene into an offscreen target and reading it back.

Unlike capture_viewport (a screenshot of the actual editor window — final composited pixels, NPR included, but tied to the window's size/layout), this is reproducible: same scene state + same camera ⇒ same framing, every time. The forward pass only (NPR/post-FX is window-bound) — use it for geometry, material, lighting, and camera-framing checks; use capture_viewport for the final stylized look.

Single-slot, last-registered-wins: with the editor open, the live game view's Scene3D is the registrant. Throws a clear error if no 3D view is mounted.

Rendering

fov?

optional fov?: number

Vertical FOV in degrees. Omit to keep the live camera's FOV.


position?

optional position?: [number, number, number]

World-space camera position [x,y,z]. Omit to keep the live camera's pose.


target?

optional target?: [number, number, number]

Look-at target [x,y,z]. Omit to keep the live camera's orientation.

Built with Modoki.