godotengine / godot

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

Driver-related jitter in motion test #2043

Closed Angluca closed 6 years ago

Angluca commented 9 years ago

image Only first row is nothing, it's bug? fix process test(2 and 4 row) all often shake.

reduz commented 7 years ago

the only way to get smooth framerate (not jitter) on Windows is going fullscreen, also you have to enable vsync both on driver and in Godot.

On Sun, Jan 22, 2017 at 6:28 AM, balloonpopper notifications@github.com wrote:

I'm on Windows 10 (NVidia 970 graphics) and it's consistently broken for me.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/2043#issuecomment-274319653, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-Z247gLG5g_6wQxnRFabwcmjpGMTw4ks5rUyEugaJpZM4E6yMX .

balloonpopper commented 7 years ago

What's the difference between the two checkboxes on the "use_vsync" setting please @reduz ?

reduz commented 7 years ago

the other checkbox is to persist the property, this was removed in Godot 3.0

On Sun, Jan 22, 2017 at 8:55 AM, balloonpopper notifications@github.com wrote:

What's the difference between the two checkboxes on the "use_vsync" setting please @reduz https://github.com/reduz ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/2043#issuecomment-274326467, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-Z27PdpmxJZn9TDuqhKytw3yHyB-_Tks5rU0OsgaJpZM4E6yMX .

balloonpopper commented 7 years ago

Hmmm, no idea what persisting it does, but it sounds like I won't have to worry about it soon anyway! Cheers!

Zylann commented 7 years ago

"persisting" means "remember the setting between executions of the editor"

wangell commented 7 years ago

This jitter exists on every computer I've tried Godot on (using Motion test/Space shooter/a simple moving sprite). I've tried across three Windows machines (ranging from 3 years old to brand new, all with modern graphics cards), and two Linux machines (on Gnome + Archlinux). All of them have varying amounts of jitter, sometimes it's only every 5 - 10 seconds, and sometimes it's every second. No combination of driver/Godot vsync configuration seemed to fix it, nor did the latest git commit. It's very jarring and is not a simple frame skip (it seems to jump backward a frame, or skip many frames). Let me know if you want me to try any tests.

reduz commented 7 years ago

if the jitter is every a few seconds, this is normal OS jitter, it's pretty much unavoidable and it's there in all games. Try enabling vsync in your project to help compensate it

On Wed, Feb 8, 2017 at 10:14 PM, William Angell notifications@github.com wrote:

This jitter exists on every computer I've tried Godot on (using Motion test/Space shooter/a simple moving sprite). I've tried across three Windows machines (ranging from 3 years old to brand new, all with modern graphics cards), and two Linux machines (on Gnome + Archlinux). All of them have varying amounts of jitter, sometimes it's only every 5 - 10 seconds, and sometimes it's every second. No combination of driver/Godot vsync configuration seemed to fix it, nor did the latest git commit. It's very jarring and is not a simple frame skip (it seems to jump backward a frame, or skip many frames). Let me know if you want me to try any tests.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/2043#issuecomment-278516267, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-Z2_VRFoe3oWlc0Fsi6U4wszc1w_Mqks5ramiBgaJpZM4E6yMX .

R0adRunn3r commented 7 years ago

