@vincentt-xr/sdk 2.0.0-alpha.7 → 2.0.0-alpha.8
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 +1109 -13
- package/dist/{DebuggerUI-BjOMr8q_.js → DebuggerUI-C-ldiozL.js} +1 -1
- package/dist/{DebuggerUI-B6bP6P9r.cjs → DebuggerUI-CWX5EtQv.cjs} +1 -1
- package/dist/FaceMeshRenderer-BEEXZwS6.cjs +158 -0
- package/dist/FaceMeshRenderer-UuH5sTXG.js +1322 -0
- package/dist/FaceRetouch-C7h7x9kd.js +683 -0
- package/dist/FaceRetouch-DqftT26Y.cjs +134 -0
- package/dist/GLTFLoader-C5q63sKO.js +1633 -0
- package/dist/GLTFLoader-Cb_CRwmG.cjs +1 -0
- package/dist/SegmentationOverlay-DQuW3dsc.js +133 -0
- package/dist/SegmentationOverlay-aWVod8Kl.cjs +1 -0
- package/dist/assets/cache.d.ts +99 -0
- package/dist/assets/estimate.d.ts +11 -0
- package/dist/assets/index.d.ts +7 -0
- package/dist/assets/loaders.d.ts +28 -0
- package/dist/assets/react.d.ts +33 -0
- package/dist/calibration/calibration.d.ts +70 -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/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/BodyTracker/index.d.ts +9 -0
- package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +33 -3
- package/dist/components/FaceMesh/canonical/parseCanonicalFaceModel.d.ts +12 -0
- package/dist/components/FaceMesh/canonical/shaders.d.ts +1 -1
- package/dist/components/FaceMesh/index.d.ts +1 -1
- package/dist/components/GestureListener/index.d.ts +11 -0
- package/dist/components/HandTracker/index.d.ts +10 -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/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 +7 -1
- package/dist/components/LipEffect/LipEffectMaterial.d.ts +43 -7
- package/dist/components/LipEffect/LipEffects.d.ts +9 -0
- package/dist/components/LipEffect/defaults.d.ts +27 -4
- package/dist/components/LipEffect/index.d.ts +11 -3
- package/dist/components/LipEffect/settings.d.ts +271 -0
- package/dist/components/LipEffect/types.d.ts +56 -9
- package/dist/components/LipEffect/useLipDesignTextures.d.ts +11 -0
- package/dist/components/LipEffect/uvGuide.d.ts +59 -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/XRProvider/index.d.ts +16 -2
- 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 +3 -0
- package/dist/constants/index.d.ts +4 -1
- package/dist/contexts-CO0sd4JQ.cjs +1 -0
- package/dist/{contexts-ByhzppYl.js → contexts-FzlnnMYD.js} +252 -246
- package/dist/coordinates/feed.d.ts +52 -0
- package/dist/coordinates/index.d.ts +5 -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/gesture-settings/index.d.ts +14 -0
- package/dist/debug-ui/holistic-tracker-settings/index.d.ts +16 -0
- package/dist/debug-ui/index.d.ts +14 -0
- 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.cjs +1 -1
- package/dist/debug-ui/media-source.js +1 -1
- package/dist/debug-ui/product-hotspots/index.d.ts +24 -0
- package/dist/debug-ui/segmentation-overlay-settings/index.d.ts +12 -0
- package/dist/debug-ui/xr-diagnostics/index.d.ts +25 -0
- package/dist/debug-ui.cjs +3 -3
- package/dist/debug-ui.js +2057 -1687
- package/dist/detector-K8aej4MB.js +59 -0
- package/dist/detector-ijypGtse.cjs +1 -0
- package/dist/entries/core.d.ts +18 -1
- package/dist/entries/face-effects.d.ts +11 -3
- package/dist/entries/low-level.d.ts +22 -3
- package/dist/entries/product.d.ts +11 -0
- package/dist/entries/tracking.d.ts +24 -1
- package/dist/face-effects.cjs +155 -1
- package/dist/face-effects.js +1134 -2197
- package/dist/gestures/definitions.d.ts +85 -0
- package/dist/gestures/detector.d.ts +87 -0
- package/dist/gestures/index.d.ts +8 -0
- package/dist/gestures/measures.d.ts +101 -0
- package/dist/gestures/settings.d.ts +49 -0
- package/dist/{getFaceInfo-C4QpCQIY.js → getFaceInfo-BkZfaQs-.js} +5 -5
- package/dist/{getFaceInfo-fA1bFBub.cjs → getFaceInfo-ahPxQFGu.cjs} +1 -1
- package/dist/hooks/selectors.d.ts +68 -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/useGesture.d.ts +32 -0
- package/dist/hooks/useIrisTracking.d.ts +45 -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--RgGzZ6X.cjs +47 -0
- package/dist/{index-VJ0SJwmG.js → index-CHVbH0hz.js} +4 -4
- package/dist/index-CeVkgsag.cjs +1 -0
- package/dist/index-CnGox6Xr.js +3054 -0
- package/dist/{index-ByoNj0QP.js → index-CsUdQ-pn.js} +113 -111
- package/dist/{index-BjmTe9eM.cjs → index-DKBAh6hV.cjs} +1 -1
- package/dist/index-DsZwTfG0.cjs +1 -0
- package/dist/index-Dw6tj2Mi.js +144 -0
- package/dist/index-OCPjOaeP.cjs +1 -0
- package/dist/{index-DXT3WccE.js → index-s9pF4zkG.js} +1065 -1101
- package/dist/internal-BYza1h8_.cjs +1 -0
- package/dist/{internal-Dmk1cTXq.js → internal-vsfNQycj.js} +15 -16
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +2 -2
- package/dist/iris/compute.d.ts +25 -0
- package/dist/iris/index.d.ts +4 -0
- package/dist/iris/lead.d.ts +19 -0
- package/dist/iris/types.d.ts +87 -0
- package/dist/landmarkMask-CbTFzBYG.js +224 -0
- package/dist/landmarkMask-u7es2k4X.cjs +1 -0
- package/dist/low-level.cjs +1 -1
- package/dist/low-level.js +1085 -634
- package/dist/main.cjs +1 -1
- package/dist/main.js +1519 -465
- package/dist/measures-9dQPdw96.js +154 -0
- package/dist/measures-KfJzpvod.cjs +1 -0
- package/dist/models/Base/index.d.ts +49 -0
- package/dist/models/Body/index.d.ts +1 -1
- package/dist/models/Face/index.d.ts +1 -1
- package/dist/models/Hand/GestureTracking.d.ts +1 -1
- package/dist/models/Hand/HandTracking.d.ts +1 -1
- package/dist/models/Holistic/index.d.ts +49 -0
- package/dist/models/Holistic/result.d.ts +68 -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/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-C0Dlhh9Z.js +365 -0
- package/dist/providers-YNwkmNeK.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/{renderGroups-KZk6eRiY.js → renderGroups-CN1cGFUo.js} +1 -1
- package/dist/{renderGroups-80H3DpTl.cjs → renderGroups-O4KmaMl9.cjs} +1 -1
- package/dist/renderPasses-Cg-zqmEz.cjs +21 -0
- package/dist/renderPasses-NnKZVfBy.js +1460 -0
- package/dist/scene-object.cjs +1 -1
- package/dist/scene-object.js +2 -2
- package/dist/screenTransform-BenfCtZt.js +44 -0
- package/dist/screenTransform-BiXdpVf0.cjs +1 -0
- package/dist/segmentation-9PhSvc-R.cjs +1 -0
- package/dist/segmentation-CeOTKemr.js +5 -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 +46 -0
- package/dist/selectors-C5G1PMYL.js +195 -0
- package/dist/selectors-Du_PsVnW.cjs +1 -0
- package/dist/{session-CpkiK5YA.cjs → session-BBr0yN8h.cjs} +7 -7
- package/dist/{session-DLFN_VII.js → session-Cy0m7l7-.js} +76 -76
- package/dist/settings-DRR7-snV.cjs +1 -0
- package/dist/settings-aQk845NJ.js +73 -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 +1 -1
- package/dist/tracking.js +1056 -383
- package/dist/types/compositor.d.ts +21 -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 +27 -2
- package/dist/types/segmentation.d.ts +19 -0
- package/dist/types/session.d.ts +41 -3
- package/dist/useFaceInfo-Blf7FCu3.js +303 -0
- package/dist/useFaceInfo-C5mO8NQY.cjs +1 -0
- package/dist/useXRCapabilities-B1R2ghy-.cjs +1 -0
- package/dist/useXRCapabilities-C68v__wB.js +30 -0
- package/dist/utils/fns.d.ts +6 -3
- package/dist/utils/integrity.d.ts +4 -1
- package/dist/utils/updateThrottle.d.ts +2 -0
- package/dist/utils/useStableUniforms.d.ts +18 -0
- package/docs/api/adaptive-quality.mdx +104 -0
- package/docs/api/asset-lifecycle.mdx +78 -0
- package/docs/api/camera-permission.mdx +142 -0
- package/docs/api/coordinate-spaces.mdx +165 -0
- package/docs/api/cross-camera.mdx +88 -0
- package/docs/api/diagnostics-calibration.mdx +97 -0
- package/docs/api/face-effects.mdx +6 -0
- package/docs/api/face-mesh.mdx +4 -2
- package/docs/api/gestures.mdx +173 -0
- package/docs/api/holistic-tracker.mdx +159 -0
- package/docs/api/iris-tracking.mdx +242 -0
- package/docs/api/multi-subject.mdx +95 -0
- package/docs/api/person-cutout.mdx +136 -0
- package/docs/api/product-ar.mdx +111 -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 +23 -1
- package/docs/examples/lip-shaders.mdx +224 -0
- package/docs/guides/lip-effect-textures.mdx +292 -0
- package/docs/guides/lip-uv-template.png +0 -0
- package/docs/guides/lip-uv-template.svg +1 -0
- package/package.json +13 -1
- 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/contexts-Dr62It_K.cjs +0 -1
- package/dist/index-9dlAQAhy.js +0 -1462
- package/dist/index-BpEf2BBb.cjs +0 -1
- package/dist/index-CyUUurQT.cjs +0 -1
- package/dist/index-DCiMbxC3.cjs +0 -1
- package/dist/index-DpI-qo5X.cjs +0 -17
- package/dist/index-DyVF4vEW.js +0 -111
- 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/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,134 @@
|
|
|
1
|
+
"use strict";const r=require("./FaceMeshRenderer-BEEXZwS6.cjs"),q=require("three"),M=require("react/jsx-runtime"),S=require("react"),K=require("./index-CeVkgsag.cjs"),Z=require("./index-OCPjOaeP.cjs"),H=require("@react-three/fiber"),$=require("./selectors-Du_PsVnW.cjs"),U=require("./landmarkMask-u7es2k4X.cjs");function J(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,l.get?l:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const g=J(q),N={enabled:!1,strength:1,faceWidth:0,faceHeight:0,faceRoundness:0,midfaceHeight:0,foreheadHeight:0,foreheadWidth:0,cheekboneWidth:0,cheekWidth:0,cheekHollowness:0,midfaceDepth:0,scalpHeight:0,headCurve:0,faceTwist:0,faceSwirl:0,browDistance:0,browHeight:0,browDepth:0,eyeSize:0,leftEyeSize:0,rightEyeSize:0,eyeDistance:0,leftEyeX:0,rightEyeX:0,leftEyeY:0,rightEyeY:0,noseSize:0,noseLength:0,mouthWidth:0,mouthHeight:0,jawWidth:0,chinHeight:0},Q={...N,enabled:!0,strength:1,faceWidth:-.08,faceHeight:.04,foreheadHeight:.04,cheekWidth:-.04,eyeSize:.08,eyeDistance:.03,noseSize:-.05,noseLength:.03,mouthWidth:.06,mouthHeight:.02,jawWidth:-.05,chinHeight:.03},ee=[{label:"Wireframe",value:r.FACE_MESH_MATERIAL_TYPES.wireframe},{label:"Basic",value:r.FACE_MESH_MATERIAL_TYPES.basic},{label:"Standard",value:r.FACE_MESH_MATERIAL_TYPES.standard},{label:"Physical",value:r.FACE_MESH_MATERIAL_TYPES.physical},{label:"Toon",value:r.FACE_MESH_MATERIAL_TYPES.toon},{label:"Normal",value:r.FACE_MESH_MATERIAL_TYPES.normal},{label:"Matcap",value:r.FACE_MESH_MATERIAL_TYPES.matcap},{label:"Shader",value:r.FACE_MESH_MATERIAL_TYPES.shader}],te=[{label:"Original Face",value:r.FACE_MESH_SHADER_PRESETS.originalFace},{label:"Composite",value:r.FACE_MESH_SHADER_PRESETS.composite}],ae=[{label:"Front",value:r.FACE_MESH_SIDES.front},{label:"Back",value:r.FACE_MESH_SIDES.back},{label:"Double",value:r.FACE_MESH_SIDES.double}],oe=[{label:"None",value:r.FACE_MESH_TEXTURE_MAPS.none},{label:"UV Map 1",value:r.FACE_MESH_TEXTURE_MAPS.canonical},{label:"UV Map 2",value:r.FACE_MESH_TEXTURE_MAPS.style2}],re=[{label:"None",value:r.FACE_MESH_ALPHA_MAPS.none},{label:"Default Mask",value:r.FACE_MESH_ALPHA_MAPS.canonical}],le=[{label:"Solid",value:r.FACE_MESH_MASK_TEXTURE_SOURCES.solid},{label:"Gradient",value:r.FACE_MESH_MASK_TEXTURE_SOURCES.gradient},{label:"Image URL",value:r.FACE_MESH_MASK_TEXTURE_SOURCES.imageUrl},{label:"Media URL",value:r.FACE_MESH_MASK_TEXTURE_SOURCES.mediaUrl}],ie=[{label:"Normal",value:r.FACE_MESH_BLEND_MODES.normal},{label:"Add",value:r.FACE_MESH_BLEND_MODES.add},{label:"Subtract",value:r.FACE_MESH_BLEND_MODES.subtract},{label:"Multiply",value:r.FACE_MESH_BLEND_MODES.multiply},{label:"Screen",value:r.FACE_MESH_BLEND_MODES.screen},{label:"Overlay",value:r.FACE_MESH_BLEND_MODES.overlay},{label:"Soft Light",value:r.FACE_MESH_BLEND_MODES.softLight},{label:"Hard Light",value:r.FACE_MESH_BLEND_MODES.hardLight},{label:"Lighten",value:r.FACE_MESH_BLEND_MODES.lighten},{label:"Darken",value:r.FACE_MESH_BLEND_MODES.darken},{label:"Difference",value:r.FACE_MESH_BLEND_MODES.difference},{label:"Exclusion",value:r.FACE_MESH_BLEND_MODES.exclusion}],X=["both","left","right"],Y=["shader","image"],G={eye:"both",mode:"shader",color:"#4fa3ff",textureUrl:"",tintImage:!1,scale:1,opacity:.85,targetFps:0,smoothing:0,leadMs:80,mirrored:!1,faceIndex:0,holdMs:250},se=[{key:"eye",label:"Eye",type:"select",options:X.map(e=>({label:e,value:e}))},{key:"mode",label:"Material",type:"select",options:Y.map(e=>({label:e,value:e}))},{key:"color",label:"Color / tint",type:"color"},{key:"textureUrl",label:"Image URL (image mode)",type:"text"},{key:"tintImage",label:"Tint image with color",type:"boolean"},{key:"scale",label:"Scale (× iris radius)",type:"number",min:.2,max:4,step:.05},{key:"opacity",label:"Opacity",type:"number",min:0,max:1,step:.05},{key:"targetFps",label:"Face FPS (0 = session)",type:"number",min:0,max:60,step:1},{key:"smoothing",label:"Smoothing (0 = raw)",type:"number",min:0,max:60,step:1},{key:"leadMs",label:"Lead between samples (ms)",type:"number",min:0,max:200,step:10},{key:"mirrored",label:"Mirror material",type:"boolean"},{key:"faceIndex",label:"Face index",type:"number",min:0,max:3,step:1},{key:"holdMs",label:"Hold (ms)",type:"number",min:0,max:1e3,step:10}],ne=e=>({...G,...e}),ce=(e,a)=>({...e,...a}),L=["lipstick","gloss","matte","tint","metallic","gradient"],W=["texture","solid"],j=["outward","vertical","horizontal"],z={preset:"custom",maskMode:"outer-and-inner-lips",colorMode:"texture",color:"#e85d75",opacity:.8,intensity:1,shading:.6,gloss:.35,roughness:.5,highlightColor:"#ffffff",gradientColor:"#ffd6de",gradientAmount:0,gradientDirection:"outward",edgeSoftness:.12,innerLipColor:"#7a1f36",innerLipAmount:0,innerLipWidth:.35,splitLips:!1,lowerLipColor:"#e85d75",lowerLipOpacity:.8,textureScaleX:1,textureScaleY:1,textureOffsetX:0,textureOffsetY:0,textureRotation:0,textureFlipX:!1,textureFlipY:!1},w={lipstick:{color:"#c0304f",opacity:.85,intensity:1,shading:.6,gloss:.35,roughness:.5,highlightColor:"#ffffff",gradientAmount:0},gloss:{color:"#e05a7a",opacity:.7,intensity:1,shading:.5,gloss:.95,roughness:.12,highlightColor:"#ffffff",gradientAmount:0},matte:{color:"#a8323e",opacity:.92,intensity:1,shading:.8,gloss:0,roughness:1,highlightColor:"#ffffff",gradientAmount:0},tint:{color:"#ff6b81",opacity:.4,intensity:1,shading:.9,gloss:.1,roughness:.7,highlightColor:"#ffffff",gradientAmount:0},metallic:{color:"#b5485a",opacity:.9,intensity:1,shading:.5,gloss:1,roughness:.3,highlightColor:"#f3c46b",gradientAmount:0},gradient:{color:"#d6336c",opacity:.8,intensity:1,shading:.6,gloss:.3,roughness:.5,highlightColor:"#ffffff",gradientColor:"#f9c2cf",gradientAmount:.85,gradientDirection:"outward"}},O=e=>typeof e=="string"&&L.includes(e),s=(e,a,t,l)=>typeof e=="number"&&Number.isFinite(e)?Math.min(t,Math.max(a,e)):l,ue=(e,a)=>typeof e=="number"&&Number.isFinite(e)?e:a,x=(e,a)=>typeof e=="string"&&e.trim()?e:a,C=(e,a)=>typeof e=="boolean"?e:a,B=(e,a,t)=>typeof a=="string"&&e.includes(a)?a:t,A=(e={})=>{const a=O(e.preset)?e.preset:"custom",t={...z,...a==="custom"?{}:w[a]},l=Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0)),o={...t,...l};return{preset:a,maskMode:o.maskMode==="outer-lips"?"outer-lips":"outer-and-inner-lips",colorMode:B(W,o.colorMode,t.colorMode),color:x(o.color,t.color),opacity:s(o.opacity,0,1,t.opacity),intensity:s(o.intensity,0,1,t.intensity),shading:s(o.shading,0,1,t.shading),gloss:s(o.gloss,0,1,t.gloss),roughness:s(o.roughness,0,1,t.roughness),highlightColor:x(o.highlightColor,t.highlightColor),gradientColor:x(o.gradientColor,t.gradientColor),gradientAmount:s(o.gradientAmount,0,1,t.gradientAmount),gradientDirection:B(j,o.gradientDirection,t.gradientDirection),edgeSoftness:s(o.edgeSoftness,0,1,t.edgeSoftness),innerLipColor:x(o.innerLipColor,t.innerLipColor),innerLipAmount:s(o.innerLipAmount,0,1,t.innerLipAmount),innerLipWidth:s(o.innerLipWidth,0,1,t.innerLipWidth),splitLips:C(o.splitLips,t.splitLips),lowerLipColor:x(o.lowerLipColor,t.lowerLipColor),lowerLipOpacity:s(o.lowerLipOpacity,0,1,t.lowerLipOpacity),textureScaleX:s(o.textureScaleX,.05,20,t.textureScaleX),textureScaleY:s(o.textureScaleY,.05,20,t.textureScaleY),textureOffsetX:s(o.textureOffsetX,-2,2,t.textureOffsetX),textureOffsetY:s(o.textureOffsetY,-2,2,t.textureOffsetY),textureRotation:ue(o.textureRotation,t.textureRotation),textureFlipX:C(o.textureFlipX,t.textureFlipX),textureFlipY:C(o.textureFlipY,t.textureFlipY)}},me=(e,a)=>{const t=a.preset;if(!(t!==void 0&&t!==e.preset&&O(t)))return A({...e,...a});const o=Object.fromEntries(Object.entries(a).filter(([n,c])=>c!==void 0&&c!==e[n]));return A({...e,...w[t],...o,preset:t})},p={min:0,max:1,step:.01},de=[{key:"preset",label:"Preset",type:"select",options:[{label:"Custom",value:"custom"},...L.map(e=>({label:e[0].toUpperCase()+e.slice(1),value:e}))]},{key:"maskMode",label:"Mask mode",type:"select",options:[{label:"Outer + inner lips (mouth cut out)",value:"outer-and-inner-lips"},{label:"Outer lips (mouth included)",value:"outer-lips"}]},{key:"colorMode",label:"Color mode",type:"select",options:[{label:"Design texture",value:"texture"},{label:"Procedural (solid / gradient)",value:"solid"}]},{key:"color",label:"Tint color",type:"color"},{key:"opacity",label:"Opacity",type:"number",...p},{key:"intensity",label:"Tint intensity",type:"number",...p},{key:"shading",label:"Skin shading",type:"number",...p},{key:"gloss",label:"Gloss",type:"number",...p},{key:"roughness",label:"Roughness",type:"number",...p},{key:"highlightColor",label:"Highlight color",type:"color"},{key:"gradientColor",label:"Gradient color",type:"color"},{key:"gradientAmount",label:"Gradient amount",type:"number",...p},{key:"gradientDirection",label:"Gradient direction",type:"select",options:[{label:"Mouth line → outer edge",value:"outward"},{label:"Bottom → top",value:"vertical"},{label:"Left → right",value:"horizontal"}]},{key:"edgeSoftness",label:"Edge softness",type:"number",...p},{key:"innerLipColor",label:"Inner lip color",type:"color"},{key:"innerLipAmount",label:"Inner lip amount",type:"number",...p},{key:"innerLipWidth",label:"Inner lip width",type:"number",...p},{key:"splitLips",label:"Separate lower lip",type:"boolean"},{key:"lowerLipColor",label:"Lower lip color",type:"color"},{key:"lowerLipOpacity",label:"Lower lip opacity",type:"number",...p},{key:"textureScaleX",label:"Texture scale X",type:"number",min:.1,max:10,step:.05},{key:"textureScaleY",label:"Texture scale Y",type:"number",min:.1,max:10,step:.05},{key:"textureOffsetX",label:"Texture offset X",type:"number",min:-1,max:1,step:.01},{key:"textureOffsetY",label:"Texture offset Y",type:"number",min:-1,max:1,step:.01},{key:"textureRotation",label:"Texture rotation°",type:"number",min:-180,max:180,step:1},{key:"textureFlipX",label:"Flip horizontal",type:"boolean"},{key:"textureFlipY",label:"Flip vertical",type:"boolean"}],pe=(e,a,t=new g.Matrix3)=>{const l=(a.minU+a.maxU)/2,o=(a.minV+a.maxV)/2,n=a.maxU-a.minU,c=a.maxV-a.minV,E=-g.MathUtils.degToRad(e.textureRotation),h=Math.cos(E),m=Math.sin(E),v=(e.textureFlipX?-1:1)/Math.max(e.textureScaleX,.001),u=(e.textureFlipY?-1:1)/Math.max(e.textureScaleY,.001),d=v*h,f=-v*m,i=u*m,b=u*h,_=l+e.textureOffsetX*n,R=o+e.textureOffsetY*c,I=l-(d*_+f*R),F=o-(i*_+b*R);return t.set(d,f,I,i,b,F,0,0,1)},he=`
|
|
2
|
+
varying vec2 vUv;
|
|
3
|
+
|
|
4
|
+
void main() {
|
|
5
|
+
vUv = uv;
|
|
6
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
7
|
+
}
|
|
8
|
+
`,Ee=`
|
|
9
|
+
uniform sampler2D cameraTexture;
|
|
10
|
+
uniform sampler2D retouchMaskTexture;
|
|
11
|
+
uniform vec2 texelSize;
|
|
12
|
+
uniform float retouchAmount;
|
|
13
|
+
uniform float blurRadius;
|
|
14
|
+
uniform float detailPreservation;
|
|
15
|
+
uniform float blemishReduction;
|
|
16
|
+
uniform float blemishRadius;
|
|
17
|
+
uniform float previewMask;
|
|
18
|
+
uniform float protectLandmarks;
|
|
19
|
+
uniform float clipMinX;
|
|
20
|
+
uniform float clipMaxX;
|
|
21
|
+
varying vec2 vUv;
|
|
22
|
+
|
|
23
|
+
vec3 sampleCamera(vec2 uv) {
|
|
24
|
+
return texture2D(cameraTexture, clamp(uv, vec2(0.0), vec2(1.0))).rgb;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
vec3 readRetouchMask(vec2 uv) {
|
|
28
|
+
vec4 mask = texture2D(retouchMaskTexture, uv);
|
|
29
|
+
float faceRegion = clamp(mask.b, 0.0, 1.0);
|
|
30
|
+
float softFaceRegion = min(mask.r, faceRegion);
|
|
31
|
+
float protectedRegion = min(mask.g, faceRegion) * protectLandmarks;
|
|
32
|
+
float hardProtectedRegion = step(0.08, protectedRegion);
|
|
33
|
+
float softRetouchRegion = softFaceRegion * (1.0 - protectedRegion);
|
|
34
|
+
float hardRetouchRegion = step(0.5, faceRegion) * (1.0 - hardProtectedRegion);
|
|
35
|
+
|
|
36
|
+
return vec3(
|
|
37
|
+
clamp(softRetouchRegion, 0.0, 1.0),
|
|
38
|
+
clamp(protectedRegion, 0.0, 1.0),
|
|
39
|
+
clamp(hardRetouchRegion, 0.0, 1.0)
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
float retouchCoverage(vec2 uv) {
|
|
44
|
+
return step(0.001, readRetouchMask(uv).x);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
void addMaskedBlurSample(inout vec3 color, inout float weightSum, vec2 centerUv, vec2 sampleUv, float weight) {
|
|
48
|
+
float coverage = retouchCoverage(sampleUv);
|
|
49
|
+
vec3 sampleColor = mix(sampleCamera(centerUv), sampleCamera(sampleUv), coverage);
|
|
50
|
+
color += sampleColor * weight;
|
|
51
|
+
weightSum += weight;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
vec3 maskedBlurCamera(vec2 uv, float radius) {
|
|
55
|
+
vec2 r = texelSize * radius;
|
|
56
|
+
vec3 color = sampleCamera(uv) * 0.2;
|
|
57
|
+
float weightSum = 0.2;
|
|
58
|
+
|
|
59
|
+
addMaskedBlurSample(color, weightSum, uv, uv + vec2(r.x, 0.0), 0.1);
|
|
60
|
+
addMaskedBlurSample(color, weightSum, uv, uv - vec2(r.x, 0.0), 0.1);
|
|
61
|
+
addMaskedBlurSample(color, weightSum, uv, uv + vec2(0.0, r.y), 0.1);
|
|
62
|
+
addMaskedBlurSample(color, weightSum, uv, uv - vec2(0.0, r.y), 0.1);
|
|
63
|
+
addMaskedBlurSample(color, weightSum, uv, uv + r, 0.075);
|
|
64
|
+
addMaskedBlurSample(color, weightSum, uv, uv - r, 0.075);
|
|
65
|
+
addMaskedBlurSample(color, weightSum, uv, uv + vec2(r.x, -r.y), 0.075);
|
|
66
|
+
addMaskedBlurSample(color, weightSum, uv, uv + vec2(-r.x, r.y), 0.075);
|
|
67
|
+
addMaskedBlurSample(color, weightSum, uv, uv + r * 2.0, 0.05);
|
|
68
|
+
addMaskedBlurSample(color, weightSum, uv, uv - r * 2.0, 0.05);
|
|
69
|
+
|
|
70
|
+
return color / max(weightSum, 0.001);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
float retouchLuminance(vec3 color) {
|
|
74
|
+
return dot(color, vec3(0.299, 0.587, 0.114));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
vec3 reduceBlemishes(vec3 current, vec3 source, vec3 localAverage, vec3 skinBase, float skinMask) {
|
|
78
|
+
float originalLum = retouchLuminance(source);
|
|
79
|
+
float localLum = retouchLuminance(localAverage);
|
|
80
|
+
float redness = max(source.r - max(source.g, source.b), 0.0);
|
|
81
|
+
float localRedness = max(localAverage.r - max(localAverage.g, localAverage.b), 0.0);
|
|
82
|
+
float excessRedness = max(redness - localRedness * 0.72, 0.0);
|
|
83
|
+
float darkSpot = max(localLum - originalLum, 0.0);
|
|
84
|
+
float contrast = length(source - localAverage);
|
|
85
|
+
float candidate =
|
|
86
|
+
smoothstep(0.012, 0.09, excessRedness) +
|
|
87
|
+
smoothstep(0.018, 0.13, darkSpot) +
|
|
88
|
+
smoothstep(0.03, 0.16, contrast);
|
|
89
|
+
float blemishMask = clamp(candidate * 0.72, 0.0, 1.0) * skinMask * blemishReduction;
|
|
90
|
+
|
|
91
|
+
vec3 chromaReduced = vec3(
|
|
92
|
+
mix(current.r, min(current.r, localAverage.r * 1.04), blemishMask),
|
|
93
|
+
mix(current.g, max(current.g, localAverage.g * 0.98), 0.35 * blemishMask),
|
|
94
|
+
mix(current.b, max(current.b, localAverage.b * 0.98), 0.35 * blemishMask)
|
|
95
|
+
);
|
|
96
|
+
vec3 texture = source - localAverage;
|
|
97
|
+
vec3 repaired = clamp(skinBase + texture * detailPreservation * 0.18, 0.0, 1.0);
|
|
98
|
+
|
|
99
|
+
return mix(chromaReduced, repaired, min(blemishMask * 1.15, 1.0));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
void main() {
|
|
103
|
+
if (vUv.x < clipMinX || vUv.x > clipMaxX) discard;
|
|
104
|
+
|
|
105
|
+
vec3 original = sampleCamera(vUv);
|
|
106
|
+
vec3 masks = readRetouchMask(vUv);
|
|
107
|
+
float faceAlpha = max(max(masks.x, masks.y), masks.z);
|
|
108
|
+
|
|
109
|
+
if (previewMask > 0.5) {
|
|
110
|
+
float sharpPreview = 1.0 - step(0.001, retouchAmount + blurRadius);
|
|
111
|
+
float retouchPreview = mix(masks.x, masks.z, sharpPreview);
|
|
112
|
+
float protectedPreview = mix(masks.y, step(0.08, masks.y), sharpPreview);
|
|
113
|
+
vec3 facePreview = vec3(retouchPreview, 0.08, 0.08);
|
|
114
|
+
vec3 featurePreview = vec3(0.05, protectedPreview, 0.1);
|
|
115
|
+
vec3 maskPreview = max(facePreview, featurePreview);
|
|
116
|
+
vec3 debugColor = mix(original * 0.18, maskPreview, max(retouchPreview, protectedPreview));
|
|
117
|
+
gl_FragColor = vec4(debugColor, faceAlpha);
|
|
118
|
+
#include <colorspace_fragment>
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
float effectiveBlurRadius = min(blurRadius, 12.0);
|
|
123
|
+
vec3 smallBlur = maskedBlurCamera(vUv, max(0.0, effectiveBlurRadius * 0.45));
|
|
124
|
+
vec3 largeBlur = maskedBlurCamera(vUv, max(0.0, effectiveBlurRadius));
|
|
125
|
+
vec3 detail = original - smallBlur;
|
|
126
|
+
float detailAmount = mix(detailPreservation, 0.9, masks.y);
|
|
127
|
+
vec3 smoothed = clamp(largeBlur + detail * detailAmount, 0.0, 1.0);
|
|
128
|
+
vec3 color = mix(original, smoothed, min(retouchAmount, 0.72) * masks.x);
|
|
129
|
+
vec3 blemishAverage = maskedBlurCamera(vUv, max(1.0, blemishRadius));
|
|
130
|
+
color = reduceBlemishes(color, original, blemishAverage, smoothed, masks.x);
|
|
131
|
+
gl_FragColor = vec4(color, faceAlpha);
|
|
132
|
+
#include <colorspace_fragment>
|
|
133
|
+
}
|
|
134
|
+
`,ge=({retouchMask:e,retouchAmount:a,blurRadius:t,detailPreservation:l=.62,blemishReduction:o=.35,blemishRadius:n=3,previewMask:c,protectLandmarks:E,clipMinX:h=0,clipMaxX:m=1,renderOrder:v=-1e3})=>{const{camera:u,size:d}=H.useThree(),f=$.useXRCameraTexture(),i=S.useMemo(()=>({cameraTexture:{value:null},retouchMaskTexture:{value:null},texelSize:{value:new g.Vector2(1/1280,1/720)},retouchAmount:{value:0},blurRadius:{value:0},detailPreservation:{value:0},blemishReduction:{value:0},blemishRadius:{value:0},previewMask:{value:0},protectLandmarks:{value:1},clipMinX:{value:0},clipMaxX:{value:1}}),[]),b=S.useMemo(()=>{if(!u.isPerspectiveCamera)return[10,10];const _=u,F=(_.position.z||5)- -1,V=g.MathUtils.degToRad(_.fov),P=2*Math.tan(V/2)*F;return[P*(d.width/d.height),P]},[u,d]);return H.useFrame(()=>{i.cameraTexture.value=f??null,i.retouchMaskTexture.value=e,i.texelSize.value.set(1/Math.max(d.width,1),1/Math.max(d.height,1)),i.retouchAmount.value=a,i.blurRadius.value=t,i.detailPreservation.value=l,i.blemishReduction.value=o,i.blemishRadius.value=n,i.previewMask.value=c?1:0,i.protectLandmarks.value=E?1:0,i.clipMinX.value=h,i.clipMaxX.value=m}),f?M.jsx("group",{position:[0,0,-1],children:M.jsxs("mesh",{renderOrder:v,children:[M.jsx("planeGeometry",{args:b}),M.jsx("shaderMaterial",{uniforms:i,vertexShader:he,fragmentShader:Ee,transparent:!0,depthTest:!1,depthWrite:!1,toneMapped:!1})]})}):null},ve=e=>{const a=document.createElement("canvas");a.width=e,a.height=e;const t=a.getContext("2d",{willReadFrequently:!1});if(!t)throw new Error("Unable to create face retouch mask context");const l=new g.CanvasTexture(a);return l.colorSpace=g.NoColorSpace,l.minFilter=g.LinearFilter,l.magFilter=g.LinearFilter,l.generateMipmaps=!1,l.needsUpdate=!0,{canvas:a,context:t,texture:l}},fe=(e,a=U.FACE_MASK_SIZE,t={},l=0)=>{const o=S.useMemo(()=>ve(a),[a]);return S.useEffect(()=>{let n=0;const c=()=>{var h,m;n=requestAnimationFrame(c);const E=(m=(h=e==null?void 0:e.detectionResults)==null?void 0:h.faceLandmarks)==null?void 0:m[l];U.drawFaceRetouchMask(o.context,E,a,t),o.texture.needsUpdate=!0};return c(),()=>{cancelAnimationFrame(n)}},[l,e,o.context,o.texture,t,a]),S.useEffect(()=>()=>{o.texture.dispose()},[o.texture]),{canvas:o.canvas,texture:o.texture}},Se=[{key:"skinSmoothing",label:"Skin smoothing",type:"number",min:0,max:1,step:.01},{key:"skinRealism",label:"Skin realism",type:"number",min:0,max:1,step:.01},{key:"blemishReduction",label:"Blemish reduction",type:"number",min:0,max:1,step:.01},{key:"previewMask",label:"Preview mask",type:"boolean"}],be=e=>{const a=Number(e);return Number.isFinite(a)?Math.max(0,Math.round(a)):0},_e=(e,a)=>{const t=Number(a);return Number.isFinite(t)?Math.max(e+1,Math.round(t)):e+1},y={skinSmoothing:.55,skinRealism:.62,blemishReduction:.35,previewMask:!1},k={blurRadius:8,blemishRadius:3,protectLandmarks:!0,foreheadCoverage:!0},T=(e,a)=>{const t=Number(e);return Number.isFinite(t)?Math.min(1,Math.max(0,t)):a},D=(e={})=>({skinSmoothing:T(e.skinSmoothing,y.skinSmoothing),skinRealism:T(e.skinRealism,y.skinRealism),blemishReduction:T(e.blemishReduction,y.blemishReduction),previewMask:typeof e.previewMask=="boolean"?e.previewMask:y.previewMask}),xe=(e,a)=>D({...e,...a}),Me=({faceIndex:e,numFaces:a,skinSmoothing:t,skinRealism:l,blemishReduction:o,previewMask:n,clipMinX:c=0,clipMaxX:E=1,renderOrder:h})=>{const m=be(e),v=_e(m,a),u=D({skinSmoothing:t,skinRealism:l,blemishReduction:o,previewMask:n}),d=S.useMemo(()=>({numFaces:v}),[v]),{node:f}=Z.useXRModel(K.XRModel.FACE_TRACKER,d),i=S.useMemo(()=>({foreheadCoverage:k.foreheadCoverage}),[]),b=fe(f,void 0,i,m);return M.jsx(ge,{retouchMask:b.texture,retouchAmount:u.skinSmoothing,blurRadius:k.blurRadius,detailPreservation:u.skinRealism,blemishReduction:u.blemishReduction,blemishRadius:k.blemishRadius,previewMask:u.previewMask,protectLandmarks:k.protectLandmarks,clipMinX:c,clipMaxX:E,renderOrder:h})};exports.DEFAULT_FACE_WARP_3D_SETTINGS=N;exports.DEFAULT_IRIS_EFFECT_SETTINGS=G;exports.DEFAULT_LIP_EFFECT_SETTINGS=z;exports.FACE_RETOUCH_DEFAULT_CONTROLS=y;exports.FACE_RETOUCH_SETTINGS_FIELDS=Se;exports.FACE_WARP_3D_PRESET=Q;exports.FaceRetouch=Me;exports.IRIS_EFFECT_EYES=X;exports.IRIS_EFFECT_MODES=Y;exports.IRIS_EFFECT_SETTINGS_FIELDS=se;exports.LIP_EFFECT_COLOR_MODES=W;exports.LIP_EFFECT_GRADIENT_DIRECTIONS=j;exports.LIP_EFFECT_PRESETS=w;exports.LIP_EFFECT_PRESET_KEYS=L;exports.LIP_EFFECT_SETTINGS_FIELDS=de;exports.alphaMapOptions=re;exports.blendModeOptions=ie;exports.createLipTextureTransform=pe;exports.isLipEffectPresetKey=O;exports.maskTextureSourceOptions=le;exports.materialTypeOptions=ee;exports.patchFaceRetouchControls=xe;exports.patchIrisEffectSettings=ce;exports.patchLipEffectSettings=me;exports.resolveFaceRetouchControls=D;exports.resolveIrisEffectSettings=ne;exports.resolveLipEffectSettings=A;exports.shaderPresetOptions=te;exports.sideOptions=ae;exports.textureMapOptions=oe;
|