Skip to content

Commit

Permalink
Merge branch 'Quest-Pro' into refactor/osc
Browse files Browse the repository at this point in the history
  • Loading branch information
benaclejames committed Mar 23, 2023
2 parents 57e4a53 + 014f0b1 commit db26ea8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
6 changes: 4 additions & 2 deletions SRanipalExtTrackingModule/SRanipalTrackingInterface.cs
Expand Up @@ -18,7 +18,7 @@ public class SRanipalExtTrackingInterface : ExtTrackingModule
{
LipData_v2 lipData = default;
EyeData_v2 eyeData = default;
private static bool eyeEnabled = false, lipEnabled = false;
private static bool eyeEnabled = false, lipEnabled = false, isViveProEye = false;

private static CancellationTokenSource _cancellationToken;

Expand All @@ -41,6 +41,8 @@ public override (bool eyeSuccess, bool expressionSuccess) Initialize(bool eyeAva

if (eyeEnabled && Utils.HasAdmin)
{
isViveProEye = SRanipal_Eye_API.IsViveProEye();

var found = false;
int tries = 0;
while (!found && tries < 15)
Expand Down Expand Up @@ -263,7 +265,7 @@ private void UpdateEyeParameters(ref UnifiedEyeData data, VerboseData external)
if (external.right.GetValidity(SingleEyeDataValidity.SINGLE_EYE_DATA_PUPIL_DIAMETER_VALIDITY))
data.Right.PupilDiameter_MM = external.right.pupil_diameter_mm;

if (SRanipal_Eye_API.IsViveProEye())
if (isViveProEye)
{
if (external.left.GetValidity(SingleEyeDataValidity.SINGLE_EYE_DATA_GAZE_DIRECTION_VALIDITY))
data.Left.Gaze = external.left.gaze_direction_normalized.FlipXCoordinates();
Expand Down
Expand Up @@ -29,13 +29,11 @@ internal static class UnifiedSRanMapper
exp.Shapes[(int)UnifiedExpressions.LipPuckerLowerLeft].Weight + exp.Shapes[(int)UnifiedExpressions.LipPuckerLowerRight].Weight) / 4.0f },

{ SRanipal_LipShape_v2.MouthSmileRight, exp =>
(exp.Shapes[(int)UnifiedExpressions.MouthCornerPullRight].Weight * .8f + exp.Shapes[(int)UnifiedExpressions.MouthCornerSlantRight].Weight * .2f) > exp.Shapes[(int)UnifiedExpressions.MouthDimpleRight].Weight ?
(exp.Shapes[(int)UnifiedExpressions.MouthCornerPullRight].Weight * .8f + exp.Shapes[(int)UnifiedExpressions.MouthCornerSlantRight].Weight * .2f) :
exp.Shapes[(int)UnifiedExpressions.MouthDimpleRight].Weight },
GetSimpleShape(exp, UnifiedSimpleExpressions.MouthSmileRight) > exp.Shapes[(int)UnifiedExpressions.MouthDimpleRight].Weight ?
GetSimpleShape(exp, UnifiedSimpleExpressions.MouthSmileRight) : exp.Shapes[(int)UnifiedExpressions.MouthDimpleRight].Weight },
{ SRanipal_LipShape_v2.MouthSmileLeft, exp =>
(exp.Shapes[(int)UnifiedExpressions.MouthCornerPullLeft].Weight * .8f + exp.Shapes[(int)UnifiedExpressions.MouthCornerSlantLeft].Weight * .2f) > exp.Shapes[(int)UnifiedExpressions.MouthDimpleLeft].Weight ?
(exp.Shapes[(int)UnifiedExpressions.MouthCornerPullLeft].Weight * .8f + exp.Shapes[(int)UnifiedExpressions.MouthCornerSlantLeft].Weight * .2f) :
exp.Shapes[(int)UnifiedExpressions.MouthDimpleLeft].Weight },
GetSimpleShape(exp, UnifiedSimpleExpressions.MouthSmileLeft) > exp.Shapes[(int)UnifiedExpressions.MouthDimpleLeft].Weight ?
GetSimpleShape(exp, UnifiedSimpleExpressions.MouthSmileLeft) : exp.Shapes[(int)UnifiedExpressions.MouthDimpleLeft].Weight },
{ SRanipal_LipShape_v2.MouthSadRight, exp =>
Math.Max(0, (((exp.Shapes[(int)UnifiedExpressions.MouthFrownRight].Weight + exp.Shapes[(int)UnifiedExpressions.MouthFrownLeft].Weight) / 2.0f >
(exp.Shapes[(int)UnifiedExpressions.MouthStretchRight].Weight) ?
Expand Down
12 changes: 12 additions & 0 deletions VRCFaceTracking/Params/Expressions/UnifiedExpressionsMerger.cs
Expand Up @@ -21,6 +21,16 @@ public static class UnifiedExpressionsMerger

#endregion

#region Eye Pupils

new EParam(exp => exp.Eye.Combined().PupilDiameter_MM, "v2/PupilDilation"),

new EParam(exp => exp.Eye.Left.PupilDiameter_MM * 0.1f, "v2/PupilDiameterLeft"),
new EParam(exp => exp.Eye.Right.PupilDiameter_MM * 0.1f, "v2/PupilDiameterRight"),
new EParam(exp => (exp.Eye.Left.PupilDiameter_MM * 0.1f + exp.Eye.Left.PupilDiameter_MM * 0.1f) / 2.0f, "v2/PupilDiameter"),

#endregion

#region Eye Openness

new EParam(exp => exp.Eye.Left.Openness, "v2/EyeOpenLeft"),
Expand Down Expand Up @@ -166,6 +176,8 @@ public static class UnifiedExpressionsMerger
new EParam(exp => (exp.Shapes[(int)UnifiedExpressions.MouthPressRight].Weight + exp.Shapes[(int)UnifiedExpressions.MouthPressLeft].Weight) / 2.0f, "v2/MouthPress"),
new EParam(exp => (exp.Shapes[(int)UnifiedExpressions.MouthDimpleRight].Weight + exp.Shapes[(int)UnifiedExpressions.MouthDimpleLeft].Weight) / 2.0f, "v2/MouthDimple"),

new EParam(exp => (exp.Shapes[(int)UnifiedExpressions.NoseSneerRight].Weight + exp.Shapes[(int)UnifiedExpressions.NoseSneerLeft].Weight) / 2.0f, "v2/NoseSneer"),

#endregion

#region Lip Corners Combined
Expand Down

0 comments on commit db26ea8

Please sign in to comment.