使用或不使用垂直同步

发布于 2024-11-06 08:15:09 字数 190 浏览 6 评论 0原文

我正在决定是否在我一直使用 OpenGL 开发的新游戏中使用垂直同步。目标是为用户提供最佳的游戏体验,并在性能和质量之间取得良好的平衡。该游戏设计为可以在较旧的(Intel/上网本)计算机和较新的(NVidia/i7 台式机)计算机上运行。然而,我知道垂直同步的目的是防止撕裂;即使垂直同步关闭,我也从未能够重现这个撕裂问题。提供最佳体验;垂直同步应该打开还是关闭?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

乖乖公主 2024-11-13 08:15:09

关于这个问题,可以说的有很多。让我算一下:

  1. 如果你没有看到撕裂,那么你很可能已经进行了垂直同步,即使你认为自己没有。原因可能有所不同,但最终,如果发生任何移动,在帧中间交换缓冲区是非常明显的(一个原因可能是您没有配置为翻转缓冲区,因此必须执行帧缓冲区的副本
  2. ) on 也有明显的伪影。通常,它会创建显示时间可变的帧,与显示刷新率的关系比与渲染率的关系更大。这可能会产生微卡顿,并且很难控制,因为您不知道何时生成帧,它将在哪个刻度处显示,因此您无法补偿运动伪影。这就是为什么有些人试图将渲染速度锁定为刷新率。始终以 60fps(或 30fps)渲染,时间更新为 time += 16.7ms John Carmack 一直在寻求一种“以 60Hz 垂直同步,但如果我错过了截止日期则不同步”的模式我认为就是这个原因。
  3. 垂直同步打开可以节省电量(对上网本很重要)
  4. 垂直同步关闭可以减少输入延迟(当您的输入在显示前 3 帧时,它就开始变得重要了)。您可以尝试弥补其中的一些,但最终,很难在最后一刻注入输入更新。

所以最根本的答案是没有完美的答案。这实际上取决于什么对你的游戏更重要。您需要考虑的事项:您想要达到的帧速率、输入延迟的影响程度、游戏中有多少移动量,这些都是需要考虑的问题。

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.

她比我温柔 2024-11-13 08:15:09

为了获得最佳用户体验,请在菜单中放置一个选项来打开/关闭垂直同步。这样用户就可以决定。您可能无法重现撕裂,但这在某些系统上绝对是一个真正的问题。

至于默认设置应该是什么,我不确定,我认为这是你的选择。我更喜欢默认关闭垂直同步,因为启用它会稍微降低性能,而且大多数人不会意识到撕裂或不关心它,但默认情况下启用它也有充分的理由。

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.

扎心 2024-11-13 08:15:09

我相信垂直同步的默认值应该是打开的(基于我所有的游戏,而不是编程经验:))。仅仅因为您没有看到它,并不意味着您不应该遵循好的
实践。

  • 也许你不能像其他游戏玩家那样密切地盯着屏幕
  • 也许当你看到一点撕裂时你不会像某些游戏玩家那样恼火
  • 也许你的特定屏幕比其他屏幕更好地隐藏撕裂

正如schanaader提到的,通常游戏会离开垂直同步作为视频设置菜单中某处的配置选项。对于那些不知道 vsync 含义的人来说,默认值仍应为“打开”,如果用户足够了解,他们可以选择对其进行调整以查看有何不同

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文