Mouse smoothing causes jitter
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
-
-
- Posts: 3879
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
Mouse smoothing causes jitter
I've had it enabled for many years and thought the constant jittering I experienced was "intentional" as part of some engine limitation. But, as it turns out, that wasn't the case. The thing is, mouse smoothing is broken. The code for it (in PostMouseMove) seems correct if you just skim through it, but on closer inspection, something's clearly not right. It does appear that it tries to blend between the previous and current inputs, but the thing is, the data for the previous input isn't actually stored externally and is always zeroed at the start of the function.
Edit: Honestly, even in an attempt to fix it myself, I've found that it's always jittery. Maybe the whole option should be removed entirely.
Edit: Honestly, even in an attempt to fix it myself, I've found that it's always jittery. Maybe the whole option should be removed entirely.
-
-
- Posts: 2923
- Joined: Sat May 28, 2016 1:01 pm
Re: Mouse smoothing causes jitter
I have never understood the point of mouse smoothing. Why anyone would deliberately introduce additional input lag, especially at lower frame rates, is really beyond me. It is effectively simulating a triple buffering setup with a GPU that falls behind. Horrible!
If it is broken it doesn't really surprise me. Probably nobody enables it?
Why did you enable it? (asking out of curiosity)
If it is broken it doesn't really surprise me. Probably nobody enables it?

-
- Lead GZDoom+Raze Developer
- Posts: 48543
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Mouse smoothing causes jitter
You misread the code. The 'last' variables are static and only zeroed when being first initialized.
Whether the formula itself makes sense is a different story. I always found it useless and counterproductive.
Whether the formula itself makes sense is a different story. I always found it useless and counterproductive.
-
-
- Posts: 26441
- Joined: Tue Jul 15, 2003 4:58 pm
- Location: Scotland
Re: Mouse smoothing causes jitter
I've never really even understood what it is meant to do. I mean, the name probably says it; it smooths mouse movement, but what needs smoothing? How does it smooth it? Why was it not smooth already? How would a mouse that needs smoothing manifest in game? 

-
- Lead GZDoom+Raze Developer
- Posts: 48543
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Mouse smoothing causes jitter
Keep in mind that this option is more than 20 years old. Apparently some old mice benefitted from it. These days I think it's pointless.
-
-
- Posts: 26441
- Joined: Tue Jul 15, 2003 4:58 pm
- Location: Scotland
Re: Mouse smoothing causes jitter
So, perhaps older mice updated less frequently and the mouse would appear to skip across screen in perceptible steps and this is meant to interpolate them?
-
-
- Posts: 3879
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
Re: Mouse smoothing causes jitter
I think even cheap mice nowadays poll at higher rates. Maybe it's time to get rid of this option, then.

Damn... 15 years of C experience and I somehow had no idea about this.Graf Zahl wrote:You misread the code. The 'last' variables are static and only zeroed when being first initialized.

-
- Lead GZDoom+Raze Developer
- Posts: 48543
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Mouse smoothing causes jitter
It doesn't interpolate - it evens out the distance per movement step.Enjay wrote:So, perhaps older mice updated less frequently and the mouse would appear to skip across screen in perceptible steps and this is meant to interpolate them?
-
-
- Posts: 26441
- Joined: Tue Jul 15, 2003 4:58 pm
- Location: Scotland
Re: Mouse smoothing causes jitter
Ah, OK, I can both see how that might have been useful several years ago and I can also see how it could perhaps lead to a laggy or "mushy" feeling mouse when it wasn't needed (which, of course, isn't the same as what is being reported here).
-
-
- Posts: 2923
- Joined: Sat May 28, 2016 1:01 pm
Re: Mouse smoothing causes jitter
Alright, fair enough - this is then the "Enhanced pointer precision" feature in Windows built into ZDoom. Why anyone would do that is also beyond me. It is the checkbox that basically says "Yes, I would like to miss my shots by not making my mouse movements linear" 
Edit: thinking even more about - it is worse than that! The amount of adjustment depends on the frame rate too, if I understand the code correctly. So not only is it not linear anymore, if your FPS is not 100% stable it also varies how much it adjusts it relatively to your mouse movement speed.

Edit: thinking even more about - it is worse than that! The amount of adjustment depends on the frame rate too, if I understand the code correctly. So not only is it not linear anymore, if your FPS is not 100% stable it also varies how much it adjusts it relatively to your mouse movement speed.
-
- Admin
- Posts: 13211
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: Mouse smoothing causes jitter
Exactly.dpJudas wrote: Edit: thinking even more about - it is worse than that! The amount of adjustment depends on the frame rate too, if I understand the code correctly. So not only is it not linear anymore, if your FPS is not 100% stable it also varies how much it adjusts it relatively to your mouse movement speed.
-
- Admin
- Posts: 13211
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
-
- Lead GZDoom+Raze Developer
- Posts: 48543
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Mouse smoothing causes jitter
Don't forget the menu!
-
- Admin
- Posts: 13211
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: Mouse smoothing causes jitter
Oops - pushed. Funny - I tried to remind myself to do that and I scanned the zscript code for it but I forgot the menu itself.