Skip to main content

Class: ClothSkirtPlugin

@geenee/bodyrenderers-babylon.ClothSkirtPlugin

Cloth plugin for armatures with auxiliary skirt bones

ClothSkirtPlugin is an extension of ClothAlignPlugin that controls auxiliary skirt bones of armature if presented. Skirt bones are driven by legs but has additional kinematic constrains to mimic deformation of a fabric more naturally. This technic provides for higher fidelity virtual try-on of apparels that have a loose bottom skirt by controlling this part independently and not making it stick to legs so tightly. Auxiliary skirt bones must be clones of up leg and leg bones and skirt part should be skinned against them instead of legs.

Hierarchy

Constructors

constructor

new ClothSkirtPlugin(node?, tune?)

Constructor

Parameters

NameTypeDescription
node?TransformNodeScene node to attach
tunePoseTuneParamsFine-tuning parameters

Inherited from

ClothAlignPlugin.constructor

Properties

alignScore

Readonly alignScore: 0.9

Pose score threshold

Inherited from

ClothAlignPlugin.alignScore


alignVisibility

Readonly alignVisibility: 0.9

Keypoint visibility threshold

Inherited from

ClothAlignPlugin.alignVisibility


cameraAngle

Protected cameraAngle: number

Camera vertical angle in radians

Inherited from

ClothAlignPlugin.cameraAngle


cameraRatio

Protected cameraRatio: number

Camera aspect ratio

Inherited from

ClothAlignPlugin.cameraRatio


loaded

loaded: boolean

Loaded state

Inherited from

ClothAlignPlugin.loaded


node

Protected Optional node: TransformNode

Scene node to attach

Inherited from

ClothAlignPlugin.node


nodeOrigin

Protected nodeOrigin: BoneTransform

Origin of node relative to the root bone

Inherited from

ClothAlignPlugin.nodeOrigin


ordinal

ordinal: number

Ordinal number

Inherited from

ClothAlignPlugin.ordinal


renderer

Protected Optional renderer: Renderer<PoseResult>

Renderer loaded the plugin

Inherited from

ClothAlignPlugin.renderer


scene

Protected Optional scene: Scene

Reference to a scene instance

Inherited from

ClothAlignPlugin.scene


skeleton

Protected Optional skeleton: Skeleton

Reference to model's skeleton

Inherited from

ClothAlignPlugin.skeleton


skeletonNodes

Protected Optional skeletonNodes: SkeletonNodes

Bones of the model's rig

Inherited from

ClothAlignPlugin.skeletonNodes


skeletonSizes

Protected Optional skeletonSizes: SkeletonSizes

Reference sizes of skeleton

Inherited from

ClothAlignPlugin.skeletonSizes


skirtSkeletonNodes

Protected Optional skirtSkeletonNodes: SkirtSkeletonNodes

Auxiliary bones of skirt rig


spineCurve

Protected Optional spineCurve: SpineCurve

Shape of spine

Inherited from

ClothAlignPlugin.spineCurve


tune

Protected tune: PoseTuneParams

Fine-tuning parameters

Inherited from

ClothAlignPlugin.tune

Methods

dispose

dispose(): void

Dispose video plugin

Returns

void

Inherited from

ClothAlignPlugin.dispose


estimateBones

Protected estimateBones(pose, spineCurve, skeletonSizes): Object

Estimate bone positions and orientations

Using detected keypoints approximates 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 using kinematic rules and relative positions of adjacent keypoints. Method returns bone position and orientation in global world frame, final relative transformations are found traversing skeleton hierarchy and accumulating transforms of parents.

Parameters

NameTypeDescription
posePosePointsPose keypoints
spineCurveSpineCurveReference shape of spine
skeletonSizesSkeletonSizesReference sizes of skeleton

Returns

Object

Bone transformations

NameType
armLBoneTransform
armMidLBoneTransform
armMidRBoneTransform
armRBoneTransform
footLBoneTransform
footRBoneTransform
forearmLBoneTransform
forearmMidLBoneTransform
forearmMidRBoneTransform
forearmRBoneTransform
handLBoneTransform
handRBoneTransform
headBoneTransform
legLBoneTransform
legRBoneTransform
neckBoneTransform
neck1BoneTransform
pelvisBoneTransform
rootBoneTransform
shoulderLBoneTransform
shoulderRBoneTransform
spineBoneTransform
spine1BoneTransform
spine2BoneTransform
spine3BoneTransform
uplegLBoneTransform
uplegMidLBoneTransform
uplegMidRBoneTransform
uplegRBoneTransform

Inherited from

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

NameTypeDescription
rendererRenderer<PoseResult>Renderer this plugin is attached to

Returns

Promise<void>

Promise resolving when initialization is finished

Inherited from

ClothAlignPlugin.load


setNode

setNode(node?): void

Set/attach a scene node

Extended to parses and caches auxiliary skirt bones. Backward compatible with base skeleton rig, if skirt bones are not parsed controls only the base skeleton.

Parameters

NameTypeDescription
node?TransformNodeScene node to attach

Returns

void

Overrides

ClothAlignPlugin.setNode


setupCamera

setupCamera(ratio, angle): void

Set camera parameters

Parameters

NameTypeDescription
rationumberAspect ration of input video
anglenumberVertical field of view in radians

Returns

void

Inherited from

ClothAlignPlugin.setupCamera


setupVideo

setupVideo(size): void

Set video size

Could be overridden to adjust plugin's pipeline.

Parameters

NameTypeDescription
sizeSizeResolution of input video

Returns

void

Inherited from

ClothAlignPlugin.setupVideo


unload

unload(): void

Reset plugin

Removes the attached node.

Returns

void

Inherited from

ClothAlignPlugin.unload


update

update(result, stream): Promise<void>

Update skeleton of the scene node

Extends alignment of the base armature with guided control of skirt bones. Skirt bones are driven by leg bones but has additional kinematic constrains to mimic deformation of a fabric more naturally.

Parameters

NameTypeDescription
resultPoseResultPose estimation results
streamHTMLCanvasElementCaptured video frame

Returns

Promise<void>

Promise resolving when update is finished

Overrides

ClothAlignPlugin.update