From 1579da304c2899c6bc0279d2c2dabb033384dbf4 Mon Sep 17 00:00:00 2001 From: Erimel Date: Fri, 4 Sep 2026 15:29:48 -0400 Subject: [PATCH] Filtering steps of 5% and allow 0% --- .../settings/pages/components/TrackingSettings.tsx | 4 ++-- .../slimevr/skeleton/inputprocessors/bone-prediction.kt | 7 +++---- .../dev/slimevr/skeleton/inputprocessors/bone-smoothing.kt | 7 ++++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gui/app/src/components/settings/pages/components/TrackingSettings.tsx b/gui/app/src/components/settings/pages/components/TrackingSettings.tsx index dd2daed7e..352b5fd20 100644 --- a/gui/app/src/components/settings/pages/components/TrackingSettings.tsx +++ b/gui/app/src/components/settings/pages/components/TrackingSettings.tsx @@ -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} /> diff --git a/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/bone-prediction.kt b/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/bone-prediction.kt index 49c97d17f..68844bf31 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/bone-prediction.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/bone-prediction.kt @@ -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() @@ -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) { diff --git a/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/bone-smoothing.kt b/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/bone-smoothing.kt index e02644156..17ee0e3a7 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/bone-smoothing.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/bone-smoothing.kt @@ -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()