V-sync mouse lag – how to fix it?

V-sync (aka vertical synchronization) was introduced to synchronize frame rendering frequency to the screen refresh rate, which also prevents the “screen tearing” effect when a specific application (game) renders faster than the screen’s native refresh rate allows, resulting in multiple frames being drawn during a single screen refresh.

Since most monitors today use the 60Hz refresh rate (eg. the image is redrawn 60 times per second), it is generally exactly 60 FPS that your game gets limited to when you use V-sync. This of course only applies to systems that are able to render over 60 FPS, there is no point in using V-sync with lower framerates.

However, due to the nature of how V-sync works with the framebuffer, the perceived image drawn by your screen is effectively in the past, which makes your controls feel laggy and unresponsive. Doing some research, I found a simple solution: FPS limiting.

While many games include the option to use V-sync, they rarely offer FPS limiting at the same time (Valve Source engine max_fps works that way and actually has an embedded -1 FPS feature, except in Left 4 Dead). Unlike V-sync that uses a buffer and can save the unnecessary VGA computing power, FPS limiting simply drops the extra frames. The trick therefore lies in using both of these techniques to achieve the perfect situation:

  • FPS is synced to your monitor’s maximum refresh rate.
  • Unnecessary computing power is saved (you don’t need what you can’t see and it may prevent overheating and potentially increase your VGA lifespan).
  • No lag on the user input (mouse, keyboard).
  • No screen tearing effect and smooth rendering.

So how to do that?

Simply by using V-sync AND limiting FPS exactly 1 frame below the screen refresh (eg. 59 FPS for a 60Hz screen). This means that there won’t be anything for the V-sync to buffer ahead, your controls will retain instant response and no VGA power will be wasted.

Now for the tools you need:

V-sync is usually present in most modern gaming titles. If it isn’t for some reason, you should still be able to force it through your adequate VGA drivers (both ATI/AMD and nVidia drivers have such an option).

FPS limiting is a bit more tricky. For instance, FRAPS has such a functionality that hooks over DirectX/OpenGL, but it only takes advantage of it while recording (there is a loop workaround, but it’s quite dirty). Luckily, there are different tools. Probably the best one I came around would be Dxtory (a more advanced video recording program) – it has a very functional FPS limiter and works basically for every game you can imagine up to DirectX 10. NTHUSIM would be another tool with an FPS limiter, but it didn’t work for me as well as Dxtory did (the FPS cap was higher than set, probably an implementation error).

Framerate limiting has other advantages however – Let’s say you play a demanding game on a mediocre system and your framerate fluctuates between 30-50. This feels pretty uncomfortable and disturbs your experience. Since you’re below your screen refresh rate and V-sync can’t help, by setting an FPS limiter to your minimum 30 FPS, the game will feel way smoother and you can adjust to it quickly (many console titles are @ 30 FPS limited for instance). Mind that V-sync also only works in fullscreen applications, therefore FPS limiting is your only friend in windowed mode.

Hope this helps, let me know!

  • emtee

    It should be noted that there is room for even more improvement. Using external FPS limiters, even Nvidia’s driver one adds additional latency due to how these fps limiters are applied. With a bit of luck in the game you play, it offers a built-in limiter which usually prevent this additional lag.

    The Only downside is that engine limiters could be less accurate and in the worst case requires you to screw around with HPET On or off, and/or change Windows timer resolution to finetune the end result (near 59~) and keep testing until there is no fluctuating lag going on.

    Anyone claiming this doesnt or barely work is doing something wrong.

    – NO external limiters
    – FPS cannot deviate too much towards 60 or 57, there is a strict sweetspot

    Im pretty sure the performance on my game is on par with Gsync right
    Now :)

  • Kamuro Kenshi

    you’ve changed my life!!! THX!! BIG THX!!!

  • Chad

    This doesn’t Fix input lag, this fixes additional input lag from the frame buffer. Your still going to have input lag with this fix, I’ve tested this extensively on a relatively good monitor and this is not a cure all for input lag but I definitely recommend anyone reading this to pick up Riva tuner Statistics server, limit your fps to 59 and give it a go.

    I personally cannot play with any input lag, but this is a great fix for people who hate screen tearing with a passion and want a better experience

    • mystrdat

      Which is exactly what it claims to be doing? Fixing v-sync input lag by not buffering frames ahead? If your input lag comes from a different source then of course this will not help in any way. Not sure of your point.

  • Dani .

    Triple buffer.

  • Sheen

    Anyone know WHY this is necessary? Vsync alone is supposed to limit the FPS to your refresh rate without input lag. Why doesn’t it work properly on so many Source engine games anymore? I say anymore because I did NOT have this problem playing Team Fortress 2 several months ago on the exact same hardware and OS. Now, I do, as well as in Counter-Strike:GO and Natural Selection II. NSII doesn’t have a max_fps setting I can find, leaving the game entirely unplayable.

    Thanks for the write-up though.

    • mystrdat

      The problem only exists when your rendering power is higher than your refresh rate and depends on the ratio – in other words – if your PC can render let’s say 90 fps and you use V-sync on a 60Hz screen, visual input delay will occur. This is because of how v-sync works by itself with the framebuffer – it renders frames to your screen that actually happened in history, hence you feel your mouse and keyboard input (or any other input for that matter) delayed. max_fps drops frames entirely before v-sync is applied (at least I believe so), so the effect never happens. Triple buffering exists as a v-sync feature to mitigate the problem somewhat, but it will still be present. If this is unbearable for you, simply don’t use v-sync, if the possible screen tearing is more bearable. Or you could use some of the software I mentioned above to limit your fps through a 3rd party in pretty much any game. I am not aware of any other Source game where max_fps wouldn’t work aside Left 4 Dead, but haven’t tried in CS:GO.

  • since faster world updates allow for less interpolation.

  • matt

    i’ve been using this method for months.¬† it rilly rilly works.

  • on0bi

    You should mention that the best fps cap should follow this formula:

    (refresh rate * 2) + 1 = cap
    (60hz * 2) +1
    fps_max 121

    i’ve found it to be very good and i cap all my games that allow it to 121

    • mystrdat

      Thanks for the comment. This post was maily aimed at keeping V-sync enabled in any game (not just Source with fps_max) without the laggy controls effect, but that aside – what would be the reason for your specific formula if I may ask?

    • Why not just 60, if your monitor refreshes 60times per second why would you try to redraw the image twice as fast? And I don’t even mention that human eyes are not able to see this fast. I can see forefer alright, but not this fast.

      • mystrdat

        One reason I can think of, which seems to be actually engine and implementation dependant (http://goo.gl/OfbVC), is input (keyboard, mouse) refresh rate tied to the FPS rendered. However, as professional StarCraft 2 players can generate ~15 actions per second when pushing out their max, it should not be a concern anyway. Another reason would be 60-100 tick servers (TF2, CS..) since faster world updates allow for less interpolation. When 100Hz screens become more widespread, I think 100 FPS/tick will become a golden number really in it’s full potential, although 60 is perfectly enough as is.