> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/opentrack/opentrack/llms.txt
> Use this file to discover all available pages before exploring further.

# Filter Overview

> Understand OpenTrack's filtering algorithms and choose the right filter for your use case

Filters in OpenTrack smooth the raw tracking data from your camera or sensor to reduce jitter while maintaining responsiveness. Each filter uses a different approach to balance smoothness and lag.

## Available Filters

OpenTrack provides several filtering algorithms, each optimized for different use cases:

<CardGroup cols={2}>
  <Card title="Alpha Spectrum" icon="brain" href="/filters/alpha-spectrum">
    Advanced adaptive filter with multi-head composition and motion prediction
  </Card>

  <Card title="EWMA" icon="chart-line" href="/filters/ewma">
    Exponentially weighted moving average with dynamic noise detection
  </Card>

  <Card title="Hamilton" icon="compass" href="/filters/hamilton">
    Quaternion-based filter using Slerp interpolation for rotations
  </Card>

  <Card title="Accela" icon="gauge" href="/filters/accela">
    Spline-based acceleration filter for velocity-dependent smoothing
  </Card>

  <Card title="Accela + Hamilton" icon="layer-group">
    Combined filter using Accela smoothing with Hamilton's quaternion rotations
  </Card>

  <Card title="None" icon="ban">
    No filtering - raw tracking data passes through unmodified
  </Card>
</CardGroup>

<Note>
  **Accela + Hamilton** combines Accela's velocity-dependent smoothing with Hamilton's quaternion-based rotation handling for smoother gimbal-free rotations. **None** can be useful for debugging or when using external smoothing.
</Note>

## Filter Comparison

| Filter                | Best For                                       | Complexity | CPU Usage   | Adaptive |
| --------------------- | ---------------------------------------------- | ---------- | ----------- | -------- |
| **Alpha Spectrum**    | Advanced users wanting maximum control         | High       | Medium-High | Yes      |
| **EWMA**              | General purpose, automatic noise adaptation    | Medium     | Low         | Yes      |
| **Hamilton**          | Smooth rotation with quaternion interpolation  | Medium     | Low         | Partial  |
| **Accela**            | Fast action games, velocity-dependent response | Low        | Low         | Yes      |
| **Accela + Hamilton** | Combined smoothing with quaternion rotations   | Medium     | Low         | Yes      |
| **None**              | No filtering, raw data                         | Minimal    | None        | No       |

## Choosing a Filter

### For Simulators and Precision Work

Use **EWMA** or **Alpha Spectrum** (Stable profile):

* Maximum smoothness when stationary
* Minimal jitter for precise aiming
* Responsive enough for slow pans

<CodeGroup>
  ```text EWMA Settings theme={null}
  Min Smoothing: 0.02
  Max Smoothing: 0.7
  Curve: 0.8
  ```

  ```text Alpha Spectrum Settings theme={null}
  Rotation Min/Max: 0.03 / 0.55
  Rotation Curve: 1.8
  Adaptive Mode: Off
  ```
</CodeGroup>

### For Fast Action Games

Use **Accela** or **Alpha Spectrum** (Responsive profile):

* Minimal lag during rapid movements
* Velocity-based acceleration
* Quick response to fast turns

<CodeGroup>
  ```text Accela Settings theme={null}
  Rotation Sensitivity: 1.5
  Translation Sensitivity: 1.0
  Rotation Deadzone: 0.03°
  ```

  ```text Alpha Spectrum Settings theme={null}
  Rotation Min/Max: 0.06 / 0.85
  Rotation Curve: 0.9
  Adaptive Mode: On
  ```
</CodeGroup>

### For Smooth Cinematic Movement

Use **Hamilton**:

* True quaternion interpolation (Slerp)
* No gimbal lock artifacts
* Smooth, natural rotation paths

```text Hamilton Settings theme={null}
Max Rotation: 0.01
Rotation Power: 0.01
Rotation Deadzone: 0.01°
```

## Key Concepts

