Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To use or not to use VSync

I'm deciding on whether or not to use VSync for a new game that I've been developing using OpenGL. The goal is to provide the user with the best gaming experience, and to have a good balance between performance and quality. This game is designed to run on both older (Intel/Netbook) computers and newer (NVidia/i7 desktop) computers. I am aware that the purpose of VSync is to prevent tearing, however; I have never been able to reproduce this tearing issue even with VSync turned off. To provide the best experience; should VSync be turned on, or off?

like image 778
bbosak Avatar asked May 07 '11 19:05

bbosak


3 Answers

There are many things that can be said about this issue. Let me count the way:

  1. if you don't see tearing, you're likely vsync'ed, even if you think you're not. Reasons may vary, but ultimately, swapping buffers in the middle of the frame is very noticeable if any movement is happening (one reason might be that you're not configured to flip buffers, so something has to do a copy of your framebuffer)
  2. vsync on has noticeable artifacts too. Typically, it creates frames that display for a variable amount of time, more tied to the display refresh rate than your rendering rate. This can create micro-stuttering, and is very hard to control, as you don't know when you generate your frame which tick it will display at, so, you can't compensate for motion artifacts. This is why some people try to lock their rendering speed to the refresh rate. Always render at 60fps (or 30fps), time update is time += 16.7ms John Carmack has been asking for a mode that does "vsync at 60Hz, but don't sync if I missed the deadline" for what I assume would be this reason.
  3. vsync on saves power (important on netbooks)
  4. vsync off reduces input latency (when your input is 3 frames before display, it can start to matter). You can try to compensate some of that, but ultimately, it is hard to inject input updates at the very last minute.

So the bottom line answer is that there is no perfect answer. It really depends on what matters more for your game. Things you need to look at: which framerate you want to achieve, how much input latency matters, how much movement is there in the game, is power going to be a concern.

like image 195
Bahbar Avatar answered Nov 17 '22 12:11

Bahbar


For the best user experience, place an option in your menu to turn VSync on/off. This way the user can decide. You might not be able to reproduce tearing, but it's definitely a real issue on some systems.

As for what should be the default setting, I'm not sure, I think it's your choice. I prefer to have vertical sync off by default because it reduces performance a bit when enabled and most people don't recognize the tearing or don't care about it, but there are good reasons to enable it by default, too.

like image 24
schnaader Avatar answered Nov 17 '22 12:11

schnaader


I believe the default for VSync should be on (based on all my gaming, not programming experience :) ). Just because you don't see it, doesn't mean you shouldn't follow a good practice.

  • maybe you can't stare as closely at the screen as some other gamer
  • maybe when you see a little tear you are not as annoyed as some gamers
  • maybe your specific screen hides tear better than other screens would

And as schanaader mentioned, typically games would leave vsync as a configuration option somewhere in the video settings menu. Default should still be "on" for those that don't know what vsync means, and if the user is knowledgeable enough, they have the option of tweaking it to see what the difference is

like image 2
DXM Avatar answered Nov 17 '22 13:11

DXM