Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microstuttering on Windows with VSync #71391

Open
TinkerWorX opened this issue Jan 14, 2023 · 16 comments
Open

Microstuttering on Windows with VSync #71391

TinkerWorX opened this issue Jan 14, 2023 · 16 comments

Comments

@TinkerWorX
Copy link

TinkerWorX commented Jan 14, 2023

Godot version

v4.0.beta10.mono.official [d0398f6]

System information

Windows 11 22H2, GeForce GTX 1080, GeForce Game Ready Driver 528.02, default backend (Vulkan?)

Issue description

On my machine I get micro stutters more or less consistently. In Godot 3 there was the following setting that fixed the issue:
image
I am unable to find this setting in Godot 4, which means I'm now dealing with persistent micro stutters.

Steps to reproduce

Make any project with a camera that can move and some objects that are visible, observe the stutters in the camera as it moves around, make sure vsync is enabled.

Minimal reproduction project

N/A

@Calinou
Copy link
Member

Calinou commented Jan 15, 2023

Related to #71361.

Vsync via Compositor was removed because it had lots of issues, such as arbitrarily enforcing half refresh rate V-Sync on some setups.

@TinkerWorX Please upload a minimal reproduction project to make this easier to troubleshoot.

Can you reproduce this after switching to the Mobile rendering method in the advanced Project Settings? Also try the Compatibility rendering method.

Also, does this only occur on startup or does it keep occurring after several minutes of running the project? Does this occur when the editor is not open in the background? Does this occur in an exported project in release mode?

@ghost
Copy link

ghost commented Apr 19, 2023

Hello, I don't know if this is the same issue, but when using the Vulkan renderer and having VSync on the game stutters quite a lot if I run it from the editor.
In fact, with Vsync, it rarely reaches 60FPS, hovering around 57-58.

This does not happen when I don't have vsync on, or when running the exported version of the game and using vsync on it.

@Calinou
Copy link
Member

Calinou commented Apr 19, 2023

Hello, I don't know if this is the same issue, but when using the Vulkan renderer and having VSync on the game stutters quite a lot if I run it from the editor.

Do you have the remote scene tree visible in the editor when running the project? This may cause stuttering as per #13219.

@ghost
Copy link

ghost commented Apr 19, 2023

Do you have the remote scene tree visible in the editor when running the project? This may cause stuttering as per #13219.

Interesting, I didn't have auto switch to remote scene tree on, but by setting both Remote Scene Tree Refresh Interval and Remote Inspector Referesh Interval to 0.1 like a comment in that issue suggested, all the stuttering was gone.

Thanks!

@Zireael07
Copy link
Contributor

That refresh interval trick should be documented somewhere imho

@Calinou
Copy link
Member

Calinou commented Apr 20, 2023

It's strange that decreasing these settings from their default resolves the stuttering for you. There are 2 possibilities here:

  • Lower interval means less data is sent between ticks, leading to less time spent blocking on updates.
  • Stuttering still occurs, but is so common you end up not noticing it. I recommend using an external frametime graph tool like RTSS or MangoHud to confirm this.

@ghost
Copy link

ghost commented Apr 20, 2023

It's strange that decreasing these settings from their default resolves the stuttering for you. There are 2 possibilities here:

* Lower interval means less data is sent between ticks, leading to less time spent blocking on updates.

* Stuttering still occurs, but is so common you end up not noticing it. I recommend using an external frametime graph tool like RTSS or MangoHud to confirm this.

Hmm... Yeah it seems yesterday was a fluke, it's been stuttering today as well. But I'm not even on the remote scene tree.

@Calinou
Copy link
Member

Calinou commented Jan 9, 2024

@TinkerWorX Can you (or anyone else) still reproduce this bug in Godot 4.2.1 or any later release?

If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.

Also, we need more information about your setup:

  • Do you have a multi-monitor setup? If so, do monitors have different refresh rates?
  • Do you have variable refresh rate (G-Sync/FreeSync) enabled? If so, is it configured to run for fullscreen applications only, or both fullscreen and windowed applications? You can adjust this behavior in the NVIDIA Control Panel.

