Skip to main content

Module: @geenee/bodyrenderers-common

Renderer

@geenee/armature!Renderer is the core visualization and logical part of any application. It's attached to the @geenee/armature!Engine. Basically, renders define two methods load() and update(). The first one is used to initialize assets and prepare the scene (lightning, environment map). The second is used to update the scene according to results of video processing. This's where all the logic happens. Renderers can be extended with plugins. Plugins do simple rendering task, for example add object to that follows the head or render avatar overlay.

This package defines common utilities, types, and helpers used by renderers. Additionally, it contains universal plugins that provide features not related to final rendering. Ready-made renderers and plugins are provided by the following packages:

Common Plugins

BrightnessPlugin

Plugin estimates parameters of lighting (brightness) observed in the current image and calls the provided callback with these parameters. This plugin can be used for automatic adjustment of intensities of lights on the scene, for example in callback user can scale intensity properties of lights and environment map according to estimated brightness. One can set output range, estimated value will not go below the minimum and [min..max] range will be scaled to [min..1.0]. Adaptive low pass smoothing is applied to the result.

Utility Plugins

CallbackPlugin

Simple plugin executing provided callback on processing results. Useful when, for example, application needs to show a message when no object is detected in camera's field of view or pose is not optimal for virtual try on.

PoseFilterPlugin

Simple plugin filtering a list of detected poses by the provided predicate. Useful when application may need to ignore certain poses to provide the best quality of virtual try-on. For example to ensure that at least upper body of user is in the field of view.

FaceFilterPlugin

Simple plugin filtering a list of detected faces by the provided predicate. Useful when application may need to ignore certain head poses, for example when rotation angle is too big for virtual try-on.

Classes

Interfaces

Type Aliases

BoneMap

Ƭ BoneMap<K, T>: { [key in K]: T }

Map of bones

Object with properties corresponding to each bone of skeleton.

Type Param

Union of bone names

Type parameters

NameTypeDescription
Kextends string[][`number`]-
TTType of mapped values

BoneName

Ƭ BoneName: typeof BoneList[number]

Union type of skeleton bones


SkeletonMap

Ƭ SkeletonMap<T>: KeyMap<BoneName, T>

Map of skeleton bones

Object with properties corresponding to each bone of skeleton.

Type parameters

NameDescription
TType of mapped values

Variables

BoneList

Const BoneList: readonly ["hips", "spine", "spine1", "spine2", "neck", "head", "headEnd", "shoulderL", "shoulderR", "armL", "armR", "forearmL", "forearmR", "handL", "handR", "uplegL", "uplegR", "legL", "legR", "footL", "footR", "toeL", "toeR"]

List of skeleton bones

Functions

mapBones

mapBones<B, T>(mapFn, bones): { [key in "hips" | "spine" | "spine1" | "spine2" | "neck" | "head" | "headEnd" | "shoulderL" | "shoulderR" | "armL" | "armR" | "forearmL" | "forearmR" | "handL" | "handR" | "uplegL" | "uplegR" | "legL" | "legR" | "footL" | "footR" | "toeL" | "toeR"]: T }

Mapping of bones

Creates a mapped object where values of properties for selected bones of skeleton are evaluated by provided mapping function.

Type parameters

NameTypeDescription
Bextends readonly ("hips" | "spine" | "spine1" | "spine2" | "neck" | "head" | "headEnd" | "shoulderL" | "shoulderR" | "armL" | "armR" | "forearmL" | "forearmR" | "handL" | "handR" | "uplegL" | "uplegR" | "legL" | "legR" | "footL" | "footR" | "toeL" | "toeR")[]Readonly list of bones
TTType of mapped object values

Parameters

NameTypeDescription
mapFn(b: B[number]) => TFunction mapping a bone to a value
bonesB-

Returns

{ [key in "hips" | "spine" | "spine1" | "spine2" | "neck" | "head" | "headEnd" | "shoulderL" | "shoulderR" | "armL" | "armR" | "forearmL" | "forearmR" | "handL" | "handR" | "uplegL" | "uplegR" | "legL" | "legR" | "footL" | "footR" | "toeL" | "toeR"]: T }

Mapped object of selected skeleton bones


mapSkeleton

mapSkeleton<T>(mapFn): Object

Mapping of skeleton

Creates a mapped object where value of property for each bone of skeleton is evaluated by provided mapping function.

Type parameters

NameDescription
TType of mapped object values

Parameters

NameTypeDescription
mapFn(b: "hips" | "spine" | "spine1" | "spine2" | "neck" | "head" | "headEnd" | "shoulderL" | "shoulderR" | "armL" | "armR" | "forearmL" | "forearmR" | "handL" | "handR" | "uplegL" | "uplegR" | "legL" | "legR" | "footL" | "footR" | "toeL" | "toeR") => TFunction mapping a bone to a value

Returns

Object

Mapped object of all skeleton bones

NameType
armLT
armRT
footLT
footRT
forearmLT
forearmRT
handLT
handRT
headT
headEndT
hipsT
legLT
legRT
neckT
shoulderLT
shoulderRT
spineT
spine1T
spine2T
toeLT
toeRT
uplegLT
uplegRT