Skip to content

Commit 302c5a0

Browse files
committed
feat: ✨ Support FB face tracking 2; fix eye tracking
1 parent fd19203 commit 302c5a0

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed

ALVRModule/ALVRModule.cs

+30-11
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,15 @@ public enum FaceFb
7777
UpperLidRaiserR = 60,
7878
UpperLipRaiserL = 61,
7979
UpperLipRaiserR = 62,
80-
FaceFbMax = 63
80+
TongueTipInterdental = 63,
81+
TongueTipAlveolar = 64,
82+
TongueFrontDorsalPalate = 65,
83+
TongueMidDorsalPalate = 66,
84+
TongueBackDorsalVelar = 67,
85+
TongueOutFb = 68,
86+
TongueRetreat = 69,
87+
Face1FbMax = 63,
88+
Face2FbMax = 70,
8189
}
8290

8391
public class ALVRModule : ExtTrackingModule
@@ -171,20 +179,21 @@ private static void SetCombEyesQuatParams(float[] p)
171179
SetEyesQuatParams(array);
172180
}
173181

174-
private static void SetFaceFbParams(float[] p)
182+
static void SetParam(float[] data, FaceFb input, UnifiedExpressions outputType)
175183
{
176-
Debug.Assert(p.Length == (int)FaceFbMax);
184+
UnifiedTracking.Data.Shapes[(int)outputType].Weight = data[(int)input];
185+
}
186+
187+
private static void SetFace1FbParams(float[] p)
188+
{
189+
// Debug.Assert(p.Length == (int)Face1FbMax);
177190

178191
var eye = UnifiedTracking.Data.Eye;
179192
var expr = UnifiedTracking.Data.Shapes;
180193

181194
eye.Left.Openness = 1.0f - (float)Math.Max(0, Math.Min(1, p[(int)EyesClosedL] + p[(int)EyesClosedL] * p[(int)LidTightenerL]));
182195
eye.Right.Openness = 1.0f - (float)Math.Max(0, Math.Min(1, p[(int)EyesClosedR] + p[(int)EyesClosedR] * p[(int)LidTightenerR]));
183196

184-
static void SetParam(float[] data, FaceFb input, UnifiedExpressions outputType)
185-
{
186-
UnifiedTracking.Data.Shapes[(int)outputType].Weight = data[(int)input];
187-
}
188197

189198
// Eyelids
190199
SetParam(p, LidTightenerR, EyeSquintRight);
@@ -266,7 +275,6 @@ static void SetParam(float[] data, FaceFb input, UnifiedExpressions outputType)
266275
SetParam(p, DimplerL, MouthDimpleLeft);
267276
SetParam(p, DimplerR, MouthDimpleRight);
268277

269-
270278
SetParam(p, ChinRaiserT, MouthRaiserUpper);
271279
SetParam(p, ChinRaiserB, MouthRaiserLower);
272280
SetParam(p, LipPressorR, MouthPressRight);
@@ -275,6 +283,14 @@ static void SetParam(float[] data, FaceFb input, UnifiedExpressions outputType)
275283
SetParam(p, LipTightenerL, MouthTightenerLeft);
276284
}
277285

286+
private static void SetFace2FbParams(float[] p) {
287+
Debug.Assert(p.Length == (int)Face2FbMax);
288+
289+
SetFace1FbParams(p);
290+
291+
SetParam(p, TongueOutFb, TongueOut);
292+
}
293+
278294
public override void Update()
279295
{
280296
byte[] packet;
@@ -297,13 +313,16 @@ public override void Update()
297313
switch (str)
298314
{
299315
case "EyesQuat":
300-
SetFaceFbParams(GetParams(packet, ref cursor, 8));
316+
SetEyesQuatParams(GetParams(packet, ref cursor, 8));
301317
break;
302318
case "CombQuat":
303-
SetFaceFbParams(GetParams(packet, ref cursor, 4));
319+
SetCombEyesQuatParams(GetParams(packet, ref cursor, 4));
304320
break;
305321
case "FaceFb\0\0":
306-
SetFaceFbParams(GetParams(packet, ref cursor, (int)FaceFbMax));
322+
SetFace1FbParams(GetParams(packet, ref cursor, (int)Face1FbMax));
323+
break;
324+
case "Face2Fb\0":
325+
SetFace2FbParams(GetParams(packet, ref cursor, (int)Face2FbMax));
307326
break;
308327
default:
309328
Logger.LogError("[ALVR Module] Unrecognized prefix");

metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"DllFileName": "ALVRModule.dll",
55
"Downloads": 0,
66
"DownloadUrl": "https://github.com/alvr-org/VRCFT-ALVR/releases/download/v1.2.0/ALVRModule.zip",
7-
"LastUpdated": "2023-11-08T07:36:37Z",
7+
"LastUpdated": "2023-12-24T18:33:19Z",
88
"ModuleDescription": "VRCFaceTracking module for ALVR support",
99
"ModuleName": "ALVR Module",
1010
"ModulePageUrl": "https://github.com/alvr-org/VRCFT-ALVR",

0 commit comments

Comments
 (0)