Skip to content

OccluderMaskPlugin

Masked occluder plugin

Plugin constructs instances of OccluderMaskMaterial. Occluders are elements of a scene that are not rendered by themselves but still participate in occlusion queries. Usually, an occluder is a base mesh (average approximation) of a body representing its real counterpart in a scene. Occluders are used to mask visible virtual objects behind them (like geometries of a 3D scene behind user’s body). Masked occluder material is a more advanced version that takes into account a detected segmentation mask. It writes depth value only for pixels covered by a mask providing more realistic occlusion aligned with a body, additionally reducing effect of unnatural cuts in VTO. OccluderMaskMaterial is created by the plugin that owns and updates mask texture and sets corresponding uniforms of shaders (do not construct OccluderMaskMaterial directly). Plugin depends on @geenee/bodyrenderers-common!MaskUploadPlugin that must be attached to the renderer to upload mask buffer in texture. One may utilize a @geenee/bodyrenderers-common!MaskUpscalePlugin providing higher resolution segmentation mask that significantly increases accuracy of patching and reduces the size of the patch region. Other mask post-processing plugins may be used to fine-tune for particular use case.

new OccluderMaskPlugin(thresh): OccluderMaskPlugin

Constructor

number = 0.55

Foreground threshold

OccluderMaskPlugin

BabylonPlugin.constructor

loaded: boolean

Loaded state

BabylonPlugin.loaded


protected maskRect: Vector4

Rect region of the segmentation mask


protected optional maskTexture: BaseTexture

Texture storing the segmentation mask


ordinal: number

Ordinal number

BabylonPlugin.ordinal


protected optional renderer: Renderer<PoseResult | FaceResult>

Renderer loaded the plugin

BabylonPlugin.renderer


protected optional scene: Scene

Reference to a scene instance

BabylonPlugin.scene


protected thresh: number = 0.55

Foreground threshold

createMaterial(): null | OccluderMaskMaterial

Create OccluderMaskMaterial

Occluders are elements of a scene that are not rendered by themselves but still participate in occlusion queries. Usually, occluder is a base mesh (average approximation) of a body representing its real counterpart in a scene. Occluders are used to mask visible virtual objects behind them (like geometries of a 3D scene behind user’s body). Masked occluder material is a more advanced version that takes into account a detected hd body segmentation mask. High resolution mask significantly increases accuracy. It writes depth value only for pixels covered by a mask providing more realistic occlusion aligned with a body, additionally reducing effect of unnatural cuts in VTO. OccluderMaskMaterial is created by the plugin, that owns and updates the mask texture and sets shader uniforms. (please do not construct OccluderMaskMaterial directly).

null | OccluderMaskMaterial

Instance of the masked occluder material


dispose(): void

Dispose video plugin

void

BabylonPlugin.dispose


load(renderer): Promise<void>

Initialize plugin

Allocates a texture for the segmentation mask.

Renderer<PoseResult | FaceResult>

Renderer this plugin is attached to

Promise<void>

Promise resolving when initialization is finished

BabylonPlugin.load


setupCamera(ratio, angle): void

Set camera parameters

Could be overridden to adjust plugin’s pipeline.

number

Aspect ration of input video

number

Vertical field of view in radians

void

BabylonPlugin.setupCamera


setupVideo(size): void

Set video size

Could be overridden to adjust plugin’s pipeline.

Size

Resolution of input video

void

BabylonPlugin.setupVideo


unload(): void

Reset plugin

Releases all resources allocated in load(). Deletes the segmentation mask texture.

void

BabylonPlugin.unload


update(result, stream): Promise<void>

Update segmentation mask

Updates internal segmentation mask texture and caches its box region uniform. Mask texture and uniform are provided to every occluder material created by the plugin before binding a mesh.

Pose estimation results

PoseResult | FaceResult

HTMLCanvasElement

Captured video frame

Promise<void>

Promise resolving when update is finished

BabylonPlugin.update