Godot: Jitter problems in 3d scene

Created on 11 Jun 2018  Â·  38Comments  Â·  Source: godotengine/godot

Godot version:
3.0.2 as well as 3.0.3 rc3 and current master

OS/device including version:
Win10 960m, 760, 780ti

Issue description:
I have been noticing jitter problems for a while with the topdown section of my game in development. After trying all sorts of fixes over the last 6 months, I have created a basic project to see if other devs are having the same problems. There are existing Github issues that are related to jitter in 2d projects , but I couldn't really find much related to 3d projects.

I have ruled out the jitter being caused by specific drivers (having tried on 4 different machines) as well as fps (getting over 60fps for this basic scene). The lerping camera was a possibility, but if you try switching to the static camera in scene, problems are still apparent. Have also tried all combinations of vsynch natively on gpu as opposed to natively in Godot as well as fullscreen vs windowed. As well as locked fps vs free fps and combinations of the aforementioned ideas.

Was hoping that the new jitter fix would help, but alas it did not help, for me at least.

Some observations that I have noticed. My game is a combination of 3rd person railshooter and topdown shooter. The rail shooter does not exhibit much jitter at all as compared to the topdown. This may have to do with the fact that jitter is much more apparent to the eye when a camera is moving in a planar fashion. Film panning-dolly shots are notorious for showing strobing if the movement is too fast, but then they are locked to between 24fps, whereas a 60fps game or 30fps interlaced footage is much more tolerant here. My railshooter sequences may in fact be exhibiting the same level of jitter as the topdown, but could be harder to see? Not sure why but topdown and 2d is causing way more problems than 1st or 3rd person 3d for me. Jitter can be a hard thing to quantify!

Also, in this attached demo scene, the camera script is running in the standard _process loop which makes the player seem more jittery. Whereas if you change this to _physics_process loop the player feels much smoother, but the surrounding scene jerks much more. I will post some links to my game on youtube, where this is more apparent. I would imagine that this is the renderer and physics steps getting out of synch?

Steps to reproduce:

  • run the attached demo scene and use the arrow keys to navigate. Also try changing the standard _process to _physics_process and switching the camera to the static one. Persistent jitter is seen in all 3
    modes of the 3 machines I have recently tested on.

Btw, I intentionally added SSAO and a directional shadow to tax the scene a bit more and lower the fps.

Would be interested to see if any devs can get this scene to play smoothly for them and any ideas for fixes, on an engine or scene level!

Minimal reproduction project:

move_cube_jitter.zip

documentation core

Most helpful comment

I see no jitter, I could not reproduce and the video uploaded by @kubecz3k does not show any jitter either, only stutter.

I vote we make a documentation page explaining what the difference between jitter and stutter is and what possible causes can there be, then closing this. I will change this from bug to documentation.

All 38 comments

I can confirm that I have similar results on 257d3c3f39fd144d202f112c9cb08a82c174afbc on Ubuntu 18.04 with gtx1060 and gtx960M also was trying with different values of "Physics Jitter fix" parameter, no luck here. During the test I have also added additional cube that is moved by animation player in idle process, and its quite surprising for me to see that this cube jitters for me as well: https://youtu.be/jeeqg-SJ4aA


Related issues:

10388

2043

This is the most recent footage I have posted on youtube of my game and I am using the _physics_process for the follow camera. The player looks smooth, but the city is very jittery in many spots. It is only a 30fps capture, but it has the same issues at 60fps. Look from the 30 sec mark:

https://www.youtube.com/watch?v=tvfXMVJiPFY

This is the previous footage I had posted where I am using the standard _process loop for the camera and the opposite occurs. The player can look quite jittery, but the city environment is much smoother. I realise it can be difficult to see, as the player is stop/starting all the time, but look between the 32 and 40 second mark :

https://www.youtube.com/watch?v=OKITWrU3t1o

i have the same problem , i'm working on a Top down game and an FPS Game , the top down game has this problem ... and like you said when using _physics_process the environment is jittery , but sometimes when i close the game and reopen it again it become smooth .. after while it start jitter again (Environment)

@CCODE05B Do you have jitter issues in your FPS game as well as the topdown?
Can you please try the attached demo scene and confirm that you get jitter on your system(s) and provide the OS/GPU/Godot version details.

