Skip to content

Reconstructor

X9VoiD edited this page May 18, 2021 · 19 revisions

About

Restores original data from smoothed data with 100% accuracy when the smoothing algorithm along with its parameters is perfectly known.

A mathematically perfect "anti-hardware-smoothing."

Installation

OTD -> Plugins -> Plugin Manager -> Reconstructor -> Install

Configuration

  • EMA Weight - Range: [0 - 1]

Higher values means less effect on input. 1 means no effect.

Click here for steps to achieving optimal configuration.

Technical Details

More information about moving averages can be found here.

How it works

Tablets with smoothing employ some form of noise reduction to improve drawing experience at the cost of some latency. Reconstructor works by assuming that the smoothing algorithm done by the tablet's hardware is some form of moving average.

As a sidenote, hawku's smoothing is a form of exponential moving average.

For the following equations, we will have to define several variables as the following:

is the smoothed data

is the original data

is the amount of samples to consider, or alternatively, the window of the moving average

is the weight applied by exponential moving average (EMA)

Reverse MA

This is removed as of v0.2.2, but will still be included in explanations for the sake of showing that we can indeed retrieve the original data from a smoothed input on various algorithms

Math

Moving average (MA) is defined as:

And the following is the derivation process to get back:

Code

private static Vector2 ReverseMAFunc(IEnumerable<Vector2> trueHistory, Vector2 input, int window)
{
    Vector2 sum = new Vector2();
    foreach (var item in trueHistory)
        sum += item;

    return (input * window) - sum;
}

Reverse EMA

Math

Exponential Moving Average (EMA) is recursively defined as:

And the following is the derivation to get back:

Code

private static Vector2 ReverseEMAFunc(Vector2 currentEMA, Vector2 lastEMA, float weight)
{
    return ((currentEMA - lastEMA) / weight) + lastEMA;
}

Optimal Configuration

A good starting point is Reverse EMA 0.5.

@AbstractQbit

Right now the best you can do when finding EMA weight is try and find a minimal value that doesn't overshoot. You can test overshoot by placing some object with an angle on the tablet, holding it firmly and ramming the corner with your pen at a high speed, preferably in a way that makes pen tip stop suddenly. If the cursor on screen bounces back when stopping, it overshoots.

  • Set EMA Weight to 0.5
  • Test for overshoot
  • If overshooting, increase EMA Weight
  • If undershooting (the feeling of smoothing is still there), decrease EMA Weight
  • Repeat steps 2-4 until satisfied

Acknowledgement

Big thanks to InfinityGhost for the initial idea about reversing the hardware smoothing itself instead of compensating for it through predictions.

VoiDPlugins

Experimental
Filters
Output Modes
Bindings
Clone this wiki locally