Skip to content

PoseTwinPlugin

Plugin rendering a digital twin

PoseAlignPlugin extension for digital twins mirroring the pose and residing beside a user. When rendering a twin we do not translate bones to align with keypoint coordinates and only preserve relative rotations. After projecting the detected pose onto a twin, twin’s scene node can be further transformed relative to the initial position - centers of hips are the same.

Extends

Constructors

new PoseTwinPlugin()

new PoseTwinPlugin(node?, translation?, rotation?, scale?, tune?): PoseTwinPlugin

Constructor

Parameters

node?: Object3D<Object3DEventMap>

Scene node to attach

translation?: Vector3

Relative translation of the twin

rotation?: Quaternion

Relative rotation of the twin

scale?: number

Scale of the twin

tune?: PoseTuneParams = ...

Fine-tuning parameters

Returns

PoseTwinPlugin

Overrides

PoseAlignPlugin.constructor

Properties

alignScore

readonly alignScore: 0.9 = 0.90

Pose score threshold

Inherited from

PoseAlignPlugin.alignScore


alignVisibility

readonly alignVisibility: 0.9 = 0.90

Keypoint visibility threshold

Inherited from

PoseAlignPlugin.alignVisibility


avatarLength

protected avatarLength: number = 1

Reference length of the model

Inherited from

PoseAlignPlugin.avatarLength


loaded

loaded: boolean

Loaded state

Inherited from

PoseAlignPlugin.loaded


node?

protected optional node: Object3D<Object3DEventMap>

Scene node to attach

Inherited from

PoseAlignPlugin.node


ordinal

ordinal: number

Ordinal number

Inherited from

PoseAlignPlugin.ordinal


renderer?

protected optional renderer: Renderer<PoseResult>

Renderer loaded the plugin

Inherited from

PoseAlignPlugin.renderer


rotation?

protected optional rotation: Quaternion

Relative rotation of the twin


scale?

protected optional scale: number

Scale of the twin


scene?

protected optional scene: Scene

Reference to a scene instance

Inherited from

PoseAlignPlugin.scene


skeleton?

protected optional skeleton: Skeleton

Reference to model’s skeleton

Inherited from

PoseAlignPlugin.skeleton


skeletonNodes?

protected optional skeletonNodes: SkeletonNodes

Bones of the model’s rig

Inherited from

PoseAlignPlugin.skeletonNodes


spineCurve?

protected optional spineCurve: SpineCurve

Shape of spine

Inherited from

PoseAlignPlugin.spineCurve


translation?

protected optional translation: Vector3

Relative translation of the twin


tune

protected tune: PoseTuneParams

Fine-tuning parameters

Inherited from

PoseAlignPlugin.tune

Methods

alignBone()

protected alignBone(transform, bone): void

Set bone aligning transformation

Overridden to assign only relative rotation.

Parameters

transform: BoneTransform

Global bone position and rotation

bone: Bone<Object3DEventMap>

Reference to bone instance

Returns

void

Overrides

PoseAlignPlugin.alignBone


dispose()

dispose(): void

Dispose video plugin

Returns

void

Inherited from

PoseAlignPlugin.dispose


estimateBones()

protected estimateBones(points, spineCurve): SkeletonTransforms

Estimate bone positions and axes

Based on detected keypoints estimates bone transformations. Position of bone if defined by 3D point itself, bone length is the distance between keypoints connected by bone. Bone’s rotation is defined by its axes that are evaluated from relative positions of adjacent keypoints. Method returns only bone position and orientation axis, final transformation of any bone can be found using the next bone in hierarchy.

Parameters

points: PosePoints

Pose keypoints

spineCurve: SpineCurve

Shape of spine

Returns

SkeletonTransforms

Bone transformations

Inherited from

PoseAlignPlugin.estimateBones


load()

load(renderer): Promise<void>

Initialize plugin

Parses and caches the rig/armature of the attached scene node (one provided to plugin’s constructor). Precalculates geometrical parameters of skeleton.

Parameters

renderer: Renderer<PoseResult>

Renderer this plugin is attached to

Returns

Promise<void>

Promise resolving when initialization is finished

Inherited from

PoseAlignPlugin.load


setNode()

setNode(node?): void

Set/attach a scene node

Parses and caches the rig/armature of the node. Precalculates geometrical parameters of skeleton.

Parameters

node?: Object3D<Object3DEventMap>

Scene node to attach

Returns

void

Inherited from

PoseAlignPlugin.setNode


setupCamera()

setupCamera(ratio, angle): void

Set camera parameters

Could be overridden to adjust plugin’s pipeline.

Parameters

ratio: number

Aspect ration of input video

angle: number

Vertical field of view in radians

Returns

void

Inherited from

PoseAlignPlugin.setupCamera


setupVideo()

setupVideo(size): void

Set video size

Could be overridden to adjust plugin’s pipeline.

Parameters

size: Size

Resolution of input video

Returns

void

Inherited from

PoseAlignPlugin.setupVideo


unload()

unload(): void

Reset plugin

Removes the attached node.

Returns

void

Inherited from

PoseAlignPlugin.unload


update()

update(result, stream): Promise<void>

Update skeleton of the scene node

Method is extended to set twin’s translation, rotation, and scale relative to estimated pose.

Parameters

result: PoseResult

Pose estimation results

stream: HTMLCanvasElement

Captured video frame

Returns

Promise<void>

Promise resolving when update is finished

Overrides

PoseAlignPlugin.update


updateHandL()

protected updateHandL(anchors, points): void

Update left hand skeleton

Parameters

anchors: SkeletonTransforms

Positions and axes of bones

points: PosePoints

Pose keypoints

Returns

void

Inherited from

PoseAlignPlugin.updateHandL


updateHandR()

protected updateHandR(anchors, points): void

Update right hand skeleton

Parameters

anchors: SkeletonTransforms

Positions and axes of bones

points: PosePoints

Pose keypoints

Returns

void

Inherited from

PoseAlignPlugin.updateHandR


updateLegL()

protected updateLegL(anchors, points): void

Update left leg skeleton

Parameters

anchors: SkeletonTransforms

Positions and axes of bones

points: PosePoints

Pose keypoints

Returns

void

Inherited from

PoseAlignPlugin.updateLegL


updateLegR()

protected updateLegR(anchors, points): void

Update right leg skeleton

Parameters

anchors: SkeletonTransforms

Positions and axes of bones

points: PosePoints

Pose keypoints

Returns

void

Inherited from

PoseAlignPlugin.updateLegR


updateSpine()

protected updateSpine(anchors): void

Update spine skeleton

Overridden to ignore relative scaling.

Parameters

anchors: SkeletonTransforms

Positions and axes of bones

Returns

void

Overrides

PoseAlignPlugin.updateSpine