The problem here I think is the physics process having a fixed delta of 1/60th of a second. Say your framerate is 50fps, you'll get a certain percentage of frames where the physics process is executed twice and for that frame your cube moves twice as far as the other frames. Normally you don't notice that too much but because the camera is set to follow the cubes location the way it does it translates to jitter in the camera which then translates to the whole world seeming to shake.

if you're FPS is higher then 60fps you'll get frames where there is no movement of the cube but you're still moving the camera, opposite side of the same coin

I'm attaching my modification of the project in which I added cube moved by animation player in idle frame, it might be interesting if this cube is jitering as well for other people, if yes than I have a feeling that there might be couple distinct issues that are accumulating here...
move_cube_jitter_with_idle_anim.zip
(the same project that was on the video from my prev post)
_(the demo is a 3.1 project)_

Attaching also some screenshot from the profiler, during the profiling I run the demo and didn't touch anything for couple of seconds:
profiler
For me it looks like the problem is some kind of stale in idle frame (pink graph)
(the biggest idle frame time on this graph is 0.0248)

When turning off the vsync the idle times are very tiny! And idle jitter is significantly smaller and more constant. Unfortunately in that case jitters is a lot bigger during player (physic body) movement.

Sorry for such chain of posts, but I noticed one more thing, not sure if this is expected or not. When vsync is off some frames in the profiler dont have any information about frame time at all... I would understand if there would be no info about physics frames, but there is no info about idle frame as well:
profiler

Obligatory Jitter questions:
1) Are you running on Desktop Linux? Did you try Windows Fullscreen to see if there still is any jitter?
2) Is VSync on? (vsync off will cause jitter)
3) Is Is jitter constant or it hapens every a few seconds?
4) Is Threaded rendering off? (enabling it may icrease jitter)

Thanks!

Juan,

When i tried:
1 windows desktop, windowed but maximised, i’ll try fullscreen when back
home
2 vsync on
3 constant when player is moving
4 threading off

Also i barely got 17fps with ssao on and 50fps with ssao off, really weird
for such a simple example (kaby lake cpu with 1060 gtx)

On Tue, 12 Jun 2018 at 9:28 pm, Juan Linietsky notifications@github.com
wrote:

Obligatory Jitter questions:

  1. Are you running on Desktop Linux? Did you try Windows Fullscreen to
    see if there still is any jitter?
  2. Is VSync on? (vsync off will cause jitter)
  3. Is Is jitter constant or it hapens every a few seconds?
  4. Is Threaded rendering off? (enabling it may icrease jitter)

Thanks!

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/19504#issuecomment-396556953,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AB2vaVKPI49ydZw_qeJ7QAuG0StfP5kaks5t76XjgaJpZM4Uif--
.

>

Kindest regards,

Bastiaan Olij

https://www.facebook.com/bastiaan.olij
https://twitter.com/mux213
https://www.youtube.com/channel/UCrbLJYzJjDf2p-vJC011lYw
https://github.com/BastiaanOlij

@reduz Have tried fullscreen on Windows and no improvement. I have vsync on, both in Godot and on the card, and all variations of the 2. Jitter is generally constant, but depending on the scene it can vary. No threaded rendering.

Would be great if you could try the attached project file and let us know how it fares for you.

With the camera on _process, I see some jitter (which I guess is to be expected). With the camera on _physics_process, I see no jitter at all. Testing on Windows.

@BastiaanOlij that's odd, I tested on a 1060 on a much worse CPU than yours and it runs very smoooth

@fracteed Also I suggest you rotate the camera a bit and disable shadows, as both the shadow texels as well as geometry perfectly aligned horizontally or vertically (like the cube in this case) can give you the illusion of jitter when what you are looking at is just aliasing.

