mirror of
https://github.com/overte-org/overte.git
synced 2025-07-26 09:18:26 +02:00
Merge pull request #4730 from ctrlaltdavid/20520
CR for 20520 - Velocity filter DDE eyebrows
This commit is contained in:
commit
d16b9ebc7a
2 changed files with 19 additions and 5 deletions
|
@ -169,7 +169,9 @@ DdeFaceTracker::DdeFaceTracker(const QHostAddress& host, quint16 serverPort, qui
|
||||||
_lastLeftEyeBlink(0.0f),
|
_lastLeftEyeBlink(0.0f),
|
||||||
_filteredLeftEyeBlink(0.0f),
|
_filteredLeftEyeBlink(0.0f),
|
||||||
_lastRightEyeBlink(0.0f),
|
_lastRightEyeBlink(0.0f),
|
||||||
_filteredRightEyeBlink(0.0f)
|
_filteredRightEyeBlink(0.0f),
|
||||||
|
_lastBrowUp(0.0f),
|
||||||
|
_filteredBrowUp(0.0f)
|
||||||
{
|
{
|
||||||
_coefficients.resize(NUM_FACESHIFT_BLENDSHAPES);
|
_coefficients.resize(NUM_FACESHIFT_BLENDSHAPES);
|
||||||
|
|
||||||
|
@ -389,10 +391,20 @@ void DdeFaceTracker::decodePacket(const QByteArray& buffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use BrowsU_C to control both brows' up and down
|
// Use BrowsU_C to control both brows' up and down
|
||||||
_coefficients[_browDownLeftIndex] = -_coefficients[_browUpCenterIndex];
|
float browUp = _coefficients[_browUpCenterIndex];
|
||||||
_coefficients[_browDownRightIndex] = -_coefficients[_browUpCenterIndex];
|
if (isFiltering) {
|
||||||
_coefficients[_browUpLeftIndex] = _coefficients[_browUpCenterIndex];
|
const float BROW_VELOCITY_FILTER_STRENGTH = 0.75f;
|
||||||
_coefficients[_browUpRightIndex] = _coefficients[_browUpCenterIndex];
|
float velocity = fabs(browUp - _lastBrowUp) / _averageMessageTime;
|
||||||
|
float velocityFilter = glm::clamp(velocity * BROW_VELOCITY_FILTER_STRENGTH, 0.0f, 1.0f);
|
||||||
|
_filteredBrowUp = velocityFilter * browUp + (1.0f - velocityFilter) * _filteredBrowUp;
|
||||||
|
_lastBrowUp = browUp;
|
||||||
|
browUp = _filteredBrowUp;
|
||||||
|
_coefficients[_browUpCenterIndex] = browUp;
|
||||||
|
}
|
||||||
|
_coefficients[_browUpLeftIndex] = browUp;
|
||||||
|
_coefficients[_browUpRightIndex] = browUp;
|
||||||
|
_coefficients[_browDownLeftIndex] = -browUp;
|
||||||
|
_coefficients[_browDownRightIndex] = -browUp;
|
||||||
|
|
||||||
// Offset jaw open coefficient
|
// Offset jaw open coefficient
|
||||||
static const float JAW_OPEN_THRESHOLD = 0.16f;
|
static const float JAW_OPEN_THRESHOLD = 0.16f;
|
||||||
|
|
|
@ -109,6 +109,8 @@ private:
|
||||||
float _filteredLeftEyeBlink;
|
float _filteredLeftEyeBlink;
|
||||||
float _lastRightEyeBlink;
|
float _lastRightEyeBlink;
|
||||||
float _filteredRightEyeBlink;
|
float _filteredRightEyeBlink;
|
||||||
|
float _lastBrowUp;
|
||||||
|
float _filteredBrowUp;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_DdeFaceTracker_h
|
#endif // hifi_DdeFaceTracker_h
|
Loading…
Reference in a new issue