Skip to main content

XR8.LayersController.pipelineModule()

XR8.LayersController.pipelineModule()

Description​

Creates a camera pipeline module that, when installed, provides semantic layer detection.

Parameters​

None

Returns​

Return value is an object made available to onUpdate as:

processCpuResult.layerscontroller: { rotation, position, intrinsics, cameraFeedTexture, layers }

PropertyTypeDescription
rotation{w, x, y, z}The orientation (quaternion) of the camera in the scene.
position{x, y, z}The position of the camera in the scene.
intrinsics[Number]A 16 dimensional column-major 4x4 projection matrix that gives the scene camera the same field of view as the rendered camera feed.
cameraFeedTextureWebGLTextureThe texture containing camera feed data.
layersRecord<String, LayerOutput>Key is the layer name, LayerOutput contains the results of semantic layer detection for that layer.

LayerOutput is an object with the following properties:

PropertyTypeDescription
textureWebGLTextureThe texture containing layer data. The r, g, b channels indicate our confidence of whether the layer is present at this pixel. 0.0 indicates the layer is not present and 1.0 indicates it is present. Note that this value will be flipped if invertLayerMask has been set to true.
textureWidthNumberWidth of the returned texture in pixels.
textureHeightNumberHeight of the returned texture in pixels.
percentageNumberPercentage of pixels that are classified as associated with the layer. Value in the range of [0, 1]

Dispatched Events​

layerloading: Fires when loading begins for additional layer segmentation resources.

layerloading.detail : {}

layerscanning: Fires when all layer segmentation resources have been loaded and scanning has begun. One event is dispatched per layer being scanned.

layerscanning.detail : {name}

PropertyTypeDescription
nameStringName of the layer which we are scanning.

layerfound: Fires the first time a layer has been found.

layerfound.detail : {name, percentage}

PropertyTypeDescription
nameStringName of the layer that has been found.
percentageNumberPercentage of pixels that are associated with the layer.

Example - adding pipeline module​

XR8.addCameraPipelineModule(XR8.LayersController.pipelineModule())