Skip to content

@orillusion/core


Class: SceneCaptureCameraComponent

Defined in: src/components/SceneCaptureCameraComponent.ts:76

Off-screen camera that captures the current scene into a render texture for other materials to sample. Typical uses: mirrors (mirrored-camera capture sampled by a quad), security-camera monitors (capture from a distant viewpoint, sampled by a TV mesh), portals, picture-in-picture mini-maps.

Architecture

  • Attach this component to an Object3D whose Camera3D should drive the capture viewpoint (the same node, or a child — the component resolves the camera lazily on start()).
  • The component lazily allocates a GBufferFrame sized width × height the first time the pass needs it. Allocation uses the same color (rgba16float) + compress (rgba32float) + depth (depth32float) layout as the main color pass, so existing material PassType.COLOR pipelines bind without recompilation.
  • The captured color texture is exposed via getCaptureTexture; bind it into any material's sampler slot to read the captured scene.
  • On onEnable the component registers itself with EntityCollect (per-scene index); the bundled SceneCapturePass iterates the index each frame.

Mask filtering

  • captureMask: bitmask of RendererMask bits that a renderer must overlap to be drawn into the capture. Default is 0xffffffff (include every renderer).
  • excludeMask: bitmask that, if any bit overlaps the renderer's mask, skips the renderer. Default is 0 (exclude nothing). Useful for "TV doesn't capture itself" — set a custom bit on the TV's renderer mask, then add that bit to excludeMask.

The final test is (rm & captureMask) !== 0 && (rm & excludeMask) === 0.

Update mode

  • updateMode = 'always' re-renders every frame the pass runs.
  • updateMode = 'manual' skips re-render unless needUpdate is true; the pass clears the flag after rendering. Use for static security feeds (one-shot bake) or for app-driven cadence (every-N-frames update).

Extends

Constructors

Constructor

new SceneCaptureCameraComponent(): SceneCaptureCameraComponent

Returns

SceneCaptureCameraComponent

Inherited from

ComponentBase.constructor

Properties

object3D

object3D: Object3D = null

Defined in: src/components/ComponentBase.ts:29

owner object3D

Inherited from

ComponentBase.object3D


isDestroyed

isDestroyed: boolean = false

Defined in: src/components/ComponentBase.ts:77

Inherited from

ComponentBase.isDestroyed


width

width: number = 512

Defined in: src/components/SceneCaptureCameraComponent.ts:79

Capture render target width in pixels. Re-allocates the internal GBuffer on the next render if changed.


height

height: number = 512

Defined in: src/components/SceneCaptureCameraComponent.ts:83

Capture render target height in pixels. Re-allocates on change.


captureMask

captureMask: number = 0xffffffff

Defined in: src/components/SceneCaptureCameraComponent.ts:87

Bitwise allowlist over RendererMask. A renderer is captured only if (node.rendererMask & captureMask) !== 0.


excludeMask

excludeMask: number = 0

Defined in: src/components/SceneCaptureCameraComponent.ts:91

Bitwise denylist over RendererMask. A renderer is skipped if (node.rendererMask & excludeMask) !== 0.


clearColor

clearColor: Color

Defined in: src/components/SceneCaptureCameraComponent.ts:95

RGBA clear color applied to the color attachment at the start of each capture. Depth always clears to 1.0.


includeSky

includeSky: boolean = true

Defined in: src/components/SceneCaptureCameraComponent.ts:99

Whether to render the scene's AtmosphericComponent / sky into the capture. Default true.


includeTransparent

includeTransparent: boolean = true

Defined in: src/components/SceneCaptureCameraComponent.ts:103

Whether to render transparent renderers into the capture. Default true.


updateMode

updateMode: SceneCaptureUpdateMode = 'always'

Defined in: src/components/SceneCaptureCameraComponent.ts:106

See SceneCaptureUpdateMode.


needUpdate

needUpdate: boolean = true

Defined in: src/components/SceneCaptureCameraComponent.ts:110

Manual-mode trigger. SceneCapturePass clears this back to false after rendering. Ignored when updateMode === 'always'.

Accessors

visibleLayer

Get Signature

get visibleLayer(): number

Defined in: src/components/ComponentBase.ts:46

Composition-layer membership bitmask. The pass / camera / collector filters via

(component.visibleLayer & pass.layerMask & camera.cullingMask) !== 0

Defaults to VisibleLayer.Default (bit 0) so a fresh subclass is visible to passes whose layerMask is VisibleLayer.All (which includes bit 0). Application code can assign project-specific bits (1..31) to organise the scene into composition layers.

Returns

number

Set Signature

set visibleLayer(value): void

Defined in: src/components/ComponentBase.ts:50

Parameters
value

number

Returns

void

Inherited from

ComponentBase.visibleLayer


eventDispatcher

Get Signature

get eventDispatcher(): CEventDispatcher

Defined in: src/components/ComponentBase.ts:63

Returns

CEventDispatcher

Set Signature

set eventDispatcher(value): void

Defined in: src/components/ComponentBase.ts:68

Parameters
value

CEventDispatcher

Returns

void

Inherited from

ComponentBase.eventDispatcher


isStart

Get Signature

