OneEuroFilter is a low-pass filter designed to reduce jitter in noisy signals while maintaining low latency. It's particularly useful for smoothing tracking data from XR controllers, hand tracking, or other input devices where the signal contains noise but responsiveness is important.

The filter automatically adapts its smoothing strength based on the signal's velocity:

  • When the signal moves slowly, it applies strong smoothing to reduce jitter
  • When the signal moves quickly, it reduces smoothing to maintain responsiveness

Based on the research paper: 1€ Filter: A Simple Speed-based Low-pass Filter for Noisy Input

const filter = new OneEuroFilter(120, 1.0, 0.0);

// In your update loop:
const smoothedValue = filter.filter(noisyValue, this.context.time.time);
// Assuming 60 FPS update rate
const filter = new OneEuroFilter(60, 1.0, 0.5);

// Call without timestamp - uses the frequency estimate
const smoothedValue = filter.filter(noisyValue);
const posFilter = new OneEuroFilterXYZ(90, 0.5, 0.0);

posFilter.filter(trackedPosition, smoothedPosition, this.context.time.time);

OneEuroFilterXYZ for filtering 3D vectors

Constructors

  • Create a new OneEuroFilter

    Parameters

    • freq: number

      An estimate of the frequency in Hz of the signal (> 0), if timestamps are not available.

    • minCutOff: number = 1.0

      Min cutoff frequency in Hz (> 0). Lower values allow to remove more jitter.

    • beta: number = 0.0

      Parameter to reduce latency (> 0). Higher values make the filter react faster to changes.

    • dCutOff: number = 1.0

      Used to filter the derivates. 1 Hz by default. Change this parameter if you know what you are doing.

    Returns OneEuroFilter

Properties

beta: number

Parameter to reduce latency (> 0). Higher values make the filter react faster to changes.

dCutOff: number

Used to filter the derivates. 1 Hz by default. Change this parameter if you know what you are doing.

dx: LowPassFilter

The low-pass filter for the derivates.

freq: number

An estimate of the frequency in Hz of the signal (> 0), if timestamps are not available.

lasttime: null | number

The last time the filter was called.

minCutOff: number

Min cutoff frequency in Hz (> 0). Lower values allow to remove more jitter.

x: LowPassFilter

The low-pass filter for the signal.

Methods

  • Parameters

    • cutOff: number

    Returns number

  • Filter your value: call with your value and the current timestamp (e.g. from this.context.time.time)

    Parameters

    • x: number
    • time: null | number = null

    Returns number

  • Parameters

    • Optionalx: number

    Returns void