Mouse smoothing causes jitter

Bugs that have been investigated and resolved somehow.

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.
User avatar
Marisa the Magician
 
 
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

Post by Marisa the Magician »

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.
dpJudas
 
 
Posts: 2923
Joined: Sat May 28, 2016 1:01 pm

Re: Mouse smoothing causes jitter

Post by dpJudas »

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)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48543
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Mouse smoothing causes jitter

Post by Graf Zahl »

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.
User avatar
Enjay
 
 
Posts: 26441
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Mouse smoothing causes jitter

Post by Enjay »

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? :?:
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48543
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Mouse smoothing causes jitter

Post by Graf Zahl »

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.
User avatar
Enjay
 
 
Posts: 26441
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Mouse smoothing causes jitter

Post by Enjay »

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?
User avatar
Marisa the Magician
 
 
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

Post by Marisa the Magician »

I think even cheap mice nowadays poll at higher rates. Maybe it's time to get rid of this option, then.
Graf Zahl wrote:You misread the code. The 'last' variables are static and only zeroed when being first initialized.
Damn... 15 years of C experience and I somehow had no idea about this. :oops:
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48543
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Mouse smoothing causes jitter

Post by Graf Zahl »

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?
It doesn't interpolate - it evens out the distance per movement step.
User avatar
Enjay
 
 
Posts: 26441
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Mouse smoothing causes jitter

Post by Enjay »

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).
dpJudas
 
 
Posts: 2923
Joined: Sat May 28, 2016 1:01 pm

Re: Mouse smoothing causes jitter

Post by dpJudas »

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.
User avatar
Rachael
Admin
Posts: 13211
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Mouse smoothing causes jitter

Post by Rachael »

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.
Exactly.
User avatar
Rachael
Admin
Posts: 13211
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Mouse smoothing causes jitter

Post by Rachael »

https://github.com/coelckers/gzdoom/pull/1616

I propose removing it entirely.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 48543
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Mouse smoothing causes jitter

Post by Graf Zahl »

Don't forget the menu!
User avatar
Rachael
Admin
Posts: 13211
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Mouse smoothing causes jitter

Post by Rachael »

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.

Return to “Closed Bugs [GZDoom]”