Skip to content

PoseBTwinPlugin

Plugin rendering a digital twin

PoseBFitPlugin 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.

new PoseBTwinPlugin(translation?, rotation?, scale?, tune?): PoseBTwinPlugin

Constructor

Vector3

Relative translation of the twin

Quaternion

Relative rotation of the twin

number

Scale of the twin

PoseTuneParams = ...

Fine-tuning parameters

PoseBTwinPlugin

PoseBFitPlugin.constructor

readonly alignScore: 0.9 = 0.90

Pose score threshold

PoseBFitPlugin.alignScore


readonly alignVisibility: 0.9 = 0.90

Keypoint visibility threshold

PoseBFitPlugin.alignVisibility


protected avatarLength: number = 1

Reference length of the model

PoseBFitPlugin.avatarLength


loaded: boolean

Loaded state

PoseBFitPlugin.loaded


protected optional node: Object3D<Object3DEventMap>

Attached scene node

PoseBFitPlugin.node


ordinal: number

Ordinal number

PoseBFitPlugin.ordinal


protected optional renderer: Renderer<PoseResult>

Renderer loaded the plugin

PoseBFitPlugin.renderer


protected optional rotation: Quaternion

Relative rotation of the twin


protected optional scale: number

Scale of the twin


protected optional scene: Scene

Reference to a scene instance

PoseBFitPlugin.scene


protected optional skeleton: Skeleton

Reference to model’s skeleton

PoseBFitPlugin.skeleton


protected optional skeletonNodes: SkeletonNodes

Bones of the model’s rig

PoseBFitPlugin.skeletonNodes


protected optional spineCurve: SpineCurve

Shape of spine

PoseBFitPlugin.spineCurve


protected optional translation: Vector3

Relative translation of the twin


protected tune: PoseTuneParams

Fine-tuning parameters

PoseBFitPlugin.tune

protected alignBone(transform, bone): void

Set bone aligning transformation

Overridden to assign only relative rotation.

BoneTransform

Global bone position and rotation

Bone

Reference to bone instance

void

PoseBFitPlugin.alignBone


dispose(): void

Dispose video plugin

void

PoseBFitPlugin.dispose


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.

PosePoints

Pose keypoints

SpineCurve

Shape of spine

SkeletonTransforms

Bone transformations

PoseBFitPlugin.estimateBones


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.

Renderer<PoseResult>

Renderer this plugin is attached to

Promise<void>

Promise resolving when initialization is finished

PoseBFitPlugin.load


setNode(node?): void

Set/attach a scene node

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

Object3D<Object3DEventMap>

Scene node to attach

void

PoseBFitPlugin.setNode


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

PoseBFitPlugin.setupCamera


setupVideo(size): void

Set video size

Could be overridden to adjust plugin’s pipeline.

Size

Resolution of input video

void

PoseBFitPlugin.setupVideo


unload(): void

Reset plugin

Removes the attached node.

void

PoseBFitPlugin.unload


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.

PoseResult

Pose estimation results

HTMLCanvasElement

Captured video frame

Promise<void>

Promise resolving when update is finished

PoseBFitPlugin.update


protected updateHandL(anchors, points): void

Update left hand skeleton

SkeletonTransforms

Positions and axes of bones

PosePoints

Pose keypoints

void

PoseBFitPlugin.updateHandL


protected updateHandR(anchors, points): void

Update right hand skeleton

SkeletonTransforms

Positions and axes of bones

PosePoints

Pose keypoints

void

PoseBFitPlugin.updateHandR


protected updateLegL(anchors, points): void

Update left leg skeleton

SkeletonTransforms

Positions and axes of bones

PosePoints

Pose keypoints

void

PoseBFitPlugin.updateLegL


protected updateLegR(anchors, points): void

Update right leg skeleton

SkeletonTransforms

Positions and axes of bones

PosePoints

Pose keypoints

void

PoseBFitPlugin.updateLegR


protected updateSpine(anchors): void

Update spine skeleton

Overridden to ignore relative scaling.

SkeletonTransforms

Positions and axes of bones

void

PoseBFitPlugin.updateSpine