@Calinou
Copy link
Member

Calinou commented Feb 12, 2024

Closing due to lack of response. Please comment if you can still reproduce this bug on the latest Godot version.

PS: Since no minimal reproduction project was included in the original bug report, please upload one as well to ease troubleshooting.

@TinkerWorX
Copy link
Author

TinkerWorX commented Mar 25, 2024

Apologies for not updating this, real life got in the way, here's some more documentation, as of v4.3.dev4.mono.official [df78c06], where the issue still persists.

Here's a project used for testing: JitterBug.zip
You can switch between vsync modes in the project settings.

Here's an example video. The quality is bad because any conventional screen recording wouldn't catch the issue, so I had to grab a 240 FPS video from my phone. Ignore any vertical movement, that's just the camera not being still, it's the horizontal movement that is interesting.

The top movement has vsync enabled, and shows clear stuttering.
The bottom movement has vsync disabled, and shows smooth movement.

Godot.Stutter.mp4

Every other setting is identical, other than vsync mode.

Just to add, I'm using a 75Hz display with AMD FreeSync.
In 75Hz mode, there is stutter with vsync enabled and tiny jumps with vsync disabled.
In 60Hz mode, there is stutter with vsync enabled and no perceptible jumps with vsync disabled, likely because the physics rate is set to 60 as well.

@akien-mga akien-mga reopened this Mar 25, 2024
@akien-mga akien-mga changed the title Microstuttering on Windows Microstuttering on Windows with VSync Mar 25, 2024
@akien-mga akien-mga added the bug label Mar 25, 2024
@Calinou
Copy link
Member

Calinou commented Mar 29, 2024

Can you reproduce this with the Compatibility rendering method? If not, this is likely a duplicate of #84137.

@TinkerWorX
Copy link
Author

TinkerWorX commented Mar 29, 2024

I get the same microstuttering with Compatibility rendering. This is a bug I've been following for a long time, even before Godot, and my conclusion is that it's related to the Windows compositor and certain combinations of hardware. It's never an issue with DirectX, only with OpenGL/Vulkan. Would be great if we could have the Vsync via Compositor option back, and then just make it a setting for my players, so if it does bug or cause issues, they can just opt to not use it.

EDIT:
Just wanted to add, it might still be the same issue possibly, but for me running with Compatibility doesn't fix the issue.

@Calinou
Copy link
Member

Calinou commented Apr 3, 2024

It's never an issue with DirectX, only with OpenGL/Vulkan.

Remember that on NVIDIA, you can force any OpenGL/Vulkan app to be presented via DXGI in the driver options: godotengine/godot-proposals#5692 (comment)

Godot 4.3 also has a Direct3D 12 rendering driver which you can try:

Rendering via Direct3D automatically uses DXGI by design on all vendors, not just NVIDIA.

@TinkerWorX
Copy link
Author

TinkerWorX commented Apr 4, 2024

I'll try the NVIDIA DXGI setting. Initial test didn't fix anything, but I'll need to do a few more tests where I also reboot my system.

I tried to use Direct3D12, but Godot refuses to launch when I do that, but maybe I was missing that dll, I guess I need to file a different issue for that if it still doesn't work.

@TinkerWorX
Copy link
Author

A quick update, using the DirectX Shader Compiler and Direct3D 12 mode alleviates the issue.

D3D12 12_0 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce GTX 1080

I assume the above log message confirms it's now using Direct3D 12 instead.

@maridany1999
Copy link

maridany1999 commented Jun 14, 2024

Using Direct3D 12 and Exclusive Fullscreen was the only settings that fixed this issue for me.

Also, I experimented all other settings with no success (Direct3D 12 and Window Mode, Vulkan and Exclusive Fullscreen Mode, etc), it would always randomly stutter, and after minimizing and focusing the window again would fix it temporarily. When it started to stutter, everything in the profiler, Monitors, Video RAM, etc, seemed normal (including the FPS which were stable at 60 for me).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants