godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.56k stars 20.55k forks source link

Jittering and Non Screen Tearing even when disabling V-Sync #57914

Open owstetra opened 2 years ago

owstetra commented 2 years ago

Godot version

Godot 4 Alpha 2

System information

Windows 10 - GTX 980

Issue description

After disabling V-Sync the screen tearing is gone, it should appear, also the game Start jittering and stuttering, and when enabling V-Sync the game still jittering/stuttering In Alpha 1 after disabling V-Sync, the screen tearing will appear, but there is no Jitter, and the game runs very smooth no matter what compared to Alpha 2 All of this happen when in Full screen

Edit : You can download this Advanced movement system template and test it, Before you test it add this line of code in _ready()

DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)

Untitled

now open it in Alpha 1, You will see the game runs very smooth, but in Alpha 2 the game stuttering, press shift to run and rotate the camera around you and you will see

Steps to reproduce

in any 3D project that contain a fast moving camera, open it in Alpha 1 and Alpha 2, and see the difference

Minimal reproduction project

None _

akien-mga commented 2 years ago

Might be related to Windows fullscreen mode changes @bruvzg.

owstetra commented 2 years ago

Might be related to Windows fullscreen mode changes @bruvzg.

i retested it again in window mode, the issue still there too it feels laggy and jittery when moving the camera in game

bruvzg commented 2 years ago

~Might be related to #57928~ (no it's not in alpha 2), fullscreen mode should have at least the same performance as window mode.

Calinou commented 2 years ago

Jitter and stutter will always happen to an extent when you have V-Sync disabled, because the physics step does not match the rendered frame rate. Physics interpolation fixes this by ensuring every rendered frame "sees" a different physics state, but it's not implemented yet.

If you need physics interpolation right now, you could try porting https://github.com/lawnjelly/smoothing-addon to master.

owstetra commented 2 years ago

Jitter and stutter will always happen to an extent when you have V-Sync disabled, because the physics step does not match the rendered frame rate. Physics interpolation fixes this by ensuring every rendered frame "sees" a different physics state, but it's not implemented yet.

If you need physics interpolation right now, you could try porting https://github.com/lawnjelly/smoothing-addon to master.

The problem is not with physics interpolation, no... it will never Jitter/Stutter at all if V-Sync is disabled in any game or engine, you maybe mean Screen tearing ? Because in Alpha 1 there is no Jitter/Stutter at all when moving the camera in 3D when the V-Sync is disabled and there is Screen Tearing But in Alpha 2 There is Jitter/Stutter but there is no Screen tearing when V-Sync is disabled, and even if V-Sync is Enabled the Stutter is still there

Calinou commented 2 years ago

@owstetra If you can compile the engine from source, you could look into bisecting the regression to greatly speed up troubleshooting.

AttackButton commented 2 years ago

. not 2D

bruvzg commented 2 years ago

snap_controls_to_pixels was broken and restored in #57481, and it probably reintroduced #28804 issue (this was fixed and reverted multiple times in 3.x). But this should not affect 3D, so probably is not the only reason.

AttackButton commented 2 years ago

.

owstetra commented 2 years ago

Untitled

Here's something, You can download this Advanced movement system template and test it, Before you test it add this line of code in _ready() DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)

now open it in Alpha 1, You will see the game runs very smooth, but in Alpha 2 the game stuttering, You can press shift to run and rotate the camera around you, it's hard to see at first but you will feel it and start seeing it

akien-mga commented 1 year ago

Is this still reproducible in 4.0 RC 3 or later?

dreamsComeTrue commented 10 months ago

yes, I can confirm that - I still get jiter movement when VSync is enabled. When I disable it, it's also there but less noticeable. I have the simplest scene: CharacterBody3D with _physics_process adjusting it's Velocity and then move_and_collide() I am using latest 4.1 version of Godot

akien-mga commented 10 months ago

Might be the same issue as #84137 - presumably a Windows DWM bug.