垂直同步(Vsync)是您会在大多数PC 视频游戏(PC video games)中看到的选项,有时甚至在其他应用程序中也会看到。但什么是垂直同步(Vsync)?它有什么作用?你应该打开还是关闭它?
这个问题的答案很复杂,但是一旦您了解了Vsync的用途,您就会知道何时打开或关闭它。
什么是垂直同步?
您需要知道的第一件事是您的显示器每秒可以显示一定数量的离散图像。这被称为刷新率(refresh rate),这是显示器可以用新的东西完全刷新屏幕上的图像的次数。
如果您还不知道,屏幕上运动图像的错觉是通过快速显示一系列静止图像而产生的。每张图片都显示了不同时间段内的主题。您在电影院观看的大多数电影都是以每秒 24 帧的速度拍摄的。因此,您会看到每秒显示 24 个时间片。
还有大量以每秒 30 和 60 帧的速度录制的内容。例如,运动相机(Action camera)镜头通常以每秒 60 帧的速度录制。
一秒钟内可以显示的独特帧越多,运动就越平滑和锐利。您的大脑将这些帧合并在一起,并将其视为动态画面。
在计算机系统中,GPU(图形处理单元)准备要发送到显示器的帧。但是,如果显示器由于仍在绘制前一帧而尚未为新帧做好准备,则可能会导致不同帧的部分同时显示的情况。Vsync旨在通过将来自GPU的帧同步到显示器的刷新率来防止这种情况。
典型刷新率
最常见的显示刷新率是 60Hz。也就是说,每秒刷新 60 次。大多数电脑显示器和电视至少提供这么多。
您还可以购买各种刷新率(refresh rates)的电脑显示器,其中包括:75 赫兹、120 赫兹、144 赫兹、240 赫兹和 300 赫兹。可能还有其他奇怪的数字,但这些都是典型的,在专业游戏系统之外,更高的刷新率很少见。
电视几乎都是 60 Hz 单元,其中120 Hz电视机现在与支持该刷新率的最新一代游戏机一起进入主流市场。
匹配帧率(Frame) 和刷新率(Rates)_(Rate)
屏幕的刷新率不必与内容的帧率完全匹配。例如,如果您在 60Hz 的显示器上播放每秒 30 帧的视频,那么您只需要以 60Hz 的频率显示两个相同的帧,总共 30 个不同的帧。
24fps 的素材带来了挑战,因为 24 不能整齐地分成 60。有不同的方法可以解决这个问题。一些屏幕使用一种称为“下拉”的视频转换形式,以以与预期略有不同的速度运行内容为代价来补偿不匹配。
许多现代显示器也可以切换到不同的刷新率。因此,电视可能会切换到 48 Hz 甚至 24 Hz 以获得与 24fps 素材的完美同步。120Hz电视(TVs)不必这样做,因为 24 均分为 120。
何时使用垂直同步
对于视频游戏,帧的生成不像电影或视频那样有序。在没有任何限制器的情况下,CPU、GPU和游戏引擎会尝试生成尽可能多的帧。但是,由于游戏引擎对这些组件施加的工作量可能会有所不同,因此帧速率可能会波动。
如上所述,当GPU发送的帧与显示器的刷新率不同步时,您会看到屏幕撕裂(screen tearing)的感觉,图像的不同部分没有对齐。
当您激活Vsync时,您的GPU仅在监视器准备好绘制新帧时发送要显示的帧,这也有效地限制了帧的渲染速率。但这实际上会导致另一个问题,即帧是如何“缓冲”的。接下来,我们将讨论两种常见的帧缓冲类型。
双缓冲与三缓冲垂直同步(Versus Triple- Buffered Vsync)
“缓冲区”是一个内存区域,当其他设备或进程准备好时,它被指定为等待读取的区域。当您的GPU渲染一帧时,它会被写入缓冲区。然后屏幕从该缓冲区读取帧来绘制它。
所谓的“双缓冲”是当今的常态。有两个缓冲区,轮流充当“前”和后“缓冲区”。显示器从前缓冲区绘制帧,而GPU写入后缓冲区。然后两个缓冲区交换角色并重复该过程。
如果没有Vsync,两个缓冲区可以随时交换。因此屏幕可能会在帧中绘制每个缓冲区的一部分,从而导致撕裂。当您打开Vsync时,这种撕裂确实会消失。但是,如果GPU未能在 1/60 秒内完成对后台缓冲区的写入,则会跳过该帧。这导致每秒有效 30 帧。
除非您的计算机可以始终如一地每秒渲染 60 帧,否则您可能会遇到锁定的 30fps 或在 30 到 60 之间快速摆动的帧速率。
三重缓冲(Triple-buffering)添加了第二个后缓冲区,这意味着总是有一个帧准备好交换到前缓冲区,这使得在 60 Hz 屏幕上可以有奇数,例如每秒 45 或 59 帧。如果您可以选择,三重缓冲始终是一个不错的选择。
增强的垂直同步类型
显卡制造商继续努力解决由屏幕撕裂引起的屏幕撕裂和其他伪影问题。每个主要制造商都提出了Vsync的高级版本,试图提供所有优点而没有缺点。
Nvidia有AdaptiveSync和FastSync,它们都有自己的Vsync智能方法。前者仅在游戏的帧速率等于或高于刷新率时才会打开Vsync 。如果它低于该值,Vsync将被禁用,从而消除缓冲区延迟。后一种解决方案更好,因为它支持三重缓冲并提供最高帧速率而不会撕裂。
AMD具有增强同步(Sync),类似于AdaptiveSync。
垂直同步与可变刷新率
Vsync有一个强大的替代方案,称为可变刷新率。Nvidia 的技术被称为G-Sync,AMD 开发了FreeSync,但它已免费开放供任何人使用。
这两种技术都可以让显示器和GPU以接近完美的精度同步帧的方式相互通信。换句话说,这里解决 了Vsync的所有缺点。(Vsync)
主要的警告是显示器本身必须支持该技术。很少能找到同时支持这两种标准的显示器,但Nvidia最近让步并为某些显示器添加了FreeSync支持。您也可以尝试在Nvidia未列入白名单的显示器上激活FreeSync,但在某些情况下结果可能不是很好。
因此,让我们总结一下您需要了解的有关使用Vsync的知识:
- 如果您的游戏无法维持等于或高于显示器刷新率的帧速率,请启用三重缓冲或降低刷新率。
- 如果您的GPU提供更高级的Vsync版本,那么值得一试。
- (G-Sync)如果您可以访问G-Sync和FreeSync ,它们是 Vsync 的理想替代品。(FreeSync)
- 如果您希望在竞技游戏中获得最小的输入延迟,如果可变刷新不可用,请关闭Vsync并忍受屏幕撕裂。
这些是Vsync的基础知识。现在走出去,享受无泪游戏体验带来的乐趣。
What Is Vsync and Should You Use It?
Vsync is an option that you’ll see in most PC video games and sometimes even in other applications. But what is Vsync? What does it do? Should you switch it on or off?
The answer to this is complicated, but once you understand the purpose of Vsync you’ll know when to switch it on or leave it off.
What Is Vsync?
The first thing you need to know is that your monitor can show a certain number of discrete images every second. This is known as the refresh rate, which is how many times the monitor can completely refresh the image on-screen with something new.
If you don’t already know, the illusion of moving pictures on a screen is created by rapidly displaying a sequence of still images. Each image shows the subject in a different slice of time. Most movies you watch in the cinema are filmed at 24 frames per second. So you see 24 slices of time shown within each second.
There’s also plenty of content recorded at 30 and 60 frames per second. Action camera footage, for example, is typically recorded at 60 frames per second.
The more unique frames that can be shown in one second, the smoother and sharper motion appears. Your brain merges the frames together and perceives it as a moving picture.
In a computer system, the GPU (graphics processing unit) prepares frames to be sent to the display. However, if the display isn’t ready for a new frame because it’s still working on drawing the previous one, it can cause a situation where parts of different frames are displayed at the same time. Vsync is meant to prevent this situation, by syncing the frames from the GPU to the refresh rate of the monitor.
Typical Refresh Rates
The most common display refresh rate out there is 60Hz. That is, 60 refreshes per second. Most computer monitors and televisions offer at least this much.
You can also buy computer monitors in a variety of refresh rates, which include; 75Hz, 120 Hz, 144 Hz, 240 Hz and 300 Hz. There may be other oddball numbers as well, but these are typical, with higher refresh rates being rarer outside specialized gaming systems.
Televisions are almost all 60 Hz units, with 120 Hz sets now entering the mainstream market along with the latest generation of gaming consoles that support that refresh rate.
Matching Frame Rates to Refresh Rate
The refresh rate of the screen doesn’t have to match the frame rate of the content exactly. For example, if you’re playing 30 frames per second video on a 60Hz display, then you just need to display two identical frames at 60Hz, totaling 30 unique frames.
24fps footage poses a challenge, since 24 does not divide neatly into 60. There are different ways to solve this. Some screens use a form of video conversion known as a “pulldown” that compensates for the mismatch at the cost of running the content at a slightly different speed than intended.
Many modern displays can also switch to different refresh rates. So a TV might switch to 48 Hz or even 24 Hz to get perfect synchronization with 24fps footage. 120Hz TVs don’t have to do this, since 24 divides evenly into 120.
When to Use Vsync
With video games, frames aren’t produced in such an ordered fashion as with film or video. Left without any limiters, the CPU, GPU, and game engine try to produce as many frames as possible. However, since the workload that the game engine puts on these components can vary, the frame rate may fluctuate.
As mentioned above, when the GPU is sending frames that are not in sync with the monitor’s refresh rate, you’ll get that tell-tale screen tearing look where different parts of the image don’t line up.
When you activate Vsync, your GPU only sends out a frame to be displayed when the monitor is ready to draw a new frame, also effectively limiting the rate at which frames are rendered. But this can actually cause yet another issue that results from how frames are “buffered”. Next, we’ll discuss two common types of frame buffering.
Double- Versus Triple- Buffered Vsync
A “buffer” is a region of memory that’s designated as a waiting area to be read when some other device or process is ready for it. When your GPU renders a frame, it’s written to a buffer. Then the screen reads the frame from that buffer to draw it.
So-called “double buffering” is the norm today. There are two buffers, taking turns to act as the “front” and back” buffer. The display draws the frame from the front buffer, while the GPU writes to the back buffer. Then the two buffers switch roles and the process repeats.
Without Vsync, the two buffers can be swapped at any time. So it’s possible that the screen will draw part of each buffer in the frame, which results in tearing. When you switch Vsync on, that tearing does go away. However, if the GPU doesn’t manage to finish writing to the back buffer in 1/60th of a second, that frame is skipped. This results in an effective 30 frames per second.
Unless your computer can consistently render 60 frames per second, you’re liable to experience either a locked 30fps or wildly swinging framerates snapping between 30 and 60.
Triple-buffering adds a second back buffer, which means that there’s always a frame ready to be swapped to the front buffer, making it possible to have odd numbers such as 45 or 59 frames per second on a 60 Hz screen. If you’re given the option, triple-buffering is always a good option.
Enhanced Vsync Types
Graphics card makers continue to grapple with screen tearing and other artifacts caused by screen tearing. Each major manufacturer has come up with advanced versions of Vsync that try to offer all the benefits without the drawbacks.
Nvidia has AdaptiveSync and FastSync, each with their own intelligent approach to Vsync. The former only switches on Vsync if a game’s frame rate is equal or higher than the refresh rate. Should it drop below that, Vsync is disabled, eliminating buffer latency. The latter solution is better as it enables triple buffering and provides the highest frame rate without tearing.
AMD has Enhanced Sync, which is like AdaptiveSync.
Vsync Versus Variable Refresh Rate
There’s a powerful alternative to Vsync known as variable refresh rate. Nvidia’s technology is known as G-Sync and AMD has developed FreeSync, but have made it free and open for anyone to use.
Both technologies let the monitor and GPU talk to each other in such a way that frames are synced with near flawless precision. In other words, all drawbacks of Vsync are addressed here.
The main caveat is that the monitor itself has to support the technology. It’s rare to find monitors that support both standards, but Nvidia has recently relented and added FreeSync support for certain monitors. You can also attempt activating FreeSync on monitors not whitelisted by Nvidia, but the results may not be great in some cases.
So let’s summarize what you need to know about using Vsync:
- If your game cannot sustain a frame rate equal to or above your monitor’s refresh rate, enable triple buffering or lower the refresh rate.
- If your GPU offers a more advanced version of Vsync, it’s worth trying out.
- G-Sync and FreeSync are desirable alternatives to Vsync if you have access to them.
- If you want the minimum of input lag for competitive gaming, switch off Vsync and live with the screen tearing, if variable refresh is unavailable.
Those are the basics of what Vsync is. Now get out there and have some fun with a tear-free gaming experience.