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

Wobbling/Jittering of tiles in Godot 3.3 but not Godot 3.2.3 on Linux with 75 hz display #48200

Closed
Daniel-da-Silva opened this issue Apr 26, 2021 · 16 comments

Comments

@Daniel-da-Silva
Copy link

Couldn't find one that had this problem only when changed to 3.3

Godot version:
3.3

OS/device including version:
ThinkPad X220, Mx Linux always updated,, i5-2520m

Issue description:
When I opened the same game with Godot 3.3 there is sometimes a small but noticeable jitter/wobble on the Tilemap when not moving while playing.
This only happened on my 75 hz monitor, not on 60 hz monitor and it only happened on Linux on this monitor (tested it on Windows with the same monitor). This doesn't happen with Godot 3.2.3.

Minimal reproduction project:
I wanted to upload my game but it was too big and since it seems oddly specific I don't know how much of use it is. Still wanted to mention it. Maybe there's a setting I can try? GPU Pixel Snap seems to improve the problem but not solving it and the character movement looks awful with it - so it won't be of much use.

@Daniel-da-Silva
Copy link
Author

Also wanted to add - this only affects my 2D Platformer - my 3D project is totally fine after upgrading.

@lawnjelly
Copy link
Member

Maybe making a video would help?

@Calinou
Copy link
Member

Calinou commented Apr 26, 2021

@Daniel-da-Silva Please upload a minimal reproduction project to make this easier to troubleshoot.

Also, try installing, enabling and configuring the smoothing-addon to add physics interpolation to your project. It's expected that there will be jitter when the monitor refresh rate isn't a multiple of the physics update rate, so you need to add interpolation. See Fixing jitter and stutter in the documentation.

@Daniel-da-Silva
Copy link
Author

@lawnjelly The ThinkPad I use isn't very strong, I don't think I could really show it since the framerate would be so choppy. I don't have a capture card and you don't really see it when I captured it with my smartphone :/

@Calinou I used the addon but it didn't change anything. I'm confused because of two things: It wobbles, jitters when nothing moves - the tilemap - and secondly it wasn't the case with 3.2.3

Anyways - I deleted the import folder and now my game is small enough

Instructions: Walk to a language door. Press space.
Walk to the start door. Press space
Fall down. Stand still. And see the wobble (or don't see it) especially in the area in the picture but also on other parts on the tilemap.

BBTS_Godot_Github.zip
wobble

@lawnjelly
Copy link
Member

I couldn't see any wobbling / jittering of tiles (Linux Mint 20, Intel HD graphics 630), so it's really hard to give much feedback, there can be lots of source of wobble / jitter.

Vibrations can sometimes happen as a result of physics, I would try having the camera / player not use physics and see if that cures it.

@Daniel-da-Silva
Copy link
Author

@lawnjelly Do you have a monitor with above 60 hz? Because on 60 hz I also see no wobbling. I'm just wondering if it has to do with the changes from 3.2.3 because it works without any wobble in 3.2.3 and if I could change something there but turning Batching off didn't change anything. The only way if someone has a 60 hz monitor would maybe be overclocking it to 65-70 hz, sometimes this possible but I don't think the effort is worth it.

Do you mean putting the code instead of physics process into process? This didn't change anything. And camera is on idle. Sorry, I'm not sure, what you mean with not using physics. Thanks for putting the time in!

I don't even know if this would be a dealbreaker for upgrading to 3.3 because it could be very well only my machine making something weird and who uses 75 hz?

@lawnjelly
Copy link
Member

My monitor seems to be 60hz on looking it up. But in godot you can change the physics tick rate from 60. At odd tick rates I can see some nasty jitter, but that is what fixed timestep interpolation is used to correct for, if you see the link Calinou posted.

What I mean by not using physics, is to not move your player / camera with the physics engine. In godot you can move something either by applying a force to e.g. a rigidbody in the physics engine, and letting that move your object, or you can move the object position directly, and not use a physics object.

Maybe you aren't using physics already, but your project is rather large and it is hard to work out. Basically if you press left you can move the player position directly in process or physics_process, and use the delta to decide how far to move. Probably in process if you want to remove the possibility of aliasing between physics ticks and frames. If that removes the wobble then you know it is something physics related.

In 3.3 I can think of two things which may have changed and could be affecting you:

  • The 2d camera no longer has a frame delay
  • Physics may have changed

Other than that without seeing what is happening for you, it is pretty difficult to diagnose. Maybe another contributor will see this wobble.

@Daniel-da-Silva
Copy link
Author

Hey, thanks again for putting time into an oddly specific issue that's unlikely to be common.
I tested 75 fps as physics in Godot 3.3 and the wobble still was there (and the game runs at 200-300 fps without vsync in windowed so it should handle this). With 100 fps in Godot 3.2.3 it didn't happen. So it seems unrelated to this and rewriting it seems a relatively big task for an issue that likely is specific to this configuration (since it isn't on Windows, although my Windows PC is stronger)

The delay would seem an odd reason since I stand a longer time on one place.

Maybe jitter or wobble is the wrong word - a slight constant shivering on the tilemap? And also text it seems - I saw that in the options.

But! Good news - it's really bad quality but I could catch it on camera!

VID_20210426_234803.mp4

@Calinou
Copy link
Member

Calinou commented Apr 26, 2021

Maybe jitter or wobble is the wrong word - a slight constant shivering on the tilemap? And also text it seems - I saw that in the options.