get isStart(): boolean

Defined in: src/components/ComponentBase.ts:79

Returns

boolean

Inherited from

ComponentBase.isStart


transform

Get Signature

get transform(): Transform

Defined in: src/components/ComponentBase.ts:89

Return the Transform component attached to the Object3D. Null before the component is attached — addComponent assigns object3D only after construction — so constructor-time callers can probe safely via this.transform?..

Returns

Transform

Inherited from

ComponentBase.transform


enable

Get Signature

get enable(): boolean

Defined in: src/components/ComponentBase.ts:113

Enable/disable components. The enabled components can be updated, while the disabled components cannot be updated.

Returns

boolean

Set Signature

set enable(value): void

Defined in: src/components/ComponentBase.ts:96

Enable/disable components. The enabled components can be updated, while the disabled components cannot be updated.

Parameters
value

boolean

Returns

void

Inherited from

ComponentBase.enable


camera

Get Signature

get camera(): Camera3D

Defined in: src/components/SceneCaptureCameraComponent.ts:153

Active Camera3D driving the capture, or null if none was found at start(). SceneCapturePass skips components with a null camera.

Returns

Camera3D

Methods

stop()

stop(): void

Defined in: src/components/ComponentBase.ts:163

Returns

void

Inherited from

ComponentBase.stop


onUpdate()?

optional onUpdate(view?): any

Defined in: src/components/ComponentBase.ts:166

Parameters

view?

View3D

Returns

any

Inherited from

ComponentBase.onUpdate


onLateUpdate()?

optional onLateUpdate(view?): any

Defined in: src/components/ComponentBase.ts:167

Parameters

view?

View3D

Returns

any

Inherited from

ComponentBase.onLateUpdate


onBeforeUpdate()?

optional onBeforeUpdate(view?): any

Defined in: src/components/ComponentBase.ts:168

Parameters

view?

View3D

Returns

any

Inherited from

ComponentBase.onBeforeUpdate


onCompute()?

optional onCompute(view?, command?): any

Defined in: src/components/ComponentBase.ts:169

Parameters

view?

View3D

command?

GPUCommandEncoder

Returns

any

Inherited from

ComponentBase.onCompute


onGraphic()?

optional onGraphic(view?): any

Defined in: src/components/ComponentBase.ts:170

Parameters

view?

View3D

Returns

any

Inherited from

ComponentBase.onGraphic


onParentChange()?

optional onParentChange(lastParent?, currentParent?): any

Defined in: src/components/ComponentBase.ts:171

Parameters

lastParent?

Object3D

currentParent?

Object3D

Returns

any

Inherited from

ComponentBase.onParentChange


onAddChild()?

optional onAddChild(child): any

Defined in: src/components/ComponentBase.ts:172

Parameters

child

Object3D

Returns

any

Inherited from

ComponentBase.onAddChild


onRemoveChild()?

optional onRemoveChild(child): any

Defined in: src/components/ComponentBase.ts:173

Parameters

child

Object3D

Returns

any

Inherited from

ComponentBase.onRemoveChild


cloneTo()

cloneTo(obj): void

Defined in: src/components/ComponentBase.ts:180

clone component data to target object3D

Parameters

obj

Object3D

target object3D

Returns

void

Inherited from

ComponentBase.cloneTo


copyComponent()

copyComponent(from): this

Defined in: src/components/ComponentBase.ts:182

Parameters

from

this

Returns

this

Inherited from

ComponentBase.copyComponent


beforeDestroy()

beforeDestroy(force?): void

Defined in: src/components/ComponentBase.ts:249

before release this component, object refrences are not be set null now.

Parameters

force?

boolean

Returns

void

Inherited from

ComponentBase.beforeDestroy


init()

init(): void

Defined in: src/components/SceneCaptureCameraComponent.ts:123

Returns

void

Overrides

ComponentBase.init


start()

start(): void

Defined in: src/components/SceneCaptureCameraComponent.ts:129

Returns

void

Overrides

ComponentBase.start


onEnable()

onEnable(view?): void

Defined in: src/components/SceneCaptureCameraComponent.ts:138

Parameters

view?

View3D

Returns

void

Overrides

ComponentBase.onEnable


onDisable()

onDisable(view?): void

Defined in: src/components/SceneCaptureCameraComponent.ts:144

Parameters

view?

View3D

Returns

void

Overrides

ComponentBase.onDisable


getCaptureTexture()

getCaptureTexture(): RenderTexture

Defined in: src/components/SceneCaptureCameraComponent.ts:169

Color render-target the capture writes into (rgba16float). The internal GBuffer is lazily allocated on first call; subsequent calls return the same handle so material samplers stay bound across frames. Re-allocates if width / height changed since the last allocation.

Returns null when called before any render has produced a GBuffer (i.e. the component isn't enabled or the pass hasn't fired yet). Most users want the post-render value — call this after Engine3D.startRenderView returns or read it inside an onUpdate hook.

Returns

RenderTexture


destroy()

destroy(force?): void

Defined in: src/components/SceneCaptureCameraComponent.ts:265

release this component

Parameters

force?

boolean

Returns

void

Overrides

ComponentBase.destroy