@reduz would be nice if you could also check my vrsion of the demo, from one of my previous posts (https://github.com/godotengine/godot/issues/19504#issuecomment-396486320) since I added box which is moving in idle thread there (via anim player) and it jitters for me with vsync on, even when camera is standing still (it jitters less with vsync off, but in this case player/bodies are jittering more)

@reduz also about @BastiaanOlij and your performance difference: I noticed there is a HUGE difference between various resolution / window sizes. Its possible @BastiaanOlij has screen with bigger resolution than yours, (on my gtx1060 I have 70fps on full screen (1080p), and 200 in default window size)

@fracteed I think what you are seeing in both this demo and the topdown part of your game is simply aliasing because the geometry is aligned to X and Y. I tried to enable MSAA 8x in the demo you posted (without rotating the camera) and the apparent jitter also goes away. So, without any doubt to me the problem you are seeing is related to aliasing, not jitter.

I tried to enable MSAA 8x in the demo you posted (without rotating the camera) and the apparent jitter also goes away. So, without any doubt to me the problem you are seeing is related to aliasing, not jitter.

I clearly get jitter even with MSAA 8x or 16x here.

Testing with:

  • Mageia 6 x86_64, Nvidia GTX 670MX with latest proprietary drivers
  • Plasma 5, KWin, both with and without compositing effects
  • VSync ON and VSync OFF
  • MSAA Disabled and 8x and 16x
  • Windowed and Fullscreen and Borderless Fullscreen

@reduz as explained in the first post, if I use _physics_process for the camera the player will move smoothly(in this demo and infinistate) but the background is very jerky. If I use _process for the camera it is the other way round. The player looks jerky, but the background much smoother. I haven't been able to get both looking smooth. I have tried with MSAA (which my game uses) and it makes no difference for me. In the attached demo, I still get some jitter even with the static camera, but having the tracking camera definitely exaggerates this.

There is a problem I introduced in SSAO recently, as soon as I get back
home, I will fix it so you can try again with that.

On Tue, Jun 12, 2018, 09:10 kubecz3k notifications@github.com wrote:

@reduz https://github.com/reduz also about @BastiaanOlij
https://github.com/BastiaanOlij and your performance difference: I
noticed there is a HUGE difference between various resolution / window
sizes. Its possible @BastiaanOlij https://github.com/BastiaanOlij has
screen with bigger resolution than yours, (on my gtx1060 I have 70fps on
full screen, and 200 in default window size)

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

In this recent video from my game, if you look at the 30 sec mark you can see the city looking very jerky, but the player is moving smoothly. The camera is using physics_process and MSAA is on. It then smooths out at about 40 seconds but gets really bad at about 1:10 till the end of the clip.
https://www.youtube.com/watch?v=tvfXMVJiPFY&t=30s

In this older version, I am using _process for the camera and the city is scrolling quite smoothly, but the player is very jittery. A bit hard to see with the starting/stopping, but any part where the player is constantly moving it is obvious. https://www.youtube.com/watch?v=OKITWrU3t1o&t=30s

Ok Fracteed have you tried your game in the latest master?

I just started it up to test it in full screen and it was suddenly silky smooth... Took me a minute to realise I had just booted it up in yesterdays master.
Started it back up in 3.0.3 RC3, horrible performance.
I also tried it in 3.0.2, the performance is ok (so we might be looking at a regression issue in 3.0.3) but it does jitter in 3.0.2

@reduz I'm assuming the difference in performance between our 1060ies is due to the above. I wonder what is slowing it down so much in 3.0.3

@BastiaanOlij I am trying this demo scene without SSAO and shadows in the latest master with the jitter fix at the default 0.5. Not sure if you were aware of this new feature? Still terrible with SSAO. Reduz mentioned that there is a bug in the SSAO, so maybe a combination of the new jitter fix and a fix to the SSAO will do the the trick?
But you are getting no jitter with the latest master and SSAO on?

@reduz you are right about the SSAO causing problems. I have tried this demo on current master with the new jitter fix at 0.5 and no SSAO and it is a lot better. Will be interested to try this on my actual game with the fixed SSAO and new jitter fix feature. Could be the magic bullet! If you have time, that halfres SSAO feature would be a wonderful addition to 3.1 :)

@fracteed I wasn't aware of the fix so didn't do anything there. Yeah basically just running it as is on 3.1 it worked fine, but it may be that my GPU is purring along nicely with those fixes and not too bother by SSAO..

There is something definitely going on with SSAO, with SSAO turned off the @fracteed demo runs much smoother. But I also tested this on one of my small demos and the effect is still there even without SSAO :disappointed:

