Download

Ways of smoothing noisy values

Hi people of the UE4. Anyone fancying some thinking?

Q: Are there other ways to smooth/soften noisy values other than using interpTo or interpToConstant with previous value being current and new value in target?

Im currently developing a system that can measure acceleration and deceleration of a socket for a character skeletal mesh.
Since you cant get the velocity of a socket Im doing it by taking the


(location - previous location) / worldDeltatime 

to get the speed. Then I take the


speed- previous speed

to get an acceleration vector. That then gets localized to in the same space as the initial socket.

The problem is that the output of that method is very noisy and jagged. On slower accelerations the values go positive/negative very fast. Probably because the speed increase isnt soft.
So what I did try was feeding both current and previous location set commands through a vInterpTo first to kinda smooth the values out. But still the output acceleration is very noisy.

An other Idea I had which Ill try to implement later is base the whole system not on the socket location itself but on an average of the last n frames. So I planned to make a function that gets a value (in this case the position vector of the socket) and a specified number of iterations and then stores the value each tick, and outputs the average for the last n ticks. Then that gets output and used in my acceleration measure system.

So yeah, any ideas you might have, or if you already developed a system that does this stuff in a more elegant and stable way, please help a fella out :slight_smile:

if it is a data stream you are working on, you might need a low pass filter. you can write a simple class on c++…
something like this maybe A simple digital low-pass filter in C « Kirit Chatterjee

Hmmm, this could very well work m8!

Ill try implementing these two formulas and test their difference

SmoothData = SmoothData_prior – (LPF_Beta * (SmoothData_prior – RawData)

EMA = EMA_prior + (Smoothing_Factor * (RawData – EMA_prior)

Thanks for that.