@vincentt-xr/sdk 2.0.0-alpha.7 → 2.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GROUNDING.md +5651 -82
- package/README.md +1 -0
- package/dist/CanonicalHeadFrame-BHcWyaiK.js +1506 -0
- package/dist/CanonicalHeadFrame-D-_T1OMU.cjs +1 -0
- package/dist/DebuggerUI-7ngnJsBe.js +275 -0
- package/dist/DebuggerUI-CoglgKdO.cjs +1 -0
- package/dist/FaceRetouch-CLoTfrcs.js +1071 -0
- package/dist/FaceRetouch-J1lC1WbS.cjs +134 -0
- package/dist/FaceSurface-CHAMEeG1.cjs +1 -0
- package/dist/FaceSurface-DmP9AEeC.js +27 -0
- package/dist/SegmentationOverlay-D_FWkcyP.cjs +35 -0
- package/dist/SegmentationOverlay-vn5x_knv.js +6237 -0
- package/dist/SkeletonUtils-C2r90MtN.js +21 -0
- package/dist/SkeletonUtils-CddIup1F.cjs +1 -0
- package/dist/TextLabel-XE0rQSDn.cjs +2 -0
- package/dist/TextLabel-c9BCucOI.js +961 -0
- package/dist/assets/cache.d.ts +99 -0
- package/dist/assets/estimate.d.ts +11 -0
- package/dist/assets/gltfLoader.d.ts +16 -0
- package/dist/assets/index.d.ts +7 -0
- package/dist/assets/loaders.d.ts +43 -0
- package/dist/assets/react.d.ts +33 -0
- package/dist/body-pose/index.d.ts +521 -0
- package/dist/body-trigger/__fixtures__/syntheticBody.d.ts +83 -0
- package/dist/body-trigger/frame.d.ts +88 -0
- package/dist/body-trigger/index.d.ts +6 -0
- package/dist/body-trigger/moves.d.ts +235 -0
- package/dist/body-trigger/trigger.d.ts +75 -0
- package/dist/calibration/calibration.d.ts +75 -0
- package/dist/calibration/index.d.ts +6 -0
- package/dist/calibration/storage.d.ts +13 -0
- package/dist/calibration/types.d.ts +53 -0
- package/dist/calibration/useXRCalibration.d.ts +46 -0
- package/dist/camera/CameraPermissionGate.d.ts +26 -0
- package/dist/camera/devices.d.ts +26 -0
- package/dist/camera/index.d.ts +8 -0
- package/dist/camera/permission.d.ts +86 -0
- package/dist/camera/useCameraPermission.d.ts +35 -0
- package/dist/canonicalFace-BHwyCx1c.js +9 -0
- package/dist/canonicalFace-C83I225R.cjs +1 -0
- package/dist/capabilities/detect.d.ts +45 -0
- package/dist/capabilities/index.d.ts +5 -0
- package/dist/capabilities/types.d.ts +120 -0
- package/dist/capabilities/useXRCapabilities.d.ts +18 -0
- package/dist/compat/environment.d.ts +5 -0
- package/dist/compat/index.d.ts +4 -0
- package/dist/compat/run.d.ts +18 -0
- package/dist/compat/scenarios.d.ts +10 -0
- package/dist/compat/types.d.ts +101 -0
- package/dist/components/BodyInstruction/BodyPoseHint.d.ts +63 -0
- package/dist/components/BodyInstruction/index.d.ts +69 -0
- package/dist/components/BodyInstruction/useBodyPose.d.ts +23 -0
- package/dist/components/BodyTracker/index.d.ts +17 -0
- package/dist/components/BodyTrigger/index.d.ts +49 -0
- package/dist/components/Debugger/DebuggerProvider.d.ts +14 -1
- package/dist/components/Debugger/DebuggerUI.d.ts +3 -1
- package/dist/components/FaceAtlas/FaceAtlasLayer.d.ts +114 -0
- package/dist/components/FaceAtlas/MadeUpCamera.d.ts +80 -0
- package/dist/components/FaceAtlas/constants.d.ts +8 -0
- package/dist/components/FaceAtlas/index.d.ts +7 -0
- package/dist/components/FaceAtlas/useFaceAtlasSurface.d.ts +84 -0
- package/dist/components/FaceAtlas/useFaceSkin.d.ts +84 -0
- package/dist/components/FaceCharacter/ExternalFaceMesh.d.ts +109 -0
- package/dist/components/FaceCharacter/FaceExpressionController.d.ts +53 -0
- package/dist/components/FaceCharacter/FaceMorph.d.ts +71 -0
- package/dist/components/FaceCharacter/FacePiercing.d.ts +65 -0
- package/dist/components/FaceCharacter/FaceReprojection.d.ts +85 -0
- package/dist/components/FaceCharacter/FaceRig.d.ts +38 -0
- package/dist/components/FaceCharacter/FaceSurface.d.ts +49 -0
- package/dist/components/FaceCharacter/FaceSurfaceOccluder.d.ts +39 -0
- package/dist/components/FaceCharacter/PinToFaceMesh.d.ts +68 -0
- package/dist/components/FaceCharacter/index.d.ts +18 -0
- package/dist/components/FaceCharacter/useFaceReprojector.d.ts +10 -0
- package/dist/components/FaceInset/FaceInset.d.ts +68 -0
- package/dist/components/FaceInset/frame.d.ts +94 -0
- package/dist/components/FaceInset/index.d.ts +6 -0
- package/dist/components/FaceInset/material.d.ts +40 -0
- package/dist/components/FaceInset/useFaceInsetTexture.d.ts +37 -0
- package/dist/components/FaceInstruction/FaceExpressionHint.d.ts +43 -0
- package/dist/components/FaceInstruction/index.d.ts +56 -0
- package/dist/components/FaceInstruction/useFaceExpression.d.ts +20 -0
- package/dist/components/FaceLiquify/FaceLiquify.d.ts +49 -0
- package/dist/components/FaceLiquify/debug.d.ts +37 -0
- package/dist/components/FaceLiquify/frame.d.ts +55 -0
- package/dist/components/FaceLiquify/index.d.ts +10 -0
- package/dist/components/FaceLiquify/material.d.ts +39 -0
- package/dist/components/FaceLiquify/pass.d.ts +49 -0
- package/dist/components/FaceLiquify/presence.d.ts +25 -0
- package/dist/components/FaceLiquify/presets.d.ts +82 -0
- package/dist/components/FaceLiquify/selfTest.d.ts +66 -0
- package/dist/components/FaceLiquify/target.d.ts +85 -0
- package/dist/components/FaceLiquify/warp.d.ts +72 -0
- package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +37 -5
- package/dist/components/FaceMesh/canonical/geometryGroups.d.ts +21 -0
- package/dist/components/FaceMesh/canonical/parseCanonicalFaceModel.d.ts +21 -0
- package/dist/components/FaceMesh/canonical/shaders.d.ts +1 -1
- package/dist/components/FaceMesh/index.d.ts +2 -2
- package/dist/components/FaceRetouch/Background.d.ts +3 -1
- package/dist/components/FaceRetouch/FaceRetouch.d.ts +5 -0
- package/dist/components/FaceRetouch/renderState.d.ts +19 -0
- package/dist/components/FaceSwap/FaceMirror.d.ts +46 -0
- package/dist/components/FaceSwap/FaceSwap.d.ts +58 -0
- package/dist/components/FaceSwap/FaceTextureLayer.d.ts +72 -0
- package/dist/components/FaceSwap/faceSwapPlan.d.ts +91 -0
- package/dist/components/FaceSwap/index.d.ts +13 -0
- package/dist/components/FaceSwap/settings.d.ts +300 -0
- package/dist/components/FaceSwap/useFaceTexture.d.ts +35 -0
- package/dist/components/FaceSwap/useLiveFace.d.ts +38 -0
- package/dist/components/FaceSwap/useLiveFaceTexture.d.ts +31 -0
- package/dist/components/FaceWarp3D/FaceWarp3D.d.ts +50 -0
- package/dist/components/FaceWarp3D/index.d.ts +2 -3
- package/dist/components/Faceless/Faceless.d.ts +51 -0
- package/dist/components/Faceless/index.d.ts +2 -0
- package/dist/components/GestureListener/index.d.ts +11 -0
- package/dist/components/HairLock/HairLock.d.ts +39 -0
- package/dist/components/HairLock/index.d.ts +2 -0
- package/dist/components/HairLock/lockGeometry.d.ts +15 -0
- package/dist/components/HandCutout/index.d.ts +35 -0
- package/dist/components/HandInstruction/HandGestureHint.d.ts +70 -0
- package/dist/components/HandInstruction/index.d.ts +74 -0
- package/dist/components/HandInstruction/useHandGesture.d.ts +22 -0
- package/dist/components/HandRig/ForearmOccluder.d.ts +29 -0
- package/dist/components/HandRig/HandAttachment.d.ts +34 -0
- package/dist/components/HandRig/HandOccluder.d.ts +55 -0
- package/dist/components/HandRig/HandTattoo.d.ts +61 -0
- package/dist/components/HandRig/WristAttachment.d.ts +34 -0
- package/dist/components/HandRig/index.d.ts +101 -0
- package/dist/components/HandRig/useArmMask.d.ts +29 -0
- package/dist/components/HandRig/wristSolve.d.ts +69 -0
- package/dist/components/HandTouch/HandTouch.d.ts +62 -0
- package/dist/components/HandTouch/Touchable.d.ts +36 -0
- package/dist/components/HandTouch/index.d.ts +2 -0
- package/dist/components/HandTracker/index.d.ts +10 -0
- package/dist/components/HeadBinding/index.d.ts +14 -0
- package/dist/components/HeadOccluder/CanonicalHeadFrame.d.ts +22 -0
- package/dist/components/HeadOccluder/Earrings.d.ts +55 -0
- package/dist/components/HeadOccluder/HeadAttachment.d.ts +38 -0
- package/dist/components/HeadOccluder/NeckOccluder.d.ts +64 -0
- package/dist/components/HeadOccluder/earringPlacement.d.ts +31 -0
- package/dist/components/HeadOccluder/headAttachmentPoints.d.ts +69 -0
- package/dist/components/HeadOccluder/index.d.ts +57 -3
- package/dist/components/HeadOccluder/useCanonicalHeadFit.d.ts +36 -0
- package/dist/components/HeadOccluder/useLandmarkPoseFit.d.ts +80 -0
- package/dist/components/HolisticTracker/index.d.ts +69 -0
- package/dist/components/HolisticTracker/settings.d.ts +58 -0
- package/dist/components/HolisticTracker/signals.d.ts +49 -0
- package/dist/components/Instruction/HintStage.d.ts +29 -0
- package/dist/components/Instruction/InstructionCue.d.ts +126 -0
- package/dist/components/Instruction/gestureHold.d.ts +20 -0
- package/dist/components/Instruction/ghost.d.ts +129 -0
- package/dist/components/Instruction/hintBlend.d.ts +19 -0
- package/dist/components/Instruction/hintLook.d.ts +81 -0
- package/dist/components/Instruction/hintLoop.d.ts +36 -0
- package/dist/components/Instruction/index.d.ts +41 -0
- package/dist/components/Instruction/useGhostModel.d.ts +33 -0
- package/dist/components/Instruction/useInstructionHold.d.ts +72 -0
- package/dist/components/IrisEffect/IrisMaterial.d.ts +73 -0
- package/dist/components/IrisEffect/index.d.ts +51 -0
- package/dist/components/IrisEffect/settings.d.ts +117 -0
- package/dist/components/LipEffect/LipEffect.d.ts +27 -1
- package/dist/components/LipEffect/LipEffectMaterial.d.ts +95 -7
- package/dist/components/LipEffect/LipEffects.d.ts +12 -0
- package/dist/components/LipEffect/defaults.d.ts +46 -4
- package/dist/components/LipEffect/index.d.ts +11 -3
- package/dist/components/LipEffect/lipShading.d.ts +73 -0
- package/dist/components/LipEffect/settings.d.ts +375 -0
- package/dist/components/LipEffect/shader.d.ts +39 -0
- package/dist/components/LipEffect/types.d.ts +128 -9
- package/dist/components/LipEffect/useLipDesignTextures.d.ts +17 -0
- package/dist/components/LipEffect/uvGuide.d.ts +74 -0
- package/dist/components/Makeup/Blush.d.ts +18 -0
- package/dist/components/Makeup/Brows.d.ts +20 -0
- package/dist/components/Makeup/Contour.d.ts +17 -0
- package/dist/components/Makeup/Eyeliner.d.ts +20 -0
- package/dist/components/Makeup/Eyeshadow.d.ts +20 -0
- package/dist/components/Makeup/Highlighter.d.ts +18 -0
- package/dist/components/Makeup/MakeupDesign.d.ts +37 -0
- package/dist/components/Makeup/MakeupRegion.d.ts +132 -0
- package/dist/components/Makeup/constants.d.ts +44 -0
- package/dist/components/Makeup/design.d.ts +106 -0
- package/dist/components/Makeup/designSamples.d.ts +42 -0
- package/dist/components/Makeup/eyes.d.ts +114 -0
- package/dist/components/Makeup/fields.d.ts +10 -0
- package/dist/components/Makeup/geometry.d.ts +106 -0
- package/dist/components/Makeup/index.d.ts +26 -0
- package/dist/components/Makeup/looks.d.ts +28 -0
- package/dist/components/Makeup/material.d.ts +239 -0
- package/dist/components/Makeup/settings.d.ts +54 -0
- package/dist/components/Makeup/shades.d.ts +143 -0
- package/dist/components/Makeup/shapes.d.ts +27 -0
- package/dist/components/Makeup/skinTone.d.ts +135 -0
- package/dist/components/Makeup/types.d.ts +110 -0
- package/dist/components/Makeup/useMakeupSkinTone.d.ts +40 -0
- package/dist/components/Necklace/Necklace.d.ts +44 -0
- package/dist/components/Necklace/index.d.ts +1 -0
- package/dist/components/ParticleEmitter/ParticleEmitter.d.ts +69 -0
- package/dist/components/ParticleEmitter/index.d.ts +1 -0
- package/dist/components/PersonCutout/index.d.ts +50 -0
- package/dist/components/PersonCutout/personCutout.d.ts +16 -0
- package/dist/components/ScreenImage/components/ScreenImageBody.d.ts +1 -1
- package/dist/components/ScreenImage/index.d.ts +3 -1
- package/dist/components/ScreenImage/materials/ScreenImageBlendMaterial.d.ts +1 -1
- package/dist/components/ScreenImage/materials/ScreenImageMaskMaterial.d.ts +11 -0
- package/dist/components/ScreenImage/source.d.ts +6 -0
- package/dist/components/ScreenImage/types.d.ts +18 -0
- package/dist/components/SegmentationOverlay/SegmentationOverlay.d.ts +37 -0
- package/dist/components/SegmentationOverlay/SegmentationOverlayMaterial.d.ts +31 -0
- package/dist/components/SegmentationOverlay/index.d.ts +9 -0
- package/dist/components/SegmentationOverlay/maskTexture.d.ts +23 -0
- package/dist/components/SegmentationOverlay/providers.d.ts +72 -0
- package/dist/components/SegmentationOverlay/settings.d.ts +65 -0
- package/dist/components/ShoulderOccluder/index.d.ts +43 -0
- package/dist/components/ShoulderOccluder/useCanonicalTorsoFit.d.ts +24 -0
- package/dist/components/SpringSwing/SpringSwing.d.ts +22 -0
- package/dist/components/SpringSwing/index.d.ts +1 -0
- package/dist/components/XRProvider/index.d.ts +16 -2
- package/dist/components/XRScene/renderOutputTarget.d.ts +12 -0
- package/dist/components/XRViewport/hooks/useViewportExternalFaces.d.ts +1 -1
- package/dist/components/XRViewport/hooks/useViewportMediaSource.d.ts +1 -1
- package/dist/components/XRViewport/hooks/useViewportPipeline.d.ts +1 -1
- package/dist/components/index.d.ts +11 -0
- package/dist/config/index.d.ts +0 -1
- package/dist/constants/index.d.ts +4 -1
- package/dist/context-DTxSQvp4.js +13 -0
- package/dist/context-hA0Rb2Xa.cjs +1 -0
- package/dist/contexts-BH7PdKFS.cjs +1 -0
- package/dist/contexts-jak8-tND.js +667 -0
- package/dist/coordinates/feed.d.ts +52 -0
- package/dist/coordinates/index.d.ts +7 -0
- package/dist/coordinates/side.d.ts +40 -0
- package/dist/coordinates/spaces.d.ts +49 -0
- package/dist/coordinates/viewport.d.ts +22 -0
- package/dist/coordinates/world.d.ts +15 -0
- package/dist/debug-ui/default-setting.cjs +2 -2
- package/dist/debug-ui/face-swap-settings/index.d.ts +22 -0
- package/dist/debug-ui/gesture-settings/index.d.ts +14 -0
- package/dist/debug-ui/hierarchy-panel/index.d.ts +3 -2
- package/dist/debug-ui/holistic-tracker-settings/index.d.ts +16 -0
- package/dist/debug-ui/index.d.ts +18 -3
- package/dist/debug-ui/iris-effect-settings/index.d.ts +12 -0
- package/dist/debug-ui/lip-effect-settings/index.d.ts +15 -0
- package/dist/debug-ui/media-source/index.d.ts +1 -1
- package/dist/debug-ui/media-source/session.d.ts +30 -2
- package/dist/debug-ui/media-source.cjs +1 -1
- package/dist/debug-ui/media-source.js +1 -1
- package/dist/debug-ui/object-inspector-panel/index.d.ts +3 -2
- package/dist/debug-ui/product-hotspots/index.d.ts +25 -0
- package/dist/debug-ui/scene-editor/hierarchy-panel.d.ts +3 -1
- package/dist/debug-ui/scene-editor/inspector-panel.d.ts +3 -1
- package/dist/debug-ui/screen-image-settings/index.d.ts +3 -1
- package/dist/debug-ui/screen-text-settings/ScreenTextSettingsPanel.d.ts +1 -1
- package/dist/debug-ui/screen-text-settings/types.d.ts +2 -0
- package/dist/debug-ui/segmentation-overlay-settings/index.d.ts +12 -0
- package/dist/debug-ui/settings-panel/index.d.ts +6 -1
- package/dist/debug-ui/shared/debugWindow.d.ts +51 -0
- package/dist/debug-ui/xr-diagnostics/index.d.ts +26 -0
- package/dist/debug-ui.cjs +3 -3
- package/dist/debug-ui.js +2695 -2547
- package/dist/detector-K8aej4MB.js +59 -0
- package/dist/detector-ijypGtse.cjs +1 -0
- package/dist/entries/all.d.ts +3 -1
- package/dist/entries/core.d.ts +20 -2
- package/dist/entries/face-effects.d.ts +123 -9
- package/dist/entries/instructions.d.ts +48 -0
- package/dist/entries/internal.d.ts +2 -1
- package/dist/entries/low-level.d.ts +49 -3
- package/dist/entries/particles.d.ts +11 -0
- package/dist/entries/product.d.ts +11 -0
- package/dist/entries/tracking.d.ts +60 -2
- package/dist/face-atlas/attributes.d.ts +30 -0
- package/dist/face-atlas/eyes.d.ts +272 -0
- package/dist/face-atlas/faceAtlas.generated.d.ts +46 -0
- package/dist/face-atlas/glsl/atlasVertex.d.ts +46 -0
- package/dist/face-atlas/glsl/common.d.ts +55 -0
- package/dist/face-atlas/glsl/design.d.ts +49 -0
- package/dist/face-atlas/glsl/eyes.d.ts +73 -0
- package/dist/face-atlas/glsl/finish.d.ts +24 -0
- package/dist/face-atlas/glsl/format.d.ts +4 -0
- package/dist/face-atlas/glsl/index.d.ts +59 -0
- package/dist/face-atlas/glsl/shading.d.ts +15 -0
- package/dist/face-atlas/glsl/shapes.d.ts +66 -0
- package/dist/face-atlas/glsl/sparkle.d.ts +19 -0
- package/dist/face-atlas/glsl/uniforms.d.ts +106 -0
- package/dist/face-atlas/guide.d.ts +51 -0
- package/dist/face-atlas/index.d.ts +25 -0
- package/dist/face-atlas/lead.d.ts +117 -0
- package/dist/face-atlas/madeUpCamera.d.ts +125 -0
- package/dist/face-atlas/masks.d.ts +53 -0
- package/dist/face-atlas/obj.d.ts +69 -0
- package/dist/face-atlas/polylines.d.ts +63 -0
- package/dist/face-atlas/probe/FaceSkinProbe.d.ts +208 -0
- package/dist/face-atlas/probe/__fixtures__/emulate.d.ts +9 -0
- package/dist/face-atlas/probe/__fixtures__/face.d.ts +24 -0
- package/dist/face-atlas/probe/constants.d.ts +137 -0
- package/dist/face-atlas/probe/glsl.d.ts +43 -0
- package/dist/face-atlas/probe/lightFit.d.ts +108 -0
- package/dist/face-atlas/probe/schedule.d.ts +44 -0
- package/dist/face-atlas/probe/selfTest.d.ts +87 -0
- package/dist/face-atlas/probe/stats.d.ts +143 -0
- package/dist/face-atlas/probe/targets.d.ts +70 -0
- package/dist/face-atlas/probe/unwrap.d.ts +76 -0
- package/dist/face-atlas/quality.d.ts +28 -0
- package/dist/face-atlas/regions.d.ts +31 -0
- package/dist/face-atlas/registry.d.ts +252 -0
- package/dist/face-atlas/renderState.d.ts +86 -0
- package/dist/face-atlas/selfOcclusion.d.ts +62 -0
- package/dist/face-atlas/shading.d.ts +406 -0
- package/dist/face-atlas/shapes.d.ts +86 -0
- package/dist/face-atlas/sides.d.ts +41 -0
- package/dist/face-atlas/skinMask.d.ts +35 -0
- package/dist/face-atlas/surface.d.ts +155 -0
- package/dist/face-atlas/topology.d.ts +44 -0
- package/dist/face-character/__fixtures__/faceImageDetections.d.ts +25 -0
- package/dist/face-character/__fixtures__/faceNode.d.ts +22 -0
- package/dist/face-character/bindFaceModel.d.ts +106 -0
- package/dist/face-character/canonicalFace.d.ts +17 -0
- package/dist/face-character/canonicalFaceGeometry.d.ts +11 -0
- package/dist/face-character/canonicalFacePositions.d.ts +7 -0
- package/dist/face-character/driveFaceModel.d.ts +57 -0
- package/dist/face-character/expressionOutputs.d.ts +45 -0
- package/dist/face-character/faceExpressions.d.ts +104 -0
- package/dist/face-character/faceImageLandmarker.d.ts +93 -0
- package/dist/face-character/faceMeshBinding.d.ts +62 -0
- package/dist/face-character/faceMorph.d.ts +77 -0
- package/dist/face-character/faceMorphs.d.ts +46 -0
- package/dist/face-character/facePhoto.d.ts +138 -0
- package/dist/face-character/facePiercings.d.ts +116 -0
- package/dist/face-character/facePin.d.ts +131 -0
- package/dist/face-character/faceReprojection.d.ts +273 -0
- package/dist/face-character/faceReprojector.d.ts +171 -0
- package/dist/face-character/faceRig.d.ts +176 -0
- package/dist/face-character/faceSwapPresence.d.ts +85 -0
- package/dist/face-character/faceTexture.d.ts +169 -0
- package/dist/face-character/faceTextureBaker.d.ts +86 -0
- package/dist/face-character/faceTextureGuide.d.ts +106 -0
- package/dist/face-character/faceTextureStats.d.ts +298 -0
- package/dist/face-character/faceTransfer.d.ts +396 -0
- package/dist/face-character/faceTransferGeometry.d.ts +109 -0
- package/dist/face-character/faceTransferSelfTest.d.ts +94 -0
- package/dist/face-character/faceWarp3D.d.ts +101 -0
- package/dist/face-character/faceless.d.ts +79 -0
- package/dist/face-character/featureWarp.d.ts +28 -0
- package/dist/face-character/liveFaceRegistry.d.ts +370 -0
- package/dist/face-character/liveValue.d.ts +12 -0
- package/dist/face-character/memo.d.ts +15 -0
- package/dist/face-effects.cjs +2324 -1
- package/dist/face-effects.js +14208 -2268
- package/dist/face-expression/index.d.ts +182 -0
- package/dist/face-info/landmarks.d.ts +17 -3
- package/dist/face-info/types.d.ts +20 -3
- package/dist/gestures/definitions.d.ts +98 -0
- package/dist/gestures/detector.d.ts +87 -0
- package/dist/gestures/index.d.ts +8 -0
- package/dist/gestures/measures.d.ts +114 -0
- package/dist/gestures/settings.d.ts +49 -0
- package/dist/getFaceInfo-B1otSDMX.cjs +1 -0
- package/dist/getFaceInfo-Cu4xDWiL.js +62 -0
- package/dist/hand/armFit.d.ts +46 -0
- package/dist/hand/armMask.d.ts +178 -0
- package/dist/hand/handCutout.d.ts +23 -0
- package/dist/hand/handCutoutRegistry.d.ts +7 -0
- package/dist/hand/handGestures.d.ts +524 -0
- package/dist/hand/handPose.d.ts +98 -0
- package/dist/hand/handRigSolver.d.ts +159 -0
- package/dist/hand/handTattoo.d.ts +81 -0
- package/dist/hand/handTouch.d.ts +240 -0
- package/dist/hand/wrist.d.ts +44 -0
- package/dist/hand/wristFilter.d.ts +44 -0
- package/dist/hooks/selectors.d.ts +76 -1
- package/dist/hooks/useCalibrationFaceTracker.d.ts +1 -1
- package/dist/hooks/useFaceInfo.d.ts +13 -1
- package/dist/hooks/useFaceInfos.d.ts +1 -1
- package/dist/hooks/useFaceModelAcquisition.d.ts +38 -0
- package/dist/hooks/useGesture.d.ts +32 -0
- package/dist/hooks/useIrisTracking.d.ts +45 -0
- package/dist/hooks/useTrackerContext.d.ts +6 -0
- package/dist/hooks/useXRDiagnostics.d.ts +81 -0
- package/dist/hooks/useXRModel.d.ts +7 -0
- package/dist/hooks/useXRSession/facade.d.ts +42 -2
- package/dist/hooks/useXRSession/index.d.ts +2 -2
- package/dist/hooks/useXRSession/reason.d.ts +3 -1
- package/dist/hooks/useXRSession/registry.d.ts +14 -0
- package/dist/hooks/useXRSession/store.d.ts +52 -3
- package/dist/index-B1_TzJaI.js +1104 -0
- package/dist/index-BavF06C6.js +190 -0
- package/dist/index-BfFmpddl.cjs +21 -0
- package/dist/index-BuBzneeW.cjs +46 -0
- package/dist/index-CGsQWodV.cjs +1 -0
- package/dist/index-CIe7eCMH.js +3200 -0
- package/dist/index-CfSF8LXa.cjs +1 -0
- package/dist/index-D5GTzOzD.cjs +1 -0
- package/dist/index-DBhQzvVa.js +314 -0
- package/dist/index-DE17y0ZI.cjs +1 -0
- package/dist/index-JII7huPk.js +442 -0
- package/dist/index-tpCr9CLj.cjs +1 -0
- package/dist/index-w1S7fI2B.js +1432 -0
- package/dist/index-zGaqrz_K.js +188 -0
- package/dist/instructions.cjs +30 -0
- package/dist/instructions.js +1507 -0
- package/dist/{internal-Dmk1cTXq.js → internal-B90P-clC.js} +138 -119
- package/dist/internal-Cjinca64.cjs +1 -0
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +15 -10
- package/dist/iris/compute.d.ts +27 -0
- package/dist/iris/index.d.ts +4 -0
- package/dist/iris/lead.d.ts +19 -0
- package/dist/iris/types.d.ts +89 -0
- package/dist/landmarkMask-BFDyBnKM.js +224 -0
- package/dist/landmarkMask-u7es2k4X.cjs +1 -0
- package/dist/landmarks-BlUqf5MZ.cjs +1 -0
- package/dist/landmarks-bftdwq6Z.js +76 -0
- package/dist/loaders-BGAUACsd.js +363 -0
- package/dist/loaders-BJ1_QCHt.cjs +1 -0
- package/dist/low-level.cjs +1 -1
- package/dist/low-level.js +1190 -675
- package/dist/main.cjs +1 -1
- package/dist/main.js +1190 -452
- package/dist/models/Base/index.d.ts +49 -0
- package/dist/models/Body/index.d.ts +3 -1
- package/dist/models/Face/constants.d.ts +8 -0
- package/dist/models/Face/index.d.ts +4 -12
- package/dist/models/Face/rotation.d.ts +18 -3
- package/dist/models/Hand/GestureTracking.d.ts +1 -1
- package/dist/models/Hand/HandTracking.d.ts +17 -1
- package/dist/models/Holistic/index.d.ts +49 -0
- package/dist/models/Holistic/result.d.ts +68 -0
- package/dist/models/Segmentation/index.d.ts +2 -0
- package/dist/models/SemanticSegmentation/index.d.ts +31 -0
- package/dist/models/SemanticSegmentation/presets.d.ts +28 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/nodeSource.d.ts +9 -0
- package/dist/particles/emission.d.ts +24 -0
- package/dist/particles/eyes.d.ts +24 -0
- package/dist/particles/glsl.d.ts +14 -0
- package/dist/particles/index.d.ts +10 -0
- package/dist/particles/motion.d.ts +42 -0
- package/dist/particles/presets.d.ts +12 -0
- package/dist/particles/ring.d.ts +58 -0
- package/dist/particles/selfTest.d.ts +53 -0
- package/dist/particles/settings.d.ts +127 -0
- package/dist/particles/shapes.d.ts +29 -0
- package/dist/particles/spawner.d.ts +60 -0
- package/dist/particles/system.d.ts +64 -0
- package/dist/particles.cjs +122 -0
- package/dist/particles.js +774 -0
- package/dist/product/ProductDimensions.d.ts +16 -0
- package/dist/product/ProductHotspot.d.ts +16 -0
- package/dist/product/ProductViewer.d.ts +9 -0
- package/dist/product/details.d.ts +53 -0
- package/dist/product/index.d.ts +14 -0
- package/dist/product/loadModelViewer.d.ts +4 -0
- package/dist/product/types.d.ts +71 -0
- package/dist/product/useProductAr.d.ts +37 -0
- package/dist/product/useProductDetails.d.ts +60 -0
- package/dist/product.cjs +1 -0
- package/dist/product.js +414 -0
- package/dist/providers-C8rE26Uf.js +366 -0
- package/dist/providers-DHsrhDI2.cjs +62 -0
- package/dist/quality/XRQualityController.d.ts +25 -0
- package/dist/quality/controller.d.ts +33 -0
- package/dist/quality/index.d.ts +6 -0
- package/dist/quality/types.d.ts +100 -0
- package/dist/quality/useXRQuality.d.ts +28 -0
- package/dist/render/renderPasses.d.ts +8 -0
- package/dist/render/sceneBeforeRender.d.ts +12 -0
- package/dist/{renderGroups-KZk6eRiY.js → renderGroups-B38pUaX2.js} +1 -1
- package/dist/{renderGroups-80H3DpTl.cjs → renderGroups-Cb_4Ar1Q.cjs} +1 -1
- package/dist/renderPasses-B6l8IpJv.js +1290 -0
- package/dist/renderPasses-dqmkft4P.cjs +158 -0
- package/dist/renderState-CJNmj5jz.js +39 -0
- package/dist/renderState-apSfg4eR.cjs +1 -0
- package/dist/scene-object.cjs +1 -1
- package/dist/scene-object.js +2 -2
- package/dist/segmentation-Cb3ouK6Z.js +1758 -0
- package/dist/segmentation-D9pYO6aR.cjs +1 -0
- package/dist/segmentation2d/faceMemory.d.ts +28 -0
- package/dist/segmentation2d/faceRegions.d.ts +24 -0
- package/dist/segmentation2d/index.d.ts +9 -0
- package/dist/segmentation2d/maskUv.d.ts +23 -0
- package/dist/segmentation2d/rasterize.d.ts +14 -0
- package/dist/segmentation2d/types.d.ts +52 -0
- package/dist/select-Ck5LGz-J.cjs +1 -0
- package/dist/select-pYRo_win.js +233 -0
- package/dist/selectors-C4X71aoD.cjs +1 -0
- package/dist/selectors-DmNaKIwE.js +196 -0
- package/dist/session-BrH8G7iJ.cjs +31 -0
- package/dist/session-DgA_z6O1.js +418 -0
- package/dist/settings-BJ7FMBsO.js +111 -0
- package/dist/settings-C63FMBlF.cjs +1 -0
- package/dist/similarityFit-BFqHND2e.cjs +1 -0
- package/dist/similarityFit-Bbz-R8AY.js +91 -0
- package/dist/spring/index.d.ts +2 -0
- package/dist/spring/spring.d.ts +69 -0
- package/dist/spring/swing.d.ts +54 -0
- package/dist/subjects/index.d.ts +2 -0
- package/dist/subjects/select.d.ts +62 -0
- package/dist/subjects/types.d.ts +55 -0
- package/dist/tracking-config/apply.d.ts +57 -0
- package/dist/tracking-config/index.d.ts +7 -0
- package/dist/tracking-config/resolve.d.ts +25 -0
- package/dist/tracking-config/storage.d.ts +8 -0
- package/dist/tracking-config/types.d.ts +106 -0
- package/dist/tracking-config/useXRTrackingConfig.d.ts +38 -0
- package/dist/tracking.cjs +10 -1
- package/dist/tracking.js +1326 -506
- package/dist/trigger-D0Pm9noT.cjs +49 -0
- package/dist/trigger-IQeys0oS.js +2128 -0
- package/dist/types/compositor.d.ts +21 -0
- package/dist/types/face.d.ts +20 -1
- package/dist/types/hand-tracking.d.ts +9 -0
- package/dist/types/holistic.d.ts +121 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/model.d.ts +22 -2
- package/dist/types/nodes.d.ts +47 -3
- package/dist/types/segmentation.d.ts +24 -0
- package/dist/types/session.d.ts +41 -3
- package/dist/updateThrottle-BseecYag.js +4 -0
- package/dist/updateThrottle-Of5Y4SVa.cjs +1 -0
- package/dist/useFaceInfo-BHDNCvsJ.cjs +1 -0
- package/dist/useFaceInfo-J4x7LsqL.js +76 -0
- package/dist/useFaceResultReader-BvEo5REG.js +61 -0
- package/dist/useFaceResultReader-DuaL1KJG.cjs +1 -0
- package/dist/useInstructionHold-DOu-RpCM.js +53 -0
- package/dist/useInstructionHold-DwJY1Alr.cjs +1 -0
- package/dist/useLandmarkPoseFit-Bg-h9BPb.cjs +1 -0
- package/dist/useLandmarkPoseFit-Bmb3h6Mw.js +87 -0
- package/dist/useXRCapabilities-Cr3RzuAW.cjs +1 -0
- package/dist/useXRCapabilities-Cxmlmpbd.js +30 -0
- package/dist/utils/canonicalRigidLandmarks.d.ts +8 -0
- package/dist/utils/fns.d.ts +6 -3
- package/dist/utils/headOccluderFit.d.ts +42 -0
- package/dist/utils/integrity.d.ts +21 -1
- package/dist/utils/resolveNumFaces.d.ts +13 -0
- package/dist/utils/shoulderOccluderFit.d.ts +38 -0
- package/dist/utils/similarityFit.d.ts +23 -0
- package/dist/utils/updateThrottle.d.ts +2 -0
- package/dist/utils/useStableUniforms.d.ts +18 -0
- package/dist/uv-BMFt19bg.cjs +1 -0
- package/dist/{index-ByoNj0QP.js → uv-DJU_XfmN.js} +15 -247
- package/docs/SDK_DOCUMENTATION.md +1 -2
- package/docs/api/adaptive-quality.mdx +104 -0
- package/docs/api/asset-lifecycle.mdx +78 -0
- package/docs/api/body-instructions.mdx +285 -0
- package/docs/api/body-triggers.mdx +234 -0
- package/docs/api/camera-permission.mdx +142 -0
- package/docs/api/coordinate-spaces.mdx +168 -0
- package/docs/api/cross-camera.mdx +89 -0
- package/docs/api/debug-ui-scene-editor.mdx +23 -2
- package/docs/api/diagnostics-calibration.mdx +97 -0
- package/docs/api/external-face-mesh.mdx +231 -0
- package/docs/api/face-actions.mdx +20 -16
- package/docs/api/face-attribute-expression.mdx +1 -1
- package/docs/api/face-binding-anchors.mdx +4 -2
- package/docs/api/face-character.mdx +157 -0
- package/docs/api/face-effects.mdx +9 -0
- package/docs/api/face-expression-controller.mdx +153 -0
- package/docs/api/face-info.mdx +17 -11
- package/docs/api/face-inset.mdx +204 -0
- package/docs/api/face-instructions.mdx +183 -0
- package/docs/api/face-liquify.mdx +196 -0
- package/docs/api/face-mesh.mdx +8 -9
- package/docs/api/face-morph.mdx +117 -0
- package/docs/api/face-painting.mdx +7 -0
- package/docs/api/face-reprojection.mdx +154 -0
- package/docs/api/face-retouching.mdx +18 -10
- package/docs/api/face-swap.mdx +350 -0
- package/docs/api/face-warp-3d.mdx +166 -0
- package/docs/api/faceless.mdx +143 -0
- package/docs/api/gestures.mdx +209 -0
- package/docs/api/hair.mdx +97 -0
- package/docs/api/hand-instructions.mdx +222 -0
- package/docs/api/hand-rig.mdx +535 -0
- package/docs/api/hand-touch.mdx +162 -0
- package/docs/api/head-occluder.mdx +563 -0
- package/docs/api/holistic-tracker.mdx +164 -0
- package/docs/api/instructions.mdx +323 -0
- package/docs/api/iris-tracking.mdx +247 -0
- package/docs/api/made-up-camera.mdx +131 -0
- package/docs/api/makeup-skin-tone.mdx +135 -0
- package/docs/api/makeup.mdx +353 -0
- package/docs/api/multi-subject.mdx +98 -0
- package/docs/api/particles.mdx +155 -0
- package/docs/api/person-cutout.mdx +136 -0
- package/docs/api/pin-to-face-mesh.mdx +274 -0
- package/docs/api/product-ar.mdx +114 -0
- package/docs/api/product-details.mdx +78 -0
- package/docs/api/screen-space-coordinates.mdx +4 -1
- package/docs/api/segmentation-overlay.mdx +301 -0
- package/docs/api/session-lifecycle.mdx +136 -0
- package/docs/api/trackers.mdx +5 -0
- package/docs/api/tracking-config.mdx +108 -0
- package/docs/docs.json +51 -1
- package/docs/examples/lip-shaders.mdx +273 -0
- package/docs/guides/face-atlas-template.svg +1 -0
- package/docs/guides/face-atlas-textures.mdx +186 -0
- package/docs/guides/face-texture-template.svg +1 -0
- package/docs/guides/harness-debug-ui.mdx +4 -4
- package/docs/guides/lip-effect-textures.mdx +368 -0
- package/docs/guides/lip-uv-template.png +0 -0
- package/docs/guides/lip-uv-template.svg +1 -0
- package/docs/guides/makeup-design-textures.mdx +109 -0
- package/docs/introduction.mdx +1 -2
- package/package.json +23 -1
- package/dist/DebuggerUI-B6bP6P9r.cjs +0 -1
- package/dist/DebuggerUI-BjOMr8q_.js +0 -269
- package/dist/FaceMeshRenderer-C5l6VLdO.cjs +0 -155
- package/dist/FaceMeshRenderer-wjAHrJzP.js +0 -1270
- package/dist/FaceRetouch-BkJzoA79.cjs +0 -134
- package/dist/FaceRetouch-DwbKQJAN.js +0 -551
- package/dist/components/FaceWarp3D/FaceWarp3DHead.d.ts +0 -15
- package/dist/components/FaceWarp3D/defaults.d.ts +0 -37
- package/dist/components/FaceWarp3D/warp.d.ts +0 -13
- package/dist/contexts-ByhzppYl.js +0 -663
- package/dist/contexts-Dr62It_K.cjs +0 -1
- package/dist/debug-ui/face-warp-3d/index.d.ts +0 -6
- package/dist/getFaceInfo-C4QpCQIY.js +0 -118
- package/dist/getFaceInfo-fA1bFBub.cjs +0 -1
- package/dist/index-9dlAQAhy.js +0 -1462
- package/dist/index-BjmTe9eM.cjs +0 -1
- package/dist/index-BpEf2BBb.cjs +0 -1
- package/dist/index-CyUUurQT.cjs +0 -1
- package/dist/index-DCiMbxC3.cjs +0 -1
- package/dist/index-DXT3WccE.js +0 -2089
- package/dist/index-DpI-qo5X.cjs +0 -17
- package/dist/index-DyVF4vEW.js +0 -111
- package/dist/index-VJ0SJwmG.js +0 -214
- package/dist/internal-Cq-TEQ5Y.cjs +0 -1
- package/dist/renderLayers-lDtL0_43.cjs +0 -1
- package/dist/renderLayers-zrK2pv5O.js +0 -13
- package/dist/renderPasses-BOoBSr8z.cjs +0 -21
- package/dist/renderPasses-BcquyVtu.js +0 -1500
- package/dist/selectors-B8H97CKA.js +0 -59
- package/dist/selectors-CZLKT2Iv.cjs +0 -1
- package/dist/session-CpkiK5YA.cjs +0 -31
- package/dist/session-DLFN_VII.js +0 -363
- package/dist/useFaceInfo-BJ8-_MOs.cjs +0 -1
- package/dist/useFaceInfo-Dk426LTu.js +0 -62
- package/dist/useFaceResults-CtetsO9M.js +0 -19
- package/dist/useFaceResults-wBJF3zyp.cjs +0 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
/**
|
|
3
|
+
* Face warp 3D (Spark AR's face mesh deformation): the live face mesh, shaped
|
|
4
|
+
* by blend shapes (shape keys) on top of the tracked face, wearing the camera
|
|
5
|
+
* image itself — every pixel samples the camera where its UNdeformed point
|
|
6
|
+
* is on screen. Weight 0 is the camera image untouched; a shape key moves
|
|
7
|
+
* the face's real pixels (bigger eyes, a longer nose, a chubby face) while the
|
|
8
|
+
* person's own expression carries on underneath.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* The warp mesh: the filled canonical face (eyes and mouth covered),
|
|
12
|
+
* subdivided, then a skirt — two rings past the face's edge, into the hair,
|
|
13
|
+
* ears and neck. The skirt follows the head and stretches the camera pixels
|
|
14
|
+
* around the face, so the edge of the face can move (a smaller chin, puffed
|
|
15
|
+
* cheeks) without uncovering the original or leaving a seam.
|
|
16
|
+
*/
|
|
17
|
+
export type FaceWarpMesh = {
|
|
18
|
+
/** All vertices: the face, then the skirt. */
|
|
19
|
+
count: number;
|
|
20
|
+
/** The face's vertices (the skirt's follow). */
|
|
21
|
+
faceCount: number;
|
|
22
|
+
index: number[];
|
|
23
|
+
/** Rest positions in the canonical head frame (cm, flat). */
|
|
24
|
+
canonical: Float32Array;
|
|
25
|
+
/** A face vertex's triangle of the filled canonical face (`getFaceUnwrapMesh().index / 3`); -1 on the skirt. */
|
|
26
|
+
triangle: Int32Array;
|
|
27
|
+
/** Its barycentric weights (flat, 3 per vertex). */
|
|
28
|
+
weights: Float32Array;
|
|
29
|
+
/** A skirt vertex's face vertex on the edge; -1 on the face. */
|
|
30
|
+
anchor: Int32Array;
|
|
31
|
+
/** A skirt vertex's offset from its anchor (cm, flat). */
|
|
32
|
+
offset: Float32Array;
|
|
33
|
+
/** How much of its anchor's deformation a vertex takes: 1 on the face, fading out across the skirt. */
|
|
34
|
+
follow: Float32Array;
|
|
35
|
+
/** Opacity: 1, fading to 0 at the skirt's outer edge. */
|
|
36
|
+
alpha: Float32Array;
|
|
37
|
+
};
|
|
38
|
+
/** The warp mesh, subdivided `subdivisions` times (2 ≈ 7 500 face vertices), with its skirt. */
|
|
39
|
+
export declare const createFaceWarpMesh: (subdivisions?: number) => FaceWarpMesh;
|
|
40
|
+
/** Blend shapes bound to a warp mesh: per shape key, an offset per warp vertex (canonical cm, flat). */
|
|
41
|
+
export type FaceWarpDeformation = {
|
|
42
|
+
names: string[];
|
|
43
|
+
deltas: Float32Array[];
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Binds the blend shapes of a model (canonical head frame, cm) to a warp
|
|
47
|
+
* mesh, once:
|
|
48
|
+
* - a mesh in the canonical face topology (its first 468 vertices are the
|
|
49
|
+
* landmarks, e.g. sculpted on the SDK's canonical face) gives each landmark
|
|
50
|
+
* its own offset — exact;
|
|
51
|
+
* - any other mesh is transferred: each warp vertex takes the offset of its
|
|
52
|
+
* closest point on the model's base surface;
|
|
53
|
+
* - a model without shape keys gives one key, `"shape"`: from the canonical
|
|
54
|
+
* face to the model's own surface (your face takes its shape).
|
|
55
|
+
*/
|
|
56
|
+
export declare const bindFaceWarpDeformation: (root: THREE.Object3D, mesh: FaceWarpMesh) => FaceWarpDeformation;
|
|
57
|
+
export type FaceWarpStepOptions = {
|
|
58
|
+
/** Overall strength of the deformation (multiplies every key). */
|
|
59
|
+
weight: number;
|
|
60
|
+
/** Expression strength (1 = the face's own; 0 = frozen at rest; > 1 exaggerates). */
|
|
61
|
+
expression: number;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* One frame: each warp vertex's undeformed live position (`rest`: the live
|
|
65
|
+
* face, `writeFaceMorphLive`'s `point`, with the expression scaled) and its
|
|
66
|
+
* deformed position (`position`: rest + Σ key weight · offset; the skirt
|
|
67
|
+
* follows its edge vertex and stretches into the camera image around the
|
|
68
|
+
* face). Canonical cm, in the head frame.
|
|
69
|
+
*/
|
|
70
|
+
export declare const stepFaceWarp3D: (mesh: FaceWarpMesh, live: {
|
|
71
|
+
point: Float32Array;
|
|
72
|
+
expression: Float32Array;
|
|
73
|
+
}, deformation: FaceWarpDeformation | null, keyWeights: ArrayLike<number>, { weight, expression }: FaceWarpStepOptions, rest: Float32Array, position: Float32Array) => void;
|
|
74
|
+
/** Most shape keys the GPU path mixes (the rest are ignored). */
|
|
75
|
+
export declare const FACE_WARP_MAX_KEYS = 16;
|
|
76
|
+
/**
|
|
77
|
+
* What the GPU path needs, built once per mesh and deformation: per-vertex
|
|
78
|
+
* attributes (the corners and barycentric weights of each vertex's point on
|
|
79
|
+
* the filled face, its offset row, the skirt's offset and follow, opacity) and
|
|
80
|
+
* the shape-key offsets as an RGBA float texture (`deltaWidth` × `rowsPerKey`
|
|
81
|
+
* rows per key, row-major by face vertex).
|
|
82
|
+
*/
|
|
83
|
+
export type FaceWarpGpuData = {
|
|
84
|
+
corners: Float32Array;
|
|
85
|
+
bary: Float32Array;
|
|
86
|
+
deltaIndex: Float32Array;
|
|
87
|
+
skirtOffset: Float32Array;
|
|
88
|
+
follow: Float32Array;
|
|
89
|
+
alpha: Float32Array;
|
|
90
|
+
keyCount: number;
|
|
91
|
+
deltaWidth: number;
|
|
92
|
+
rowsPerKey: number;
|
|
93
|
+
/** RGBA float texels: `deltaWidth × rowsPerKey × max(keyCount, 1)`. */
|
|
94
|
+
deltas: Float32Array;
|
|
95
|
+
};
|
|
96
|
+
export declare const createFaceWarpGpuData: (mesh: FaceWarpMesh, deformation: FaceWarpDeformation | null) => FaceWarpGpuData;
|
|
97
|
+
/** Packs the live face (`writeFaceMorphLive`) into the GPU path's RGBA float texture: row 0 points, row 1 expression. */
|
|
98
|
+
export declare const writeFaceWarpLiveTexels: (live: {
|
|
99
|
+
point: Float32Array;
|
|
100
|
+
expression: Float32Array;
|
|
101
|
+
}, out: Float32Array) => void;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { FaceAtlasMask } from '../face-atlas/masks';
|
|
2
|
+
import { FaceAtlasRegion } from '../face-atlas/regions';
|
|
3
|
+
import { FaceTexture } from './faceTexture';
|
|
4
|
+
import * as THREE from "three";
|
|
5
|
+
/**
|
|
6
|
+
* Faceless (FACE-5): a face's own live face texture with its features
|
|
7
|
+
* erased. One pass per face per new face result reads the live face map
|
|
8
|
+
* (the camera face in the face atlas) and its low-frequency skin (features
|
|
9
|
+
* already filled from the skin around them) and writes a face texture that
|
|
10
|
+
* `FaceTextureLayer` draws back on the same face, its own eyes and mouth off.
|
|
11
|
+
*/
|
|
12
|
+
/** The looks: `real` erases the features with the person's own skin and grain; `smooth` evens the whole face (a mannequin). */
|
|
13
|
+
export declare const FACELESS_STYLES: readonly ["real", "smooth"];
|
|
14
|
+
export type FacelessStyle = (typeof FACELESS_STYLES)[number];
|
|
15
|
+
/** The face atlas regions erased: eyes and lids, brows, nose, lips and mouth. */
|
|
16
|
+
export declare const FACELESS_REGIONS: readonly FaceAtlasRegion[];
|
|
17
|
+
export declare const FACELESS_DEFAULTS: Readonly<{
|
|
18
|
+
style: FacelessStyle;
|
|
19
|
+
/** Grain on the erased skin, 0..1: 1 matches the skin's own fine detail around it. */
|
|
20
|
+
grain: 1;
|
|
21
|
+
/**
|
|
22
|
+
* How far past the features' edges the erase fades out, as a fraction of
|
|
23
|
+
* the atlas width (it is whole up to the edges, so no lash, brow hair or
|
|
24
|
+
* lip line is left half erased).
|
|
25
|
+
*/
|
|
26
|
+
feather: 0.025;
|
|
27
|
+
}>;
|
|
28
|
+
/** The grain taps' atlas uvs (v up), as the shader reads them. */
|
|
29
|
+
export declare const facelessGrainTaps: () => Float32Array;
|
|
30
|
+
/**
|
|
31
|
+
* Linear colour throughout: the map is an sRGB texture (decoded when read)
|
|
32
|
+
* premultiplied by coverage; the low skin is linear, premultiplied by how
|
|
33
|
+
* much skin was seen; the target is sRGB again (encoded when written).
|
|
34
|
+
*/
|
|
35
|
+
export declare const FACELESS_FRAGMENT = "\nuniform sampler2D uMap;\nuniform sampler2D uLow;\nuniform sampler2D uMask;\nuniform float uSmooth;\nuniform float uGrain;\nuniform vec2 uMapSize;\nuniform vec2 uTaps[8];\nin vec2 vUv;\nlayout(location = 0) out highp vec4 fragColor;\n\nfloat faceLuma(vec3 c) {\n return dot(c, vec3(0.2126, 0.7152, 0.0722));\n}\n\nfloat faceHash(vec2 p) {\n p = fract(p * vec2(123.34, 456.21));\n p += dot(p, p + 45.32);\n return fract(p.x * p.y);\n}\n\nvoid main() {\n vec4 base = texture(uMap, vUv);\n float coverage = base.a;\n vec2 mask = texture(uMask, vUv).rg;\n float erase = uSmooth > 0.5 ? 1.0 : mask.r;\n if (erase <= 0.0) {\n fragColor = base;\n return;\n }\n vec4 low = texture(uLow, vUv);\n if (low.a <= 0.001 && coverage <= 0.0) {\n fragColor = vec4(0.0);\n return;\n }\n vec3 own = coverage > 0.0 ? base.rgb / coverage : low.rgb / low.a;\n vec3 skin = low.a > 0.001 ? low.rgb / low.a : own;\n // Grain: the skin's own fine detail (its luma against its blur on the\n // cheeks, forehead and chin), as per-texel noise on the filled skin; none\n // in the eye and mouth openings and the lips (they stretch on screen).\n // The median of the taps: a hand, hair or glasses over a few of them\n // does not raise it.\n float details[8];\n int count = 0;\n for (int i = 0; i < 8; i++) {\n vec4 fine = textureLod(uMap, uTaps[i], 0.0);\n vec4 blur = textureLod(uMap, uTaps[i], 3.0);\n if (fine.a > 0.5 && blur.a > 0.5) {\n float d = abs(faceLuma(fine.rgb / fine.a) - faceLuma(blur.rgb / blur.a));\n int j = count;\n while (j > 0 && details[j - 1] > d) {\n details[j] = details[j - 1];\n j--;\n }\n details[j] = d;\n count++;\n }\n }\n float detail = count > 0 ? details[(count - 1) / 2] : 0.0;\n float noise = faceHash(floor(vUv * uMapSize)) * 2.0 - 1.0;\n float grain = uGrain * (1.0 - uSmooth) * mask.g * detail * noise * 3.4;\n vec3 fill = max(skin + grain * skin / max(faceLuma(skin), 0.02), vec3(0.0));\n // Erased texels are covered by the fill (the camera never shows through a\n // nostril or a closed mouth's line); the rest keeps the face's coverage.\n float covered = mix(coverage, 1.0, erase);\n fragColor = vec4(mix(own, fill, erase) * covered, covered);\n}\n";
|
|
36
|
+
export type FacelessTextureOptions = {
|
|
37
|
+
style?: FacelessStyle;
|
|
38
|
+
/** 0..1 (`FACELESS_DEFAULTS.grain`). */
|
|
39
|
+
grain?: number;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The erase mask (rows from v = 0): 1 over the features and up to their
|
|
43
|
+
* edges, fading to 0 within `feather` outside them, plus a soft disc at
|
|
44
|
+
* each mouth corner. The regions are blurred twice as wide and their edge
|
|
45
|
+
* level (0.5) lifted to 1, which grows the mask by the blur's reach.
|
|
46
|
+
*/
|
|
47
|
+
export declare const createFacelessMask: (size?: number, feather?: number) => FaceAtlasMask;
|
|
48
|
+
/**
|
|
49
|
+
* Where the faceless face has no grain: the eye and mouth openings and the
|
|
50
|
+
* lips, small in the atlas and stretched far on screen when the eyes open or
|
|
51
|
+
* the mouth smiles or opens, which would stretch the grain into streaks.
|
|
52
|
+
* Same layout as `createFacelessMask`: 1 inside and up to their edges,
|
|
53
|
+
* fading out within `feather` outside them.
|
|
54
|
+
*/
|
|
55
|
+
export declare const createFacelessStretchMask: (size?: number, feather?: number) => FaceAtlasMask;
|
|
56
|
+
/**
|
|
57
|
+
* One face's faceless texture: `update` composites it from the face's live
|
|
58
|
+
* face texture (only when that has a new version or the look changed) and
|
|
59
|
+
* returns it. The returned object is the same every time, updated in place
|
|
60
|
+
* (as live face textures are).
|
|
61
|
+
*/
|
|
62
|
+
export declare class FacelessTexture {
|
|
63
|
+
readonly face: FaceTexture;
|
|
64
|
+
private target;
|
|
65
|
+
private readonly scene;
|
|
66
|
+
private readonly camera;
|
|
67
|
+
private readonly material;
|
|
68
|
+
private readonly mask;
|
|
69
|
+
private lastVersion;
|
|
70
|
+
private lastLook;
|
|
71
|
+
private disposed;
|
|
72
|
+
constructor();
|
|
73
|
+
/**
|
|
74
|
+
* Updates from the face's live texture (`useLiveFaceTexture`); returns the
|
|
75
|
+
* faceless face, or null while the source has no map yet.
|
|
76
|
+
*/
|
|
77
|
+
update(renderer: THREE.WebGLRenderer, source: FaceTexture | null, { style, grain, }?: FacelessTextureOptions): FaceTexture | null;
|
|
78
|
+
dispose(): void;
|
|
79
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a stylised character's face features are (its own canonical-frame
|
|
3
|
+
* cm): its eyes and mouth may sit far from a real face's (big eyes low on the
|
|
4
|
+
* head). Given, a face effect binds the character as if those features were
|
|
5
|
+
* on the real face's — your eyes land on its eyes. Any subset; the rest of
|
|
6
|
+
* the head follows smoothly.
|
|
7
|
+
*/
|
|
8
|
+
export type FaceFeatureAlignment = {
|
|
9
|
+
leftEye?: readonly [number, number, number];
|
|
10
|
+
rightEye?: readonly [number, number, number];
|
|
11
|
+
mouth?: readonly [number, number, number];
|
|
12
|
+
nose?: readonly [number, number, number];
|
|
13
|
+
chin?: readonly [number, number, number];
|
|
14
|
+
};
|
|
15
|
+
/** The canonical face's features (cm): eye and mouth opening centres, nose tip (1), chin (152). */
|
|
16
|
+
export declare const canonicalFaceFeatures: () => Required<FaceFeatureAlignment>;
|
|
17
|
+
/**
|
|
18
|
+
* A smooth 3D warp (thin-plate spline, kernel `r`, with an affine part) that
|
|
19
|
+
* takes each `from` point exactly to its `to` point and leaves the far
|
|
20
|
+
* surroundings in place. Returns `(x, y, z, out)` writing the warped point.
|
|
21
|
+
*/
|
|
22
|
+
export declare const createFeatureWarp: (from: readonly (readonly [number, number, number])[], to: readonly (readonly [number, number, number])[]) => (x: number, y: number, z: number, out: [number, number, number]) => [number, number, number];
|
|
23
|
+
/**
|
|
24
|
+
* A model's vertices (canonical-frame cm, flat) moved so its given features
|
|
25
|
+
* sit on the canonical face's — what a face effect binds instead of the
|
|
26
|
+
* model's own positions. Without features, the positions as they are.
|
|
27
|
+
*/
|
|
28
|
+
export declare const alignFaceFeatures: (positions: ArrayLike<number>, features: FaceFeatureAlignment | undefined) => Float32Array;
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { FaceImageLandmark } from './faceReprojection';
|
|
2
|
+
import { FaceReprojector, FaceReprojectorOptions } from './faceReprojector';
|
|
3
|
+
import { FaceTexture } from './faceTexture';
|
|
4
|
+
import { FaceTextureStats, FaceTextureStatsOptions } from './faceTextureStats';
|
|
5
|
+
import type * as THREE from "three";
|
|
6
|
+
/**
|
|
7
|
+
* The live-face registry (FACE-2): one shared live face texture per tracked
|
|
8
|
+
* face, updated only when the face model delivers a new landmark array
|
|
9
|
+
* (never on a camera-only frame, so the texture cannot swim between
|
|
10
|
+
* inferences). The first part of this file is its pure logic, with no
|
|
11
|
+
* renderer or React:
|
|
12
|
+
*
|
|
13
|
+
* - the **shape-preserving One Euro** filter: one cutoff for every point,
|
|
14
|
+
* from the speed of the face's centre, so smoothing never bends the face
|
|
15
|
+
* (MediaPipe turns its own smoothing off when it tracks several faces);
|
|
16
|
+
* - the **reset rules**: when the filter snaps and when the colour
|
|
17
|
+
* statistics restart their smoothing over time;
|
|
18
|
+
* - **`resolveFaceSwapQuality`**: mesh level, live map size, mirror fill and
|
|
19
|
+
* statistics rate from the quality tier and the face's size on screen.
|
|
20
|
+
*
|
|
21
|
+
* Positions are in the feed's normalised space (x, y in 0..1, y down, z in
|
|
22
|
+
* x units), as the face tracker reports them. Distances and speeds are in
|
|
23
|
+
* feed widths, so the rules read the same on any aspect.
|
|
24
|
+
*
|
|
25
|
+
* The second part is the runtime (`LiveFaceEntry`, `acquireLiveFace`): per
|
|
26
|
+
* renderer and face index, refcounted, stepped once per rendered frame at
|
|
27
|
+
* `LIVE_FACE_FRAME_PRIORITY`. On each new landmark result it smooths the
|
|
28
|
+
* landmarks, writes the face's live map (where each point is on screen, for
|
|
29
|
+
* `FaceTransfer`), unwraps the camera face into the face atlas when a
|
|
30
|
+
* consumer wants the map, and updates the skin statistics at the tier's
|
|
31
|
+
* rate (`FaceTextureStats`, the skin pass straight from the camera).
|
|
32
|
+
*/
|
|
33
|
+
/** Tuning of the landmark filter. */
|
|
34
|
+
export declare const FACE_LANDMARK_SMOOTHING: {
|
|
35
|
+
/** Cutoff (Hz) at rest at `smoothing` 0+; it falls exponentially to `minCutoffHz` at 1. */
|
|
36
|
+
readonly maxCutoffHz: 12;
|
|
37
|
+
/** Cutoff (Hz) at rest at `smoothing` 1. */
|
|
38
|
+
readonly minCutoffHz: 0.5;
|
|
39
|
+
/** Cutoff added per feed width per second of the face centre's speed: less lag while moving. */
|
|
40
|
+
readonly beta: 40;
|
|
41
|
+
/** Cutoff (Hz) of the centre's speed estimate. */
|
|
42
|
+
readonly derivativeCutoffHz: 1;
|
|
43
|
+
/** A centre jump between updates larger than this (feed widths) snaps instead of smoothing. */
|
|
44
|
+
readonly snapJump: 0.1;
|
|
45
|
+
/** Updates further apart than this (ms) snap: the face was not followed in between. */
|
|
46
|
+
readonly maxGapMs: 500;
|
|
47
|
+
/**
|
|
48
|
+
* Below this `smoothing` the filter fades in: the blend goes smoothly from 1
|
|
49
|
+
* (raw landmarks) at 0 to the cutoff's blend here, so the lowest slider
|
|
50
|
+
* steps are continuous.
|
|
51
|
+
*/
|
|
52
|
+
readonly fadeInSmoothing: 0.1;
|
|
53
|
+
};
|
|
54
|
+
export type FaceLandmarkSmoother = {
|
|
55
|
+
/** Points filtered: the first `count` landmarks of every update. */
|
|
56
|
+
readonly count: number;
|
|
57
|
+
/** Filtered points, `count × 3`: x, y, z. */
|
|
58
|
+
readonly points: Float32Array;
|
|
59
|
+
/** False until the first update, and after a reset: the next update snaps. */
|
|
60
|
+
initialized: boolean;
|
|
61
|
+
/** Raw centre of the last update, feed widths (x, y / aspect). */
|
|
62
|
+
centreX: number;
|
|
63
|
+
centreY: number;
|
|
64
|
+
/** Filtered velocity of the centre, feed widths per second. */
|
|
65
|
+
velocityX: number;
|
|
66
|
+
velocityY: number;
|
|
67
|
+
/** Time of the last update (ms). */
|
|
68
|
+
timeMs: number;
|
|
69
|
+
/** The blend of the last update, the same for every point: 1 = snapped to the raw points. */
|
|
70
|
+
alpha: number;
|
|
71
|
+
};
|
|
72
|
+
/** What one update did: snapped to the raw points, smoothed, or skipped (same timestamp, too few points). */
|
|
73
|
+
export type FaceLandmarkSmootherStep = "snap" | "smooth" | "skip";
|
|
74
|
+
export declare const createFaceLandmarkSmoother: (count?: number) => FaceLandmarkSmoother;
|
|
75
|
+
/** The next update snaps (a new face, a new camera, a reordered face). */
|
|
76
|
+
export declare const resetFaceLandmarkSmoother: (smoother: FaceLandmarkSmoother) => void;
|
|
77
|
+
/**
|
|
78
|
+
* The filter's cutoff (Hz) for a `smoothing` value (0..1) and the face
|
|
79
|
+
* centre's speed (feed widths per second). `Infinity` at `smoothing` 0: no
|
|
80
|
+
* smoothing.
|
|
81
|
+
*/
|
|
82
|
+
export declare const faceLandmarkCutoffHz: (smoothing: number, speed: number) => number;
|
|
83
|
+
/**
|
|
84
|
+
* The blend one update moves every point by (1 = the raw landmarks), for a
|
|
85
|
+
* `smoothing` value (0..1), the centre's speed (feed widths per second) and
|
|
86
|
+
* the time since the last update (ms). Continuous and monotone in
|
|
87
|
+
* `smoothing`: 1 at 0, fading into the cutoff's blend by `fadeInSmoothing`.
|
|
88
|
+
*/
|
|
89
|
+
export declare const faceLandmarkBlend: (smoothing: number, speed: number, dtMs: number) => number;
|
|
90
|
+
/**
|
|
91
|
+
* One landmark update. Every point moves towards its raw position by the
|
|
92
|
+
* same blend, chosen from the centre's speed, so the filtered face keeps the
|
|
93
|
+
* raw face's shape. Snaps on the first update, after a reset, after a gap
|
|
94
|
+
* over `maxGapMs` and on a centre jump over `snapJump`. `timeMs` is the
|
|
95
|
+
* landmarks' timestamp; `aspect` is the feed's width / height. No allocation.
|
|
96
|
+
*/
|
|
97
|
+
export declare const stepFaceLandmarkSmoother: (smoother: FaceLandmarkSmoother, landmarks: ArrayLike<FaceImageLandmark>, aspect: number, timeMs: number, smoothing: number) => FaceLandmarkSmootherStep;
|
|
98
|
+
/** MediaPipe's nose-tip landmark. */
|
|
99
|
+
export declare const FACE_NOSE_TIP_LANDMARK = 1;
|
|
100
|
+
/**
|
|
101
|
+
* A nose jump between updates larger than this (feed widths) means the face
|
|
102
|
+
* indices were reordered: the colour statistics restart. The same distance
|
|
103
|
+
* as the filter's `snapJump`: between two results (about 40 ms) a real head
|
|
104
|
+
* never moves that far, so it is two people close together swapping places.
|
|
105
|
+
*/
|
|
106
|
+
export declare const FACE_STATISTICS_RESET_JUMP: 0.1;
|
|
107
|
+
/**
|
|
108
|
+
* Why a live face restarted:
|
|
109
|
+
* - `acquired`: the face is new, or back after missing for more than
|
|
110
|
+
* `FACE_LANDMARK_SMOOTHING.maxGapMs` (a shorter dropout continues);
|
|
111
|
+
* - `camera`: the camera texture was replaced (a new source);
|
|
112
|
+
* - `jump`: the nose jumped more than `FACE_STATISTICS_RESET_JUMP`, or the
|
|
113
|
+
* filter snapped on its own jump rule (the faces reordered).
|
|
114
|
+
*/
|
|
115
|
+
export type LiveFaceResetReason = "acquired" | "camera" | "jump";
|
|
116
|
+
export type LiveFaceUpdate = {
|
|
117
|
+
/** The face is in this landmark result. */
|
|
118
|
+
tracked: boolean;
|
|
119
|
+
/** What the landmark filter did; `"none"` when the face is not tracked. */
|
|
120
|
+
smoothing: FaceLandmarkSmootherStep | "none";
|
|
121
|
+
/** The statistics restart their smoothing over time (k = 1). */
|
|
122
|
+
resetStatistics: boolean;
|
|
123
|
+
/** Why the face restarted, or null. */
|
|
124
|
+
reason: LiveFaceResetReason | null;
|
|
125
|
+
};
|
|
126
|
+
/** The per-face state of the registry's update loop. */
|
|
127
|
+
export type LiveFaceTrack = {
|
|
128
|
+
readonly smoother: FaceLandmarkSmoother;
|
|
129
|
+
tracked: boolean;
|
|
130
|
+
/** Timestamp (ms) of the last result that had the face; null before the first. */
|
|
131
|
+
lastSeenMs: number | null;
|
|
132
|
+
/** Nose tip at the last update, feed widths. */
|
|
133
|
+
noseX: number;
|
|
134
|
+
noseY: number;
|
|
135
|
+
/** The camera texture of the last update (by identity). */
|
|
136
|
+
camera: object | null;
|
|
137
|
+
/** The last update's result (reused: no allocation per update). */
|
|
138
|
+
readonly update: LiveFaceUpdate;
|
|
139
|
+
};
|
|
140
|
+
export declare const createLiveFaceTrack: (count?: number) => LiveFaceTrack;
|
|
141
|
+
export type LiveFaceTrackInput = {
|
|
142
|
+
/** This face's landmarks in the new result, or null when the result does not have it. */
|
|
143
|
+
landmarks: ArrayLike<FaceImageLandmark> | null;
|
|
144
|
+
/** The feed's width / height. */
|
|
145
|
+
aspect: number;
|
|
146
|
+
/** The result's timestamp (ms). */
|
|
147
|
+
timeMs: number;
|
|
148
|
+
/** The camera texture the result belongs to (`useXRCameraTexture()`), compared by identity. */
|
|
149
|
+
camera: object | null;
|
|
150
|
+
/** Landmark smoothing, 0..1. */
|
|
151
|
+
smoothing: number;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* One new landmark result for one face. Call it only when the face model
|
|
155
|
+
* delivers a new result, never per camera frame. The landmark filter snaps
|
|
156
|
+
* and the statistics restart when the face is new or back after more than
|
|
157
|
+
* `maxGapMs`, the camera texture is replaced, or the face jumps (the nose
|
|
158
|
+
* more than `FACE_STATISTICS_RESET_JUMP`, or the centre more than the
|
|
159
|
+
* filter's `snapJump`). A shorter dropout (MediaPipe often drops a face for
|
|
160
|
+
* one result) continues: the filter and the statistics carry on. Returns
|
|
161
|
+
* `track.update`, rewritten in place.
|
|
162
|
+
*/
|
|
163
|
+
export declare const stepLiveFaceTrack: (track: LiveFaceTrack, input: LiveFaceTrackInput) => LiveFaceUpdate;
|
|
164
|
+
export declare const FACE_SWAP_QUALITIES: readonly ["auto", "high", "medium", "low"];
|
|
165
|
+
/** `auto` follows `useXRQuality()`: its first tier is high, its last low, any other medium. */
|
|
166
|
+
export type FaceSwapQuality = (typeof FACE_SWAP_QUALITIES)[number];
|
|
167
|
+
export type FaceSwapQualityKey = Exclude<FaceSwapQuality, "auto">;
|
|
168
|
+
export type FaceSwapQualityTier = {
|
|
169
|
+
key: FaceSwapQualityKey;
|
|
170
|
+
/** Subdivision level of the transfer mesh: 2 = 14.5k triangles, 1 = 3.6k. */
|
|
171
|
+
meshLevel: 1 | 2;
|
|
172
|
+
/** Largest live map (px, square). */
|
|
173
|
+
mapMax: number;
|
|
174
|
+
/** Two-person swaps fill a turned-away cheek from the other side when the map is made. */
|
|
175
|
+
mirrorFill: boolean;
|
|
176
|
+
/** Statistics passes per second. */
|
|
177
|
+
statisticsHz: number;
|
|
178
|
+
/** Statistics in RGBA16F when the GPU can render to it (else SRGB8_ALPHA8). */
|
|
179
|
+
floatStatistics: boolean;
|
|
180
|
+
};
|
|
181
|
+
export declare const FACE_SWAP_QUALITY_TIERS: Record<FaceSwapQualityKey, FaceSwapQualityTier>;
|
|
182
|
+
/** The live map's size rules. */
|
|
183
|
+
export declare const FACE_SWAP_MAP_SIZE: {
|
|
184
|
+
/** Smallest map (px). */
|
|
185
|
+
readonly min: 256;
|
|
186
|
+
/** Sizes are multiples of this (px). */
|
|
187
|
+
readonly step: 128;
|
|
188
|
+
/** Map size per px of face height on the camera image. */
|
|
189
|
+
readonly perFacePx: 1.3;
|
|
190
|
+
/** A face-size resize needs this relative change… */
|
|
191
|
+
readonly hysteresis: 0.15;
|
|
192
|
+
/** …held this long (ms). */
|
|
193
|
+
readonly waitMs: 1000;
|
|
194
|
+
};
|
|
195
|
+
/** The quality key for a `quality` prop and the session's tier (`useXRQuality().index` of `tiers.length`). */
|
|
196
|
+
export declare const resolveFaceSwapQualityKey: (quality: FaceSwapQuality, tierIndex: number, tierCount: number) => FaceSwapQualityKey;
|
|
197
|
+
/**
|
|
198
|
+
* Face height on the camera image (px): forehead top (10) to chin (152).
|
|
199
|
+
* `width` and `height` are the camera image's pixel size.
|
|
200
|
+
*/
|
|
201
|
+
export declare const faceHeightPx: (landmarks: ArrayLike<FaceImageLandmark>, width: number, height: number) => number;
|
|
202
|
+
/** The map size a face wants: `1.3 × face height`, rounded up to 128, at least 256, at most `mapMax`. */
|
|
203
|
+
export declare const faceSwapMapSize: (faceHeight: number, mapMax: number) => number;
|
|
204
|
+
export type FaceSwapQualityState = FaceSwapQualityTier & {
|
|
205
|
+
/** The live map's size now (px, square). */
|
|
206
|
+
mapSize: number;
|
|
207
|
+
/** When a face-size resize started waiting (ms), or null. */
|
|
208
|
+
pendingSinceMs: number | null;
|
|
209
|
+
};
|
|
210
|
+
export type FaceSwapQualityInput = {
|
|
211
|
+
quality: FaceSwapQuality;
|
|
212
|
+
/** `useXRQuality().index`. */
|
|
213
|
+
tierIndex: number;
|
|
214
|
+
/** `useXRQuality().tiers.length`. */
|
|
215
|
+
tierCount: number;
|
|
216
|
+
/** `faceHeightPx` of the face, or null when unknown (keeps the current size). */
|
|
217
|
+
faceHeightPx: number | null;
|
|
218
|
+
nowMs: number;
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* Quality for one live face: the tier's mesh level, map maximum, mirror fill
|
|
222
|
+
* and statistics rate, and a map size capped by the face's size on screen.
|
|
223
|
+
* A tier change applies at once (one resize); a face-size change resizes
|
|
224
|
+
* only after it has differed by more than 15% for 1 s. Returns `previous`
|
|
225
|
+
* itself when nothing changed, so it can run every frame without allocating.
|
|
226
|
+
*/
|
|
227
|
+
export declare const resolveFaceSwapQuality: (input: FaceSwapQualityInput, previous?: FaceSwapQualityState | null) => FaceSwapQualityState;
|
|
228
|
+
/** Smoothing when no consumer asks for any: `FaceSwap`'s default. */
|
|
229
|
+
export declare const DEFAULT_LIVE_FACE_SMOOTHING: number;
|
|
230
|
+
/**
|
|
231
|
+
* Frame priority of the live-face registry's step: after `FaceRig` (−1),
|
|
232
|
+
* before the face surfaces (−0.5) and the layers that draw from it.
|
|
233
|
+
*/
|
|
234
|
+
export declare const LIVE_FACE_FRAME_PRIORITY = -0.75;
|
|
235
|
+
/** What one consumer of a live face asks for (kept by reference: mutate it, the entry reads it every frame). */
|
|
236
|
+
export type LiveFaceRequest = {
|
|
237
|
+
/** The face map (the camera face unwrapped into the face atlas) is wanted, not only the statistics. */
|
|
238
|
+
map: boolean;
|
|
239
|
+
/** Fill the hidden half of a turned face from the other side when the map is made (where the tier allows). */
|
|
240
|
+
mirrorFill: boolean;
|
|
241
|
+
/** `auto` follows the session's tier; the best tier any consumer asks for wins. */
|
|
242
|
+
quality: FaceSwapQuality;
|
|
243
|
+
/** Landmark smoothing, 0..1 (the most any consumer asks for wins); undefined: no preference. */
|
|
244
|
+
smoothing?: number;
|
|
245
|
+
/**
|
|
246
|
+
* Unwrap the face map from the made-up camera (camera + makeup) when one
|
|
247
|
+
* runs: the consumer is inside a `<MadeUpCamera>`. Any consumer asking
|
|
248
|
+
* for it decides for the face's shared map. Undefined: false.
|
|
249
|
+
*/
|
|
250
|
+
madeUp?: boolean;
|
|
251
|
+
};
|
|
252
|
+
/** One rendered frame's inputs to `LiveFaceEntry.step`. */
|
|
253
|
+
export type LiveFaceFrame = {
|
|
254
|
+
/** The frame's stamp (R3F `clock.elapsedTime`): the entry steps once per stamp. */
|
|
255
|
+
stamp: number;
|
|
256
|
+
/** Now (ms), `performance.now()`. */
|
|
257
|
+
nowMs: number;
|
|
258
|
+
/** The face model's node (`detectionResults` is replaced on every inference), or null. */
|
|
259
|
+
node: {
|
|
260
|
+
readonly detectionResults?: LiveFaceResults;
|
|
261
|
+
} | null;
|
|
262
|
+
/** The session's camera texture (`useXRCameraTexture()`), or null. */
|
|
263
|
+
cameraTexture: THREE.Texture | null;
|
|
264
|
+
/** The feed's mirroring (`useXRMirrored()`). */
|
|
265
|
+
feedMirrored: boolean;
|
|
266
|
+
/**
|
|
267
|
+
* The renderer's made-up camera texture when one has rendered
|
|
268
|
+
* (`peekMadeUpCamera`), else null or omitted: the map is unwrapped from
|
|
269
|
+
* it when a consumer asks for `madeUp`. The track and the statistics
|
|
270
|
+
* always read `cameraTexture` (makeup is not the person's light).
|
|
271
|
+
*/
|
|
272
|
+
madeUpTexture?: THREE.Texture | null;
|
|
273
|
+
/** `useXRQuality().index` (−1 without a controller). */
|
|
274
|
+
tierIndex: number;
|
|
275
|
+
/** `useXRQuality().tiers.length` (0 without a controller). */
|
|
276
|
+
tierCount: number;
|
|
277
|
+
};
|
|
278
|
+
/** The part of a face landmarker result the registry reads. */
|
|
279
|
+
export type LiveFaceResults = {
|
|
280
|
+
readonly faceLandmarks?: ArrayLike<ArrayLike<FaceImageLandmark> | undefined>;
|
|
281
|
+
};
|
|
282
|
+
/** The GPU pieces an entry makes (swapped for fakes in tests). */
|
|
283
|
+
export type LiveFaceGpu = {
|
|
284
|
+
createReprojector: (options: FaceReprojectorOptions) => Pick<FaceReprojector, "render" | "setOptions" | "dispose" | "unwrapTexture">;
|
|
285
|
+
createStats: (options: FaceTextureStatsOptions) => Pick<FaceTextureStats, "low" | "mean" | "ready" | "setOptions" | "reset" | "updateFromImage" | "dispose">;
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* One tracked face's shared live state: its smoothed landmarks, its live map
|
|
289
|
+
* (`liveMap`, for `FaceTransfer.setTargetMap`), its face texture (`face`:
|
|
290
|
+
* the map when wanted, and the skin statistics) and its quality. Made and
|
|
291
|
+
* shared by `acquireLiveFace`; driven by `step` once per rendered frame.
|
|
292
|
+
*/
|
|
293
|
+
export declare class LiveFaceEntry {
|
|
294
|
+
private readonly renderer;
|
|
295
|
+
private readonly gpu;
|
|
296
|
+
readonly faceIndex: number;
|
|
297
|
+
/** The live face texture, updated in place (`version` increases). */
|
|
298
|
+
readonly face: FaceTexture;
|
|
299
|
+
/** Where each point of the face is on screen: `writeFaceTransferLiveMap` of the smoothed landmarks. */
|
|
300
|
+
readonly liveMap: THREE.DataTexture;
|
|
301
|
+
/** The landmark filter and reset rules. */
|
|
302
|
+
readonly track: LiveFaceTrack;
|
|
303
|
+
/** The smoothed landmarks (468), rewritten in place on each update. */
|
|
304
|
+
readonly landmarks: FaceImageLandmark[];
|
|
305
|
+
/** The quality in use (null before the first update). */
|
|
306
|
+
quality: FaceSwapQualityState | null;
|
|
307
|
+
/** The stamp of the last frame a new landmark result arrived on (whether or not it had this face). */
|
|
308
|
+
resultStamp: number;
|
|
309
|
+
/** `liveMap` holds a face. */
|
|
310
|
+
positionsReady: boolean;
|
|
311
|
+
/** The map holds the face (false while no consumer wants it). */
|
|
312
|
+
mapReady: boolean;
|
|
313
|
+
/** The statistics hold the face. */
|
|
314
|
+
statsReady: boolean;
|
|
315
|
+
private readonly mutableFace;
|
|
316
|
+
private readonly stats;
|
|
317
|
+
private reprojector;
|
|
318
|
+
private mapSize;
|
|
319
|
+
private mapMirrorFill;
|
|
320
|
+
/** The consumers' identities and requests, index for index (arrays: no iterator per frame). */
|
|
321
|
+
private readonly requestIds;
|
|
322
|
+
private readonly requests;
|
|
323
|
+
private refs;
|
|
324
|
+
private stamp;
|
|
325
|
+
private lastResults;
|
|
326
|
+
private lastStatsMs;
|
|
327
|
+
private wantMap;
|
|
328
|
+
private wantMirrorFill;
|
|
329
|
+
private wantMadeUp;
|
|
330
|
+
private qualityKey;
|
|
331
|
+
private smoothing;
|
|
332
|
+
/** The track step's input (one object, reused). */
|
|
333
|
+
private readonly trackInput;
|
|
334
|
+
private readonly qualityInput;
|
|
335
|
+
private readonly statsUpdate;
|
|
336
|
+
constructor(renderer: THREE.WebGLRenderer, faceIndex: number, gpu?: LiveFaceGpu);
|
|
337
|
+
/** Consumers holding the entry (`acquireLiveFace` / `releaseLiveFace`). */
|
|
338
|
+
get references(): number;
|
|
339
|
+
/** The landmark smoothing in use: the most any consumer asks for, else `DEFAULT_LIVE_FACE_SMOOTHING`. */
|
|
340
|
+
get smoothingInUse(): number;
|
|
341
|
+
/** Adds or replaces one consumer's request (keyed by any identity object; kept by reference). */
|
|
342
|
+
request(id: object, request: LiveFaceRequest): void;
|
|
343
|
+
/** Drops one consumer's request. */
|
|
344
|
+
unrequest(id: object): void;
|
|
345
|
+
/**
|
|
346
|
+
* One rendered frame. Runs once per `frame.stamp` (every consumer may call
|
|
347
|
+
* it); does work only when the face model delivered a new result.
|
|
348
|
+
*/
|
|
349
|
+
step(frame: LiveFaceFrame): void;
|
|
350
|
+
/** Called by `releaseLiveFace` when the last consumer lets go. */
|
|
351
|
+
dispose(): void;
|
|
352
|
+
/** @internal */
|
|
353
|
+
retain(): void;
|
|
354
|
+
/** @internal Returns the references left. */
|
|
355
|
+
releaseOne(): number;
|
|
356
|
+
/** What the consumers ask for, merged: any wants the map or the fill; the best tier and the most smoothing win. */
|
|
357
|
+
private aggregate;
|
|
358
|
+
private renderMap;
|
|
359
|
+
private dropMap;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* The shared live face of `faceIndex` on this renderer, with one more
|
|
363
|
+
* reference (made on first use). Pair with `releaseLiveFace`. `gpu` is for
|
|
364
|
+
* tests only.
|
|
365
|
+
*/
|
|
366
|
+
export declare const acquireLiveFace: (renderer: THREE.WebGLRenderer, faceIndex: number, gpu?: LiveFaceGpu) => LiveFaceEntry;
|
|
367
|
+
/** Drops one reference; the last one disposes the entry. */
|
|
368
|
+
export declare const releaseLiveFace: (renderer: THREE.WebGLRenderer, entry: LiveFaceEntry) => void;
|
|
369
|
+
/** The live face of `faceIndex` on this renderer if one is held (no reference taken). */
|
|
370
|
+
export declare const peekLiveFace: (renderer: THREE.WebGLRenderer, faceIndex: number) => LiveFaceEntry | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A prop value, or a ref to one. A ref is read every frame, so a value can be
|
|
3
|
+
* animated (from `useFrame`, a `FaceExpressionController` `set` output …)
|
|
4
|
+
* without re-rendering.
|
|
5
|
+
*/
|
|
6
|
+
export type LiveValue<T> = T | {
|
|
7
|
+
readonly current: T;
|
|
8
|
+
};
|
|
9
|
+
/** The number now (a ref's current value, or the number itself). */
|
|
10
|
+
export declare const readLiveNumber: (value: LiveValue<number>) => number;
|
|
11
|
+
/** The record now: a ref's current record (its `current` is itself a record), or the record itself. */
|
|
12
|
+
export declare const readLiveRecord: <V>(value: LiveValue<Record<string, V>>) => Record<string, V>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const memoByObject: <V>(key: object, options: string, compute: () => V) => V;
|
|
2
|
+
/** For results that depend only on plain values (e.g. a subdivision level). */
|
|
3
|
+
export declare const memoByKey: <V>(key: string, compute: () => V) => V;
|
|
4
|
+
/**
|
|
5
|
+
* Lets go of a material WITHOUT `dispose()`, so its compiled shader program
|
|
6
|
+
* stays warm: three frees a program when the last material using it is
|
|
7
|
+
* disposed, and the next mount (switching a shape, a source, a phase) then
|
|
8
|
+
* recompiles it — a 30–100 ms freeze. Not disposed, the material is simply
|
|
9
|
+
* garbage-collected (three keeps its per-material state in weak maps) and the
|
|
10
|
+
* next material with the same shader reuses the program. A material owns no
|
|
11
|
+
* other GPU resource; dispose its textures yourself if it made any.
|
|
12
|
+
*/
|
|
13
|
+
export declare const releaseMaterial: (material: {
|
|
14
|
+
dispose: () => void;
|
|
15
|
+
} | null | undefined) => void;
|