I'm uploading the demo below. I will also give a link to a video on which I'm showing the best way to observe this demo (doing circles with the car around some geometry)

video:
https://youtu.be/VVQtuWgJRog

demo:
JitterCarTest.zip

Would be awesome if more people could check if they have a problem with this non SSAO demo.

OS : Windows 7 pro x64
GPU : GTX 980
RAM : 8 GB
CPU : i7 4970K
MSAA X16 - Disabled SSAO ... no other effect but Glow - Both window or fullscreen - also VSync is On and Off .. tried both - Threading off

@fracteed i have jitter on both ,but the top down game is more jittery .. the FPS one is very smooth , but the camera is jittering when looking around
and in the attached example i got no jitter for the first time , but after playing the scene again the Environment is jittery .. close and play again .. there is no jitter for somehow .. and sometimes it run very smooth ... then it start jittering

After more intensive testing it seems that though the SSAO is problematic, it is not the main cause of the jiiter. Last night I was testing on my Alienware alpha and it seemed better until I realised the machine was doing a hardware lock to 60 fps. Using the jitterfix and locking fps at 60fps in Godot does help somewhat, but if you keep playing the jitter eventually comes back.

Here is a tweaked project file that is to be used with Godot3.1 builds. It has MSAA on, jitterfix at 0.5, SSAO and shadows off, physics_process is used for camera script. Fullscreen at 1080 actually makes it worse for the 2 machines I am testing on.

move_cube_jitter_31.zip

This video illustrates the effect I get, which is almost a tearing/jitter but vsync is on. It shows the strange effect of the cube looking very smooth, but the background jittering around it. The same phenomena is seen in the clip from Infinistate that I linked to above.

https://www.youtube.com/watch?v=b-_qXakiFDI&feature=youtu.be

@akien-mga @BastiaanOlij @CCODE05B would appreciate if you guys could try this tweaked project in a current build of 3.1 and report your findings.

@kubecz3k yes, I tried your project...it jitters for me, so we are back to square one :)

On my system described in https://github.com/godotengine/godot/issues/19504#issuecomment-396569420 I can reproduce the issue @fracteed mentions right above. Cube movement is smooth and the rest of the world jitters.

I see no jitter, I could not reproduce and the video uploaded by @kubecz3k does not show any jitter either, only stutter.

I vote we make a documentation page explaining what the difference between jitter and stutter is and what possible causes can there be, then closing this. I will change this from bug to documentation.

@aurodev , I responded to you on Youtube, but can repeat the reply here. Try turning off vsync and force fps options in Godot, and instead turn on Vsync only on your GPU. Also turn off SSAO and directional shadows as these both have poor performance in Godot currently. Let me know if this improves the situation.

Have you turned off the SSAO, as in your capture it still looks like it is on? Also, your capture is well below 60fps, and in my experience Godot will not give a smooth performance if you are below 60.

Yeah, the SSAO is a killer! In this basic demo, you are right that the directional shadow is fine, but in a complex game it kills the framerate even with one directional shadowed light. The resolution for directional shadows seems broken, as putting it at 512 or 4096 has the same performance impact for me. It is much more fps intensive than SSAO on my game.

Also you really should try having the vsync off in Godot and on in your GPU driver settings, as you will get a much smoother performance in my opinion!

I would steer clear of the force fps option along with vsync in Godot settings. There are certainly performance issues if your scenes have any complexity. My main dev laptop only has a 960m, and it is a constant struggle for my game, but I have played several commercial Unreal games on this machine with no problems. My 780ti (1060 equivalent) desktop performs much better for me and is quite smooth, as long as I don't use directional shadows.

As there is currently no proper batching or occlusion culling, there are tons of draw calls. I am hoping that the render rewrite for Vulkan will solve these issues, along with the shader compiling pauses which will drive you bonkers after a while :)

Note that in Godot 3.2 onwards, you can use @lawnjelly's smoothing add-on to solve the issue.

Closing, since there are already many other issues covering similar jitter problems. This is usually solved by using the smoothing-addon and tweaking graphics settings. We also have a documentation page about this now.

Was this page helpful?
0 / 5 - 0 ratings