How VSync works, and why people loathe it

Discussion in 'Video Cards' started by Arkalius, Jul 18, 2005.

  1. phide

    phide [H]ard as it Gets

    Messages:
    16,695
    Joined:
    Jun 11, 2004
    All OpenGL titles should support triple buffering -- no specific game support required. Just enable it and go, though some games have in-game settings where you can enable it, so enable it there if possible. It's also possible to force triple buffering in D3D games on most hardware.

    As I understand it, sort of.
     
  2. KillrBuckeye

    KillrBuckeye n00b

    Messages:
    2
    Joined:
    Jun 5, 2006
    I enabled VSync in Crysis, and it seemed to fix my tearing problem. What's odd is that according the in-game framerate counter, I am now often locked at 40 FPS. My monitor's refresh/polling rate is 60 Hz, so doesn't this imply that the triple buffering is enabled by default? (I never changed this setting).
     
  3. KillRoy X

    KillRoy X Gawd

    Messages:
    755
    Joined:
    Aug 15, 2004
    Tearing has been the worst in Bioshock and Crysis. Completely horrible. I have yet to put Vsync on in Crysis, because I can't sacrifice my already pitiful framerates.
     
  4. Dan_D

    Dan_D [H]ard as it Gets

    Messages:
    53,558
    Joined:
    Feb 9, 2002
    Same here.
     
  5. Inu

    Inu [H]ard|Gawd

    Messages:
    2,023
    Joined:
    Jun 29, 2004
    After playing TFC for so long i noticed anything that even barely effected my performance. When vsync was turned on it felt like i was using my mouse underwater. Even tho i had 85fps.
     
  6. jstockton858

    jstockton858 [H]Lite

    Messages:
    92
    Joined:
    Jun 6, 2002
    I agree with this because when I have vsync enable at 60fps, I feel slower and my shooting response is slower. I just can not play with it on especially after years without it. Perhaps thats why I am banned from servers for shooting "too fast"
     
  7. Dan_D

    Dan_D [H]ard as it Gets

    Messages:
    53,558
    Joined:
    Feb 9, 2002
    I've never experienced any significant input lag from enabling V-Sync. There are some games where I can feel it such as UT2004, but the difference wasn't massive. I was able to get used to it in short order. I still kickass in terms of scores so I don't think it effected my gaming prowess too much.
     
  8. belmicah

    belmicah Gawd

    Messages:
    853
    Joined:
    Oct 10, 2005
    I run Crysis with Vsync enabled @ 1680x1050 everything maxed with Triple Buffering. I don't get GREAT frame rates (~20-25) but it feels very playable.

    I absolutely hated the tearing.
     
  9. stoney_titan

    stoney_titan [H]ard|Gawd

    Messages:
    2,018
    Joined:
    Feb 19, 2007
    Same boat. Bioshock had horrific tearing, along with almost every game I've played though. :p I guess I just notice it a lot more then most. Because seriously, I don't know how some can ignore it.
     
  10. Lucky007

    Lucky007 [H]Lite

    Messages:
    105
    Joined:
    Nov 26, 2007

    Not sure if this has been answered yet but heres how you turn on triple buffering for an Nvidia card.


    [​IMG]

    [​IMG]
     
  11. Lucky007

    Lucky007 [H]Lite

    Messages:
    105
    Joined:
    Nov 26, 2007
    Turning on Vertical Sync and Triple Buffering actually improves performance when it's running below your monitors refresh rate. Nvidia claims this in their drivers.

    [​IMG]
     
  12. AngrySheep

    AngrySheep n00b

    Messages:
    35
    Joined:
    Sep 3, 2006
    when i use triple buffering, the tearing returns. anyone else have this problem? WoW, HL2 are really bad. so i run vsync only alot. depends on the game i guess
     
  13. Lucky007

    Lucky007 [H]Lite

    Messages:
    105
    Joined:
    Nov 26, 2007
    You have to run triple buffering in conjunction with vertical sync.
    Did you try that?
     
  14. AngrySheep

    AngrySheep n00b

    Messages:
    35
    Joined:
    Sep 3, 2006
    lol, yea sorry, thats what i meant. some/ most games that i run vsync with cant run triple buffering without the tearing coming back.
     
  15. Deusfaux

    Deusfaux Gawd

    Messages:
    756
    Joined:
    Apr 11, 2006
    So this is no built in triple buffering support in the Source engine games right.?


    How would I enable it for them?
     
  16. Wrecklusive

    Wrecklusive Limp Gawd

    Messages:
    467
    Joined:
    Jul 17, 2009
    Bump for linking to this thread a lot. I think the information is still relevant for CRTs. Not sure about LCDs.
     
  17. K -

    K - n00b

    Messages:
    57
    Joined:
    Jul 6, 2010
    Can anyone tell me whether anyone gets any input lag (mouse) and also why it happens when vsync is enabled?
    apparently i read from another post that input lag (mouse) will be diminished only if the game FPS is lower than the refresh rate or something like that. Is this true?


    What is the difference of having Vsync turned on compared to having a Screen Refresh Lock and an FPS limiter to have the same amount?
     
    Last edited: Jul 6, 2010
  18. keenan

    keenan 2[H]4U

    Messages:
    2,695
    Joined:
    Aug 5, 2009
    I don't get it myself, or it doesn't bother me as I'm a pretty casual gamer, but the reason it happens is because the frame that is shown is drawn right after the previous one is shown and then saved to be displayed at the next opportunity (the next blanking interval). Once the frame has finished drawing though the graphics engine does basically nothing, it's just waiting around for the back buffer to clear (ie. the frame to be displayed) before it can start drawing to it again. If you're running a fast machine and maybe could get 2x the refresh rate in FPS, that means the video card had time to draw a whole 'nother frame while it was just waiting around for the sync interval. So if you had vsync off in that situation, you'd see a frame slightly newer than with vsync on.

    I honestly am skeptical that people can actually perceive this, but it's the only explanation I can come up with to explain it if they do.

    I don't know what you mean by a screen refresh lock, that sounds like vsync to me. Just limiting FPS doesn't synchronize the frame drawing with the refresh rate, so you still get tearing, but all the problems with delaying frames as well.
     
  19. LuminaryJanitor

    LuminaryJanitor 2[H]4U

    Messages:
    2,340
    Joined:
    Oct 26, 2005
    It's equally relevant for all kinds of displays.

    By the way, the OP is way off on a couple of key points (tears do not result from partially drawn frames, nothing is ever physically copied between buffers, and the section on double buffers is mostly nonsense). If you want a link to explain tearing, VSync and triple buffers, you're better off with this one.

    Mostly because of the artificial delays it introduces to the rendering process. The game is forced to wait before starting on the next frame, hence is forced to wait before processing input (assuming the engine doesn't use its own independent tick rate). Triple buffering never delays rendering, so the problem is minimised.

    As the name implies, without VSync it's not synchronised, so it still tears. It might be rendering at 60fps and refreshing at 60Hz, but there's nothing stopping it from finishing a frame and flipping the buffer while the last frame is still being sent to the display.
     
  20. reaper12

    reaper12 2[H]4U

    Messages:
    2,229
    Joined:
    Oct 21, 2006
    Nice article and well written, but, for FPS shooters vysnc on is just horrible!!!

    Some guys have touched upon it already and whoever said it's like using your mouse underwater has got it perfectly right!! I tried it for a month in different games to be sure that I got used to it, but, I couldn't, the mouse cursor on screen always seems to be behind my actual mouse movements. It feels like I am waiting for the mouse all the time.

    To the guy who said that he was a bit skeptical that peope can actually notice this, well, I feel the same way, just from the opposite side!! I can't believe that people who play FPS's with vsync on don't notice the lag.
     
  21. K -

    K - n00b

    Messages:
    57
    Joined:
    Jul 6, 2010
    Thanks for all the answers guys :)

    Are there any discussion on how to minimize input (mouse) lag when using Vsync in this forum with solid proofs/outcome?
     
  22. keenan

    keenan 2[H]4U

    Messages:
    2,695
    Joined:
    Aug 5, 2009
    Triple buffering. It means the rendering engine can draw continuously at full speed (processing input continuously as well, if that's tied to rendering), and the newest complete frame is always shown, minimizing display lag.
     
  23. PrincessFrosty

    PrincessFrosty [H]ardness Supreme

    Messages:
    5,905
    Joined:
    May 6, 2009
    A very good explination overall, but some minor inaccuracies, everything is good up until this point where you give an example.

    Remember that if you match your frame rate with your refresh rate, for example 60fps on a 60hz monitor you're going to tear on average once per refresh, that is to say each refresh will be made from 2 composite images and will have 1 tear line.

    Your reasoning is close, when you talk about a tear line being introduced one in every X many frames, but you're talking about 1 extra tear line, so each frame will tear once and then every so many refreshes you'll actually tear twice on that refresh (refresh comprised of 3 images)

    It should also be noted that you tear with frame rates that are lower than your refresh rate, it just happens once every X refreshes, with a refresh of 60hz and a frame rate of 30fps you're only likely to tear on 1/2 of the refreshes. It's very hard to notice but it does happen.

    Double buffering wasn't designed to mitigate tearing, it's just the way all video cards render, they cannot render straight to the monitor as the draw to the buffer isn't instant, so they draw to a so called back buffer which is not in use, then simply swap the back and front buffers, which can be done instantly.

    More or less right but actually the way we describe and see vsync in operation, that is over the periods of seconds and things like average frame rataes, it's a bit false in a sense. What is actually happening low level is vsync is looking at an individual frame render time, if the frame hasn't been renderd in time for the next refresh then the buffer isnt swapped and the same frame stays in place for another refresh, essentially displaying the old frame again (one unique frame being displayed for 2 full refrehses)

    What usually happens is frame render time stays approximately the same because in 1/60th of a second not much changes in the game, so we tend to get a whole row of frames that are displayed either once per refresh (@60hz thats 60fps) or each frame not quite being ready in time (30fps). Our real average for any one second could actually be in between 30fps and 60fps if we were to rapidly change the load on the graphics card, we might get one new frame for each refresh for the first 20 frames in an example second, then say an explosion goes off and we have lots more stuff to draw, then each frame might take more time to render than the refresh time so we duplicate each frame twice for the remainder of the second, giving us 20 frames in 20 refreshes then in the last 40 refreshes only 20 unique frames giving us an actual unqiue frame rate of 40fps.

    Looking at vsync in terms of FPS (an average) help people understand the concept a bit easier but low level it's actually operating on a frame by frame basis.

    This is true in most practical terms but remember that if the render time is swapping between 60 and 30, or any of these values within a given second then your unique frames in that second will be somewhere between these values. Frame rate counters report frame rates locked at 60/30/20 etc because the render time for each frame tends to stay approximately the same to the previous one unless the load on the graphics card changes very suddenly, and certainly isnt like to change back/fort rapidly within one second.

    You could write an game to have a very render heavy shader that is only applied every other frame causing every odd frame to take longer to render (longer than 1 refresh time) and so only half of the frames being duplicated similar to my example above, and you'd have 40fps.

    Furthermore when vsync is duplicating frames you're getting a larger delay between your input from the mouse/keyboard/controller and you actually seeing that response on screen, the delay is twice as much if vsync is repeating every frame (1/2 the frame rate) which a lot of people percieve as "input lag", it makes a lot of FPS games basically unplayable.

    Exactly, and most games dont maintain steady frame rates now a days, it can be up and down a lot, and since people want eyecandy and sacrafice frame rates, we often see an average frame rate which is something like 60fps but the min/max (peak/trough) values could easily be 30fps and 90fps

    this is where I tend to disagree actually, the idea that you cannot see an FPS higher than your refresh isn't entirely true, and this is a bit controversial...so bear with me.

    If you're rendering at say 180fps with a 60hz screen (for easy maths) it means you get refreshes that are compromised of 4 frames on average, 60 goes into 180 3 times, however the start of the frame and start of the refresh arent sycned, almost always we're starting a new refresh with the tail end of an old frame.

    At the end of a refresh we're left with a composite image between 4 frames, the top part is the oldest, this represents the game state nearly 1 refresh ago, the next bit down is a bit more up to date, and so on until the bottom where the last part of the refresh is based on very new information.

    We still have 60 refreshes because our monitor cannot adaptively provide a greater refresh rate (wouldnt that be nice!) however in our refreshes some parts of the screen, the lower areas, have information which is newer. I personally think that is of some benefit.

    For example if an object is moving quickly across the scene, and the refresh tears through the middle of it, we can in one frame infer direction of movement and speed of movement of that object without seeing the frame before it or after it. Now we dont play games like that, but I personally believe our eyes pick up on that and thats helpful to gamers, especially those who play competatively.

    Yes very, I think you did a good job, a few inaccuracies but for the purpose of explaining how it works to the average gamer it's very well written, good job.
     
    Last edited: Jul 8, 2010
  24. Matrices

    Matrices [H]ardness Supreme

    Messages:
    5,256
    Joined:
    Feb 5, 2003
    I've been running all my games with VSync and Triple Buffering enabled (D3D Overrider utility) for some time now. Maybe it would be unnecessary on 120hz monitors but for 99% of LCDs out there, it eliminates tearing when the game tries to push above 60 FPS. Feels smooth as silk to me.
     
  25. LuminaryJanitor

    LuminaryJanitor 2[H]4U

    Messages:
    2,340
    Joined:
    Oct 26, 2005
    That's assuming it takes a full 16.7ms to send the frame. If it's refreshing at 60Hz and rendering at 60fps, but only taking 10ms to send out each frame, then it's got a 6.7ms window each refresh interval where it can flip the buffers without causing a tear (so on average, it'd only tear 60% of the time).
     
  26. kllrnohj

    kllrnohj [H]ardness Supreme

    Messages:
    6,846
    Joined:
    Apr 1, 2003
    Normally, yes, but it IS possible that the 60fps happens to line up perfectly with the refresh rate ;)

    Just a minor correction, but video cards *CAN* render with just a single buffer, it just looks really, really bad. The reason for double buffering is to prevent you from seeing the card doing the drawing.

    I disagree that you would be able to think and understand the difference, or that you would be able to notice the updated sections independent of the tears.

    But you still only get 60 complete frames either way - just that the frames are then composed of multiple snapshots of time instead of a single snapshot. :p
     
  27. SKL1

    SKL1 [H]ard|Gawd

    Messages:
    1,028
    Joined:
    May 25, 2006
    120Hz Monitor = no tearing and no need for vsync ;)
     
  28. reaper12

    reaper12 2[H]4U

    Messages:
    2,229
    Joined:
    Oct 21, 2006
    Don't know, I have tried everything to get rid of the mouse lag with vsync on. Somebody mentioned how smooth it is with vsync on, yeah, it's smooth as silk, but always way behind the action!!

    I don't know any half decent FPS gamer that has vsync on.
     
  29. kllrnohj

    kllrnohj [H]ardness Supreme

    Messages:
    6,846
    Joined:
    Apr 1, 2003
    That isn't even close to true. You can always get tearing if you don't have vsync enabled.
     
  30. bexamous

    bexamous [H]ard|Gawd

    Messages:
    1,670
    Joined:
    Dec 12, 2005
    For mouse lag, try lowering MaxFramesAllowed? Thats the OGL reg key, not sure if D3D has its own... I assume it'd be control panel somewhere?
     
  31. IRSmurf

    IRSmurf 2[H]4U

    Messages:
    2,312
    Joined:
    Apr 1, 2007
    I've got a 120hz monitor LCD and VSYNC... does it sound like I'm covered?

    I read through each post on the first page and the last page, this morning. It sounds like I always want Triple Buffering Enabled, too, when available.
     
  32. K -

    K - n00b

    Messages:
    57
    Joined:
    Jul 6, 2010
    I actually found a cure for this.

    From the NVidia control panel, I enabled Vsync (120Hz) with Triple Buffering and set max frames to render from 3 (default) to 0. No more input lag with Vsync in a medium crowd map (12 people), however, when I get to a map with around 20 people, it hurts the performance, I get graphics stutter (not really a lag just stutter). I would believe the reason is because my actual game Frame Rate drops below 120 (2/120 or 3/120) which goes to 60 or 40. Can anyone explain any reason for the stutter in crowded map? Would enabling max frame to render to 1 or 2 cure the graphic stutter in a crowded map?

    I also hope PrincessFrosty can provide me an answer for this.
     
  33. bexamous

    bexamous [H]ard|Gawd

    Messages:
    1,670
    Joined:
    Dec 12, 2005
    "Max frames to render" is probably the same thing as the MaxFramesAllowed OGL key. I'd try 0 & 1. Actually with Triple buffering, wonder if that would require maxframes 1 to work optimally.
     
    Last edited: Jul 8, 2010
  34. serpretetsky

    serpretetsky [H]ard|Gawd

    Messages:
    1,685
    Joined:
    Dec 24, 2008
    i've only used triple buffering once, and it definitly wasn't a positive experience (maybe just the game sucked at doing it...)

    Basically i had just downloaded left4dead, and apparently triple buffering is enabled by default. Game felt laggy (not ping, not fps, but input lag, like when you're using a crappy lcd tv to game on and it's not on "game mode").
    Took me about 20 minutes of playing with all the video options till i figured it out was just triple buffering slowing it down. Felt really responsive after i turned it off.

    Again, that's only one game, haven't tried it anywhere else.
    It's a shame though, because im not exactly a fan of screen tearing either, looks like 120hz monitors is the way to go.
     
  35. K -

    K - n00b

    Messages:
    57
    Joined:
    Jul 6, 2010
    read what i posted above. change maxrenderframe to 0 or 1 (less than 3 by default). this can be done from the Nvidia control panel. Enable Vsync (triple buffer) and it should be fine.
     
  36. Sojuuk

    Sojuuk 2[H]4U

    Messages:
    3,010
    Joined:
    Jan 18, 2003
    my problem with vsync is the input lag it creates in certain games not the fps limitations.
     
  37. serpretetsky

    serpretetsky [H]ard|Gawd

    Messages:
    1,685
    Joined:
    Dec 24, 2008
    can't find such an option in ati ccc.
     
  38. cannondale06

    cannondale06 [H]ardForum Junkie

    Messages:
    16,180
    Joined:
    Nov 27, 2007
    turning on triple buffering from the Nvidia control panel has NO impact on DX games. you have to use some third party app to force it on for non OpenGL games.
     
  39. PrincessFrosty

    PrincessFrosty [H]ardness Supreme

    Messages:
    5,905
    Joined:
    May 6, 2009
    The buffers dont flip at a fixed rate matched with the monitor refresh, they flip once the frame has been drawn, the tearing comes when the monitor is mid-refresh and the buffer flips, not the buffer flipping as the graphics card is drawing to it.

    I think there is a minor delay between refresh on the screen, with CRTs there was a small delay where the cathode ray tube would reposition from the bottom of the screen to the top ready to start the new draw, however I believe it takes most of the 16.7ms to actuall draw the frame. If a 60hz monitor could draw the entire screen in say 8ms instead of 16.7 then they'd sell it as a 120hz monitor

    But fundamentally Its possible for the buffer to flip as the screen is between drawing in which case you dont get a tear, but thats very unlikely.

    Yes it probably happens once every X many hundred refreshes or so, but is unlikely to occur repeatedly, you'd have to be very lucky ;)

    Sure, my point was that double buffering wasnt designed to stop tearing.

    You dont understand it frame by frame but overall movement of objects through the scene is going to seem smoother because you're seeing the scene over a period of time rather than just a snapshot. Kind of like real motion blur captured by cameras with long aperture times, film at 24-25fps seems smooth because each frame is capturing information of the world over the period of the frame which visually shows as motion blur, where as traditional rendering shows snapshots and needs a higher frame rate to seem smooth.

    Yes you still only get 60 complete frames/refreshes, but you see more information than a single frame is capable of telling, as I said you can infer direction and speed of movement of objects in the scene with one frame. Good for fast moving targets or rapidly chaning viewport direction.

    It also helps minimize "input lag" where you essentially getting multiple bits of feedback per refresh rather than just 1, all FPS gamers who have tried vsync know just how awful the input lag feels, it's still noticeable for me even when getting 60 unique frames per second.

    Nope.

    FPS games are basically unplayable at anything other than casual level with vsync on, the latency between input and feedback is too long, for a single button press thats not really that important but for mouse aiming where your brain takes continous feedback from the screen and uses that information to subtly correct your aiming, that can no longer happen.

    Tripple buffering primarily helps with frame rate, not "input lag". It allows the video card to remain busy when it might otherwise just be idle. It's also already been mentioned that tripple buffering in the driver options only applies to OpenGL games, almost all modern games are DirectX based so this option doesn't work. You can force it through other 3rd party tools I believe.

    The input lag feeling is introduced when a frame is being displayed and the video card is drawing to a back buffer but the frame isn't drawn in time and the same buffer has to remain in place during the next refresh (same frame being displayed twice in a row)

    Nothing can solve the input lag feeling, its inherent with vsync, vsync works by delaying rendered frames from reaching the monitor until the time is right, that delay is what we commonly describe as input lag. The only way to minimize it is to run a frame rate high enough to maintain your monitors refresh rate at all times, for 60hz you probably want an average of 90fps. Or invest in a 120hz monitor and a graphics card that can spit out something like 150-160fps average and vsync to 120hz, that would feel a lot less laggy.
     
  40. reaper12

    reaper12 2[H]4U

    Messages:
    2,229
    Joined:
    Oct 21, 2006
    Nice post PrincessFrosty. ^^

    Explains everything perfectly. I agree with you completely about the lag, nothing ever worked for me. I just can't understand how anyone can play FPS games with vsync on and not notice it :)

    K, I had tried that before about changing the max-frames and it didn't work for me at all. No matter which value I used.

    back to the old drawing board K ;)