<AccordionGroup>
  <Accordion title="Smoothing vs Lag Trade-off">
    All filters balance two competing goals:

    * **More smoothing** = less jitter but more lag
    * **Less smoothing** = faster response but more visible shake

    Adaptive filters try to automatically adjust this balance based on detected motion.
  </Accordion>

  <Accordion title="Deadzones">
    Deadzones suppress tiny movements below a threshold to eliminate noise:

    * **Rotation deadzone**: ignores small rotational movements (degrees)
    * **Translation deadzone**: ignores small positional movements (millimeters)

    Too high = inputs feel sticky. Too low = visible jitter.
  </Accordion>

  <Accordion title="Alpha Values">
    The alpha parameter controls the filter weight:

    * `output = output + alpha * (input - output)`
    * Alpha of 1.0 = no smoothing (instant response)
    * Alpha of 0.0 = infinite smoothing (no movement)

    Adaptive filters dynamically adjust alpha based on motion energy.
  </Accordion>

  <Accordion title="Noise Detection">
    Advanced filters (EWMA, Alpha Spectrum) measure noise statistics:

    * Track variance of recent deltas
    * Distinguish intentional movement from sensor noise
    * Adapt smoothing strength automatically

    This provides heavier smoothing when still, lighter smoothing when moving.
  </Accordion>
</AccordionGroup>

## Filter Pipeline

Filters process tracking data in the pipeline:

```mermaid theme={null}
graph LR
    A[Tracker] --> B[Raw Input]
    B --> C[Filter]
    C --> D[Mapping]
    D --> E[Output]
```

1. **Tracker** provides raw 6DOF pose data
2. **Filter** smooths the data (this module)
3. **Mapping** applies curves and response adjustments
4. **Output** sends to game/simulator

<Note>
  Filters operate on the raw tracking data before mapping curves are applied. This means filter settings are independent of your response curve configuration.
</Note>

## Common Parameters

Most filters share these parameters:

<ParamField path="rotation_min" type="float" default="0.085">
  Minimum smoothing factor for rotation (0.005-0.4). Lower = more smoothing at rest.
</ParamField>

<ParamField path="rotation_max" type="float" default="0.218">
  Maximum smoothing factor for rotation (0.02-1.0). Higher = faster response during motion.
</ParamField>

<ParamField path="rotation_curve" type="float" default="4.26">
  Shape of the transition from min to max (0.2-8.0). Higher = stays smooth longer.
</ParamField>

<ParamField path="rotation_deadzone" type="float" default="0.156">
  Suppresses rotation below this threshold in degrees (0.0-0.3°).
</ParamField>

<ParamField path="translation_min" type="float" default="0.085">
  Minimum smoothing factor for X/Y/Z position (0.005-0.4).
</ParamField>

<ParamField path="translation_max" type="float" default="0.218">
  Maximum smoothing factor for X/Y/Z position (0.02-1.0).
</ParamField>

<ParamField path="translation_curve" type="float" default="4.26">
  Shape of the transition from min to max for translation (0.2-8.0).
</ParamField>

<ParamField path="translation_deadzone" type="float" default="1.041">
  Suppresses translation below this threshold in millimeters (0.0-2.0 mm).
</ParamField>

## Troubleshooting

<Warning>
  Before adjusting filter settings, ensure your tracker is working properly and securely mounted. No filter can fix tracking hardware issues.
</Warning>

**View jitters when stationary:**

* Increase minimum smoothing or deadzone
* Check for Brownian/noise contribution in status (Alpha Spectrum)

**Feels laggy during turns:**

* Increase maximum smoothing
* Decrease curve value
* Enable Adaptive Mode (Alpha Spectrum)

**Small movements ignored:**

* Decrease deadzone values
* Check that tracker sensitivity is adequate

**Feels too twitchy/nervous:**

* Decrease maximum smoothing
* Increase curve value
* Increase minimum smoothing

## Next Steps

<CardGroup cols={2}>
  <Card title="Alpha Spectrum" icon="brain" href="/filters/alpha-spectrum">
    Learn about the most advanced filter with predictive heads
  </Card>

  <Card title="EWMA Filter" icon="chart-line" href="/filters/ewma">
    Understand the automatic noise-adaptive filter
  </Card>

  <Card title="Hamilton Filter" icon="compass" href="/filters/hamilton">
    Explore quaternion-based smooth rotations
  </Card>

  <Card title="Accela Filter" icon="gauge" href="/filters/accela">
    Configure velocity-dependent acceleration filtering
  </Card>
</CardGroup>
