mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 15:17:42 +02:00
Voice modulation and facetrackers write to transient blendshapes
This commit is contained in:
parent
3b06b03e01
commit
1b855f2c6b
2 changed files with 12 additions and 12 deletions
|
@ -48,7 +48,7 @@ void MyHead::simulate(float deltaTime) {
|
||||||
FaceTracker* faceTracker = qApp->getActiveFaceTracker();
|
FaceTracker* faceTracker = qApp->getActiveFaceTracker();
|
||||||
_isFaceTrackerConnected = faceTracker != NULL && !faceTracker->isMuted();
|
_isFaceTrackerConnected = faceTracker != NULL && !faceTracker->isMuted();
|
||||||
if (_isFaceTrackerConnected) {
|
if (_isFaceTrackerConnected) {
|
||||||
_blendshapeCoefficients = faceTracker->getBlendshapeCoefficients();
|
_transientBlendshapeCoefficients = faceTracker->getBlendshapeCoefficients();
|
||||||
|
|
||||||
if (typeid(*faceTracker) == typeid(DdeFaceTracker)) {
|
if (typeid(*faceTracker) == typeid(DdeFaceTracker)) {
|
||||||
|
|
||||||
|
@ -60,11 +60,11 @@ void MyHead::simulate(float deltaTime) {
|
||||||
const int FUNNEL_BLENDSHAPE = 40;
|
const int FUNNEL_BLENDSHAPE = 40;
|
||||||
const int SMILE_LEFT_BLENDSHAPE = 28;
|
const int SMILE_LEFT_BLENDSHAPE = 28;
|
||||||
const int SMILE_RIGHT_BLENDSHAPE = 29;
|
const int SMILE_RIGHT_BLENDSHAPE = 29;
|
||||||
_blendshapeCoefficients[JAW_OPEN_BLENDSHAPE] += _audioJawOpen;
|
_transientBlendshapeCoefficients[JAW_OPEN_BLENDSHAPE] += _audioJawOpen;
|
||||||
_blendshapeCoefficients[SMILE_LEFT_BLENDSHAPE] += _mouth4;
|
_transientBlendshapeCoefficients[SMILE_LEFT_BLENDSHAPE] += _mouth4;
|
||||||
_blendshapeCoefficients[SMILE_RIGHT_BLENDSHAPE] += _mouth4;
|
_transientBlendshapeCoefficients[SMILE_RIGHT_BLENDSHAPE] += _mouth4;
|
||||||
_blendshapeCoefficients[MMMM_BLENDSHAPE] += _mouth2;
|
_transientBlendshapeCoefficients[MMMM_BLENDSHAPE] += _mouth2;
|
||||||
_blendshapeCoefficients[FUNNEL_BLENDSHAPE] += _mouth3;
|
_transientBlendshapeCoefficients[FUNNEL_BLENDSHAPE] += _mouth3;
|
||||||
}
|
}
|
||||||
applyEyelidOffset(getFinalOrientationInWorldFrame());
|
applyEyelidOffset(getFinalOrientationInWorldFrame());
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ void Head::simulate(float deltaTime) {
|
||||||
_mouth2,
|
_mouth2,
|
||||||
_mouth3,
|
_mouth3,
|
||||||
_mouth4,
|
_mouth4,
|
||||||
_blendshapeCoefficients);
|
_transientBlendshapeCoefficients);
|
||||||
|
|
||||||
applyEyelidOffset(getOrientation());
|
applyEyelidOffset(getOrientation());
|
||||||
|
|
||||||
|
@ -227,15 +227,15 @@ void Head::applyEyelidOffset(glm::quat headOrientation) {
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
const int LEFT_EYE = 8;
|
const int LEFT_EYE = 8;
|
||||||
float eyeCoefficient = _blendshapeCoefficients[i] - _blendshapeCoefficients[LEFT_EYE + i]; // Raw value
|
float eyeCoefficient = _transientBlendshapeCoefficients[i] - _transientBlendshapeCoefficients[LEFT_EYE + i];
|
||||||
eyeCoefficient = glm::clamp(eyelidOffset + eyeCoefficient * (1.0f - eyelidOffset), -1.0f, 1.0f);
|
eyeCoefficient = glm::clamp(eyelidOffset + eyeCoefficient * (1.0f - eyelidOffset), -1.0f, 1.0f);
|
||||||
if (eyeCoefficient > 0.0f) {
|
if (eyeCoefficient > 0.0f) {
|
||||||
_blendshapeCoefficients[i] = eyeCoefficient;
|
_transientBlendshapeCoefficients[i] = eyeCoefficient;
|
||||||
_blendshapeCoefficients[LEFT_EYE + i] = 0.0f;
|
_transientBlendshapeCoefficients[LEFT_EYE + i] = 0.0f;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_blendshapeCoefficients[i] = 0.0f;
|
_transientBlendshapeCoefficients[i] = 0.0f;
|
||||||
_blendshapeCoefficients[LEFT_EYE + i] = -eyeCoefficient;
|
_transientBlendshapeCoefficients[LEFT_EYE + i] = -eyeCoefficient;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue