mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-27 04:16:32 -08:00
Filtering steps of 5% and allow 0%
This commit is contained in:
1 parent
4a0a7274b0
commit
1579da304c
3 files changed
+9
-9
No files matched your search
@@ -252,9 +252,9 @@ export function TrackingSettings() {
|
||||
'settings-general-tracker_mechanics-filtering-amount'
|
||||
)}
|
||||
valueLabelFormat={(value) => percentageFormat.format(value)}
|
||||
min={0.1}
|
||||
min={0.0}
|
||||
max={1.0}
|
||||
step={0.1}
|
||||
step={0.05}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import io.github.axisangles.ktmath.Quaternion
|
||||
import solarxr_protocol.datatypes.BodyPart
|
||||
import solarxr_protocol.rpc.FilteringType
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
import kotlin.time.TimeSource
|
||||
|
||||
/** How far ahead the prediction reaches at amount 1, scaled down by the configured amount */
|
||||
val PREDICTION_LEAD = 10.milliseconds
|
||||
@@ -44,12 +43,12 @@ class BonePredictionInputProcessor(val settings: Settings) : SkeletonInputProces
|
||||
// TODO: find a way to improve prediction to make it less jittery
|
||||
override fun process(mutableInputSkeleton: InputSkeleton, skeletonHeight: Float) {
|
||||
val config = settings.context.state.value.data.skeletonConfig.filtering
|
||||
if (config.type != FilteringType.PREDICTION) {
|
||||
val filteringAmount = config.amount
|
||||
if (config.type != FilteringType.PREDICTION || filteringAmount <= 0f) {
|
||||
// Drop stale velocities so re-enabling doesn't diff against a long outdated pose
|
||||
if (velocities.isNotEmpty()) velocities.clear()
|
||||
return
|
||||
}
|
||||
val predictionAmount = config.amount
|
||||
val now = timeSource.markNow()
|
||||
|
||||
val newVelocities = bodyPartMap<BoneVelocity>()
|
||||
@@ -62,7 +61,7 @@ class BonePredictionInputProcessor(val settings: Settings) : SkeletonInputProces
|
||||
return@forEachBone
|
||||
}
|
||||
|
||||
val bonePredictionAmount = predictionAmount * getMultiplier(bodyPart)
|
||||
val bonePredictionAmount = filteringAmount * getMultiplier(bodyPart)
|
||||
|
||||
val changed = bone.rotation !== prev.lastRotation
|
||||
val rotationDelta = if (changed) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import io.github.axisangles.ktmath.Quaternion
|
||||
import solarxr_protocol.rpc.FilteringType
|
||||
|
||||
private const val SMOOTHING_MULTIPLIER = 100f
|
||||
private const val SMOOTH_MIN = 0.55f
|
||||
private const val SMOOTH_MIN = 0.54f
|
||||
private const val SMOOTH_MAX = 0.95f
|
||||
|
||||
/**
|
||||
@@ -25,7 +25,8 @@ class BoneSmoothingInputProcessor(val settings: Settings) : SkeletonInputProcess
|
||||
// TODO this isn't linear. Do we want linear smoothing like in main?
|
||||
override fun process(mutableInputSkeleton: InputSkeleton, skeletonHeight: Float) {
|
||||
val config = settings.context.state.value.data.skeletonConfig.filtering
|
||||
if (config.type != FilteringType.SMOOTHING) {
|
||||
val filteringAmount = config.amount
|
||||
if (config.type != FilteringType.SMOOTHING || filteringAmount <= 0f) {
|
||||
// Drop stale poses so re-enabling doesn't blend out of an outdated frame
|
||||
if (smoothed.isNotEmpty()) smoothed.clear()
|
||||
lastProcessTime = timeSource.markNow()
|
||||
@@ -36,7 +37,7 @@ class BoneSmoothingInputProcessor(val settings: Settings) : SkeletonInputProcess
|
||||
val lastFrameTimeSeconds = lastProcessTime.elapsedNow().inFloatingSeconds
|
||||
lastProcessTime = timeSource.markNow()
|
||||
|
||||
val smoothingAmount = SMOOTH_MIN + config.amount.coerceIn(0f, 1f) * (SMOOTH_MAX - SMOOTH_MIN)
|
||||
val smoothingAmount = SMOOTH_MIN + filteringAmount * (SMOOTH_MAX - SMOOTH_MIN)
|
||||
val alpha = ((1 - smoothingAmount) * lastFrameTimeSeconds * SMOOTHING_MULTIPLIER).coerceIn(0f, 1f)
|
||||
|
||||
val newSmoothed = bodyPartMap<Quaternion>()
|
||||
|
||||
Reference in new issue
Block a user