Jittering here too on windows 10 with i5 6500, 16gb RAM, GeForce 970GTX and godot 2.1.2 partially solved disabling vsync and setting a fixed fps using OS.set_target_fps worth noticing that with vsync turned on i got the jitter on both windowed and fullscreen! I hope this issue will be fixed for 3.0 :(

mischiefaaron commented 7 years ago

"and it's there in all games" Do you really think it would be such a common problem if people were complaining about something that's normal with all their other games? Come on, man. Normal is not the case here so far as I can see.

JamesCraster commented 7 years ago

Zylann (your description fits this problem very well) and anyone else, if you have an NVIDIA GPU, try turning 'Threaded optimisation' to OFF (not to Auto to which it is automatically set, but to OFF) in your control panel. It causes known stuttering/jittering/thrashing with other rendering libraries on OPEN GL, and I have suffered with this myself. (SFML is an example (the OP isn't me)) https://en.sfml-dev.org/forums/index.php?topic=16449.0 If this works for you, please let me know.

eon-s commented 7 years ago

In motion test, I have noticed have zero jitter with latest nvidia drivers on Ubuntu 16.10 under Gnome, some on windows 10 fixed process animation, for both 2.1.2 and recent 3.0 builds, nouveau is terrible (worse on AMD but Gallium is getting better than a year ago).

Drivers and compositor affect this, it seems.

plucian commented 7 years ago

we make games for others to play.. would be difficult to explain to them, how to set "Threaded optimization", or other settings.. on full screen (windows 8), seems to be very smooth though..only the fixed process stutters from time to time.

reduz commented 7 years ago

As mentioned before, this is not a godot problem. If It does not happen in other games may be an optical illusion or true. It is possible Godot does things that the driver does not like due bugs or simply due to no one taking the same approach. If so, tough luck, try to report to whoever makes the driver.

Godot uses pure OpenGL, no OS specific code is used, so it is impossible that Godot is reponsible for the behavior.

On Apr 4, 2017 10:49 AM, "Lucian" notifications@github.com wrote:

we make games for others to play.. would be difficult to explain to them, how to set "Threaded optimization", or other settings..

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/2043#issuecomment-291505339, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-Z23BFXF66gZWOA7f1jN1f4GGOnHgJks5rskpjgaJpZM4E6yMX .

Rayek commented 7 years ago

I had terrible jittery movement with moving 2d sprites. Thanks to @JamesCraster I got rid of those by turning off the threaded optimization in the Nvidia drivers (I am on Windows 10). Either that, or playing full-screen prevents the jitters.

I still do experience hiccups every 5~8 seconds, but those are caused by the OS (I see these occur in most games: webGL, and other opengl based ones).

This is not a Godot issue, in my opinion. On an iMac that I tested this with there were no jitters either. Linux Mint machine worked fine too. And two older XP machines seemed to have no issues either - just my Nivida 590GTX machine had the jittery movement, which is now solved.

JamesCraster commented 7 years ago

@Rayek, I'm glad to know that I helped! The difficulty is that players may not appreciate being told to change their Nvidia Control Panel settings. There is a way of creating an application profile for your game by using NVAPI (although I have never tried this approach.) I was initially considering Godot as a way of removing such issues, but it seems they are everywhere.

Edit: sorry about the edit, I thought better of my second paragraph a moment after posting - I don't know much about Godot, so I shouldn't really comment on its features outside of this issue :)

reduz commented 7 years ago

Its in the todo, maybe for 3 as physics engine rewrite is pending

On May 2, 2017 9:18 PM, "JamesCraster" notifications@github.com wrote:

@Rayek https://github.com/Rayek, glad to know that I helped! The difficulty is that players may not appreciate being told to change their Nvidia Control Panel settings. There is a way of creating an application profile for your game by using NVAPI (although I have never tried this approach.) I was initially considering Godot as a way of removing such issues, but it seems they are endemic, unfortunately.

Changing the subject, I am a little surprised that Godot does not have rigid body interpolation (as it is in Unity).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/2043#issuecomment-298748701, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-Z28tSaaUBbhjrZtNKW1xshKCK-x-Tks5r14-IgaJpZM4E6yMX .

reduz commented 7 years ago

Er 3.1

On May 2, 2017 9:25 PM, wrote:

Its in the todo, maybe for 3 as physics engine rewrite is pending

On May 2, 2017 9:18 PM, "JamesCraster" notifications@github.com wrote:

@Rayek https://github.com/Rayek, glad to know that I helped! The difficulty is that players may not appreciate being told to change their Nvidia Control Panel settings. There is a way of creating an application profile for your game by using NVAPI (although I have never tried this approach.) I was initially considering Godot as a way of removing such issues, but it seems they are endemic, unfortunately.

Changing the subject, I am a little surprised that Godot does not have rigid body interpolation (as it is in Unity).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/2043#issuecomment-298748701, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-Z28tSaaUBbhjrZtNKW1xshKCK-x-Tks5r14-IgaJpZM4E6yMX .

ghost commented 7 years ago

I don't believe this is a driver issue folks, I did some extreme testing. Not a vsync issue either

Issue that solves it is: Image loader -> filter. Enable this, and no jitter whatsoever.

It's something internal I think with rounding pixels or something :P. Phaser had this same jitter problem and they added a setting called "roundPixels = true". Maybe godot can implement this option.

It's fixed by enabling filter in the image loader settings. However, some sprites I don't want to have the filter tag. I know we can choose whatever texture we want to have specific flags, but if there are any w/o the filter flag in the level, and the camera moves, you then just see jitter for that specific sprite. Which is just as bad.

I think it's a rounding pixel issue internally on textures only @reduz, @akien-mga, @bojidar-bg or someone really familiar with the scene renderer can take a deeper look

ghost commented 7 years ago

Also to add, I believe the jitter is actually not jittering at the sub particular pixel level. Look:

Jitter: w/o filter

No jitter: Filter Enabled:

The pixels at the very edges of the textures change in and out in a diagonal pattern (hard to tell in these gifs), which creates the illusion of jitteriness. I think it's not really a jitter, it's just the edges are not squared off (floating point / rounding issue) with the textures maybe?

reduz commented 7 years ago

That last animation is not jitter, that is good old aliasing.

On May 3, 2017 5:16 AM, "Dillybob92" notifications@github.com wrote:

Also to add, I believe the jitter is actually not jittering at the sub particular pixel level. Look:

Jitter: w/o filter enabled

https://camo.githubusercontent.com/9aa939513783ee1de0ac708cf83e0542d1d4350b/68747470733a2f2f692e6779617a6f2e636f6d2f64666362646436666535666566616330353138666633383366623662653933362e676966

No jitter: Filter Enabled:

https://camo.githubusercontent.com/e50e3c316a67efeea730e7c1b2801846f4b53fc0/68747470733a2f2f692e6779617a6f2e636f6d2f65376333313035333937363836386263393034633463336335626638313739652e676966

The pixels at the very edges of the textures change in and out in a diagonal pattern (hard to tell in these gifs), which creates the illusion of jitteriness. I think it's not really a jitter, it's just the edges are not squared off (floating point / rounding issue) with the textures maybe?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/2043#issuecomment-298819863, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-Z2zBrshrRNtWcqtyVjqBK1ogBRF3Sks5r1_-VgaJpZM4E6yMX .

reduz commented 7 years ago

Ah nevermind, you probably mean the floor.. yes if you want sub pixel you need filtering, there is no way around it.

On May 3, 2017 8:10 AM, "Juan Linietsky" reduzio@gmail.com wrote:

That last animation is not jitter, that is good old aliasing.

On May 3, 2017 5:16 AM, "Dillybob92" notifications@github.com wrote:

Also to add, I believe the jitter is actually not jittering at the sub particular pixel level. Look:

Jitter: w/o filter enabled

https://camo.githubusercontent.com/9aa939513783ee1de0ac708cf83e0542d1d4350b/68747470733a2f2f692e6779617a6f2e636f6d2f64666362646436666535666566616330353138666633383366623662653933362e676966

No jitter: Filter Enabled:

https://camo.githubusercontent.com/e50e3c316a67efeea730e7c1b2801846f4b53fc0/68747470733a2f2f692e6779617a6f2e636f6d2f65376333313035333937363836386263393034633463336335626638313739652e676966

The pixels at the very edges of the textures change in and out in a diagonal pattern (hard to tell in these gifs), which creates the illusion of jitteriness. I think it's not really a jitter, it's just the edges are not squared off (floating point / rounding issue) with the textures maybe?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/2043#issuecomment-298819863, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-Z2zBrshrRNtWcqtyVjqBK1ogBRF3Sks5r1_-VgaJpZM4E6yMX .

ghost commented 7 years ago

@reduz i see. yeah i was mostly showing the "jitter" on the tree branch. I guess I can enable filter globally then, and just use the custom flags for individual sprites (filter=false) for temporary fix.

e: For anyone who sees this and has problems this is what I did:

Filter enabled globally for world / character sprites, filter disabled for UI / Sprites under a Canvas Layer. I don't know how pixel games deal with it though as that filter will hurt their sprites "pixel effect", but allow a smooth, non jittering effect.

However, with those games the jitter I think is a lot less noticable just because of the nature of pixel gameplay

ArisKallergis commented 7 years ago

posting a sum of #8800

In my case, tinkering with vsync worked, just like JustDevs commented on Nov 21, 2016. I needed to specifically set the vsync's persistence on in project settings, but keep vsync off. This was the only combination that worked for me to not have stutters. System: Windows 8.1, Godot 2.1.3 , asus rog g751jy laptop , gtx 980m, latest drivers i think.

reduz commented 6 years ago

I will kick to 3.1, where we might implement fixed step interpolation

damarindra commented 6 years ago

I don't know if this related or not, just want to share. I got this problem when creating pixel art game, but, when I make the camera position always at a rounded point, the problem was gone.

balloonpopper commented 6 years ago

It's still a high priority to me. The bug shouldn't be closed purely on the length of time it's been open when it's still a valid problem. Hopefully developers will see the 2.5 years as reasoning for giving it a higher priority.

reduz commented 6 years ago

@Pegus1936 This has been tagged 3.1, and it will be fixed (or worked around) after 3.0 stable comes out, not before.

ArisKallergis commented 6 years ago

If you want an informed opinion on what happened here that led to the deletion of comments, either read this https://www.reddit.com/r/gamedev/comments/7gmtxl/godot_30_beta_1_is_there_right_in_time_for_ludum/dqk9nel/ while making sure you read the developers' point of view, or take a look at the facebook group, there is a pretty big discussion in a relatively recent post.

Zireael07 commented 6 years ago

@ArisKallergis the guy who posted before you is clearly another incarnation of the guy who led to the problems.

mikeandtherest commented 6 years ago

I also experience a lot of micro-stuttering/jittering both on Godot 2.1.4 and on 3.0 beta1_win64. I'm on Win 10 Pro x64, with the latest driver for a GTX 780Ti. If I disable the Vsync, it helps a bit, but then in fullscreen I get a lot of tearing for the fast moving foreground parallax layers (it doesn't happen for the background layers though).

The only solution that fixed everything for me was Vsync ON + Threaded Optimization OFF (inside the Nvidia Control Panel settings). So just to be clear, this combination fixes the "laggy" side scrolling in both above mentioned versions of Godot.

Now I wonder if there is a way to achieve this from inside the engine, and avoid messing around with custom Nvidia profiles. Thanks!

Timofffee commented 6 years ago

Also I observe a problem on Linux (LinuxMint, ElementaryOS) and Win 8.1 (3 different PCs with different productivity). Many variants have been revised, but the problem is clearly visible even for simple code. For example,

# Scene:
# 
# | Node
# |-- Sprite

extends Node

func _physics_process(delta):
    $Sprite.position += 100 * delta 
11clock commented 6 years ago

I have been dealing with jitter for weeks now, and handed my game over to my friend to test it and he reported no stutter at all. My card is a NVIDIA card (GTX 1070 to be exact) while his is AMD.

We both have Windows 10 and latest drivers installed.

Timofffee commented 6 years ago

I tested on an nVidia 660 and 2 AMD video cards in the laptops. The problem is clearly visible when using Camera2D, or rather when using smoothing in It. Without smoothing flicker is not so noticeable, but it is still there.

akien-mga commented 6 years ago

Good news finally, a fix for (some) jittering causes has been merged in the master branch a while ago (#17353).

Could you test it and check if it fixes the jittering issues on your hardware? You'd need to compile from source, or use a dev build from https://hugo.pro/projects/godot-builds/

eon-s commented 6 years ago

Occasional stuttering still happens on linux, amdgpu with recent mesa, but probably related to vsync and driver only, no more camera update or physics process issues.

akien-mga commented 6 years ago

Occasional stuttering still happens on linux, amdgpu with recent mesa, but probably related to vsync and driver only, no more camera update or physics process issues.

I've found that a lot of the jitter I see is related to using Plasma/KWin as window manager. When I switch to a less intrusive window manager like Openbox (on the same system), I have perfectly smooth _process and _physics_process, including with vsync.

Calinou commented 6 years ago

I've found that a lot of the jitter I see is related to using Plasma/KWin as window manager. When I switch to a less intrusive window manager like Openbox (on the same system), I have perfectly smooth _process and _physics_process, including with vsync.

Have you tried disabling compositing in KWin? X11 compositing heavily slows down 3D rendering in my experience (and adds significant latency).

(Shift+Alt+F12 should toggle the compositor by default.)

eon-s commented 6 years ago

There are also some CPU and GPU options on Plasma settings that may affect Godot too.

mikeandtherest commented 6 years ago

Just don't forget that Windows is still a thing :) In the last 8-9 months I tried again and again to fix this micro-stutter issue so that my train game demo runs smoothly, to no avail. And the crazy thing is that Unity doesn't do that.

eon-s commented 6 years ago

@mikeandtherest just remember that Unity is not a 2D engine (and some configurations may produce some jittering), Godot may not show stuttering effect on 3D either. In any case, have you tried a master build? Just do not use it on your main project.

Zylann commented 6 years ago

@eon-s Godot does show stuttering in 3D for me, but it's random. Sometimes it runs flawlessly for a few minutes, sometimes it starts immediately stuttering. I'm curious why "2D" vs "3D" would make a difference? They both draw polygons with a bunch of shaders, right?

reduz commented 6 years ago

Ocassional Stutter (like every a few seconds) is NOT jitter. Jitter happens constantly. I think jitter is pretty much gone at this point in master. Stutter has more to do about the OS interrupting the game process because anything that may be going on (such as many Chrome tabs open :P )

Also, on fullscreen, Windows gives more priority to the process so there is less chance of stutter. Probably the only difference between Unity and Godot is that one uses Direct3D while the other is OpenGL, but I am not convinced it's enough. Maybe there is some extra trick that needs to be done to get a bit more priority that Godot is not doing, but I am clueless honestly.

Zylann commented 6 years ago

Did people try this? I wasn't confident in the default setting (though I cannot change it because it throws me an "Access Denied"). image

mikeandtherest commented 6 years ago

@Zylann Just out of curiosity, are you on a laptop? Because that one doesn't seem to have any kind of effect on my desktop PC.

Zylann commented 6 years ago

@mikeandtherest I am on a desktop PC, but I can't test that because it throws me an error.

11clock commented 6 years ago

@Zylann Even if that worked, I wouldn't want to be telling all my customers to change their PC settings to make my game more playable. A game should work fine on a decent computer with default graphics settings. Not once have I ever encountered a game that required me to change my graphics settings. (And when I thought that I had to in order to fix some games not running right, it ended up having no effect.)

Zylann commented 6 years ago

@11clock of course, its just that I had problems with this settings before (and still am, as well as all nVidia Windows users), and I thought it could have an impact on this as well. Turns out it doesn't then.

reduz commented 6 years ago

I am in favor of closing this issue, because Jitter itself within the engine has been effectively resolved in master.

Remaining issues are about stutter, more OS dependent, and likely related to process priority, OpenGL driver or compositing.

Reports should be done with a lot more focus on hardware, whether testing happened in fullscreen, etc.

eon-s commented 6 years ago

This may need to be closed, yes, and leave the others that are more specific, also I guess that we will see new ones with the new (old) renderer.

akien-mga commented 6 years ago

Agreed, we can say that jitter issues have been resolved with #17353.

Stutter issues can still remain on some configurations, but are tracked in various other issues already.