In this case, this issue seems to be very close to #48130.

@Daniel-da-Silva
Copy link
Author

@Calinou I saw that issue but I thought this was a problem which was also in Godot 3.2.3 or before since in my case it's only in Godot 3.3. 3.2.3 (and 3.2.2 for that matter) are totally fine.

@lawnjelly
Copy link
Member

lawnjelly commented Apr 27, 2021

This kind of thing is usually due to a small vibration in the camera position, which can cause a relatively large change in the image because of sampling error (to pixels) - i.e. float to integer conversion. If some texels are just on a boundary of a whole pixel, and you have any tiny fractional variation in the camera / object, you can get vibration of this sort.

As I say this is most likely to be caused by your physics (or even a bug in your gdscript, I haven't examined it).

It is also possible that some filtering mode / offset has changed between 3.2.3 and 3.3 and accentuated the effect, but you need to use a process of elimination to find the cause, you have to act as a detective - there are multiple possibilities. Things like the match between object positions and the camera, off by one errors in scaling, especially with viewport sizes can also accentuate this.

If you programmatically set your camera position to a fixed value, and the objects, and still get vibration, then it would be very odd, so I would suggest you test this. If fixed camera and object still gave vibration it might suggest a problem with double buffering, when it is swapping between a previous and current frame in slightly different positions, and these are never being updated.

This does cause the kind of effect seen (regularly though, every pair of frames), but usually we'd get lots of users experiencing this, unless it was an issue with your specific GPU.

@Daniel-da-Silva
Copy link
Author

@lawnjelly You were right! Thanks! It's the physics - at least as far as my understanding goes. I put in a piece of code to teleport the character to the level where the wobble was. In one test I had move_and_slide commented out and there was no shiver. When I commented it back in it shivered again. Even with no movement (maybe the player falls half a pixel after getting into the level when move and slide is processed? The camera is btw just attached to the player it doesn't have an extra script)
It just is so strange that it yields different results on different machines.

But how can I fix that?

@lawnjelly
Copy link
Member

But how can I fix that?

You will have to get creative. This is similar to the problems involved with 2d snapping and jitter, and there has been a considerable amount written in various issues trying to solve it.

@Daniel-da-Silva
Copy link
Author

That's a bummer ... I can't really justify investing the time to solve this issue since I don't really need any of the features of 3.3 for that game (the learning would be awesome but I need to work on my 3D game which had no problems after upgrading but doesn't use any physics). Staying on 3.2.3 and trying out 3.3.1 etc. is likely the best option for me at the moment.

@non-nattawut
Copy link

non-nattawut commented Oct 8, 2023

I have an workaround update to this issue

THE ISSUE
My issue look alike but not same as author issue. It is tile wobbling but for me is happen only player moving.
So white pillar tile (in video) is wobbling/shaking when player moving on 75Hz monitor refresh rate, on 60Hz refresh rate look fine

SOLUTION in reproduce project

  1. My 75Hz Monitor have tiles wobbling when player moving, When is alter value of physics/common/physics_ticks_per_second from 60 to 75 its looking fixed (sometimes still wobbling but not much)

  2. use _process(delta) instead of _physics_process(delta) with update position instead of use move_and_slide() seem fixed too. and alter value of physics/common/physics_ticks_per_second take no effect, still work perfectly

SOLUTION in my main project
for solution number 1 is working but if stare/focus a bit. it still have little tile shaking/wobbling
for solution number 2 is not working still need to adjust physics/common/physics_ticks_per_second to 75

SOLUTION that I tried but not work

  1. solution of Document Camera2D avoid Jitter in pixel perfect games godot-docs#7774 not work
  2. smoothing addon
  3. FPS limit
  4. Disable Vsync
  5. Change Renderer to Forward+ and Mobile

VIDEO
First half of video is physics_ticks_per_second = 60
second half is 75
Actually in video see no different, I dont know why, and I tried record on my phone but still no different in video.
But in my screen its fixed.
https://github.com/godotengine/godot/assets/67323548/6aecfdc9-648a-4eb2-9b9f-08aeee32a4f5

REPRODUCE PROJECT (This issue I met on both 3.x and 4.x version of GODOT)
test-for-tilemap-wobbing-4.X.zip
test-for-tilemap-wobbing-3.X.zip

PS. on your hardware maybe not met with any issue. I asked my friend that test on GODOT 3.x with 90 and 144 Hz, result in He's not met any issues

My PC

Monitor1 : Acer VG240Y (50 and 75Hz tested and met issue) , this monitor limit at 75Hz
Monitor2 : SM2333T (50Hz tested and met issue), this monitor limit at 60Hz
***Both monitor tested on 60Hz and see no any problem with tile shaking/wobbling

OS : Windows 10 64 bit
GODOT : 3.5.3.stable , 4.1.2.stable (tested on my PC)
GPU : NVIDIA RTX 3060TI
CPU : Ryzen 5 3600

@Calinou
Copy link
Member

Calinou commented Oct 8, 2023

Closing in favor of godotengine/godot-proposals#2753, as this issue is dependent on the lack of built-in physics interpolation in 2D (and in 4.x in general).

Note that even once physics interpolation is implemented, you will need to make sure your camera movement is a multiple (or divider) of the monitor refresh rate for it to look perfectly smooth without any stuttering. This is not specific to Godot – it's mathematics 🙂

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

4 participants