Help with constant screen tearing/jittering in 2D

Godot Version

4.6

Question

Hello, I have never written a forum post before so bear with me if this query is dumb or posed poorly.

I have some basic experience with Godot, but I am very much a beginner and not a programmer. I am looking to make a retro-style 2D top-down RPG in Godot 4.6, with a resolution of 640x480 using 16x16 tilesets/art.

I have created a 16x16 tilemap and a player using a CharacterBody2D with a Camera2D as a child of the player (using the built-in smoothing options at 8px speed). A basic script sets custom camera limits based on my tilemap.

My problem is that I’m getting a terrible screen tear/shaking/aliasing-grid effect when moving the player. The effect is horribly noticeable and makes the game extremely ugly and unpleasant. I have tested on two monitors and the issue appears on both (sometimes worse depending on the monitor).

I have tried a huge number of fixes and gone through nearly every combination of rendering/window/2D settings I can think of:

  • All V-Sync modes

  • All stretch modes + both scale modes

  • Several resolutions and scaling up assets

  • Changing camera zoom/smooth speed

  • SDF oversize/scale

  • Snap 2D transforms/vertices to pixel

  • Switching GL_compatibility drivers

  • Different rendering methods

  • MSAA, debanding, screen space AA, TAA

  • Manually rounding camera or player position in script

  • Rendering the scene inside a SubViewport at various resolution combinations

Of all the combinations, I have settled on:

  • Stretch mode: Canvas Items

  • Fractional scaling

  • Built-in camera smoothing

  • Camera as child of player

  • Camera zoom at 2.35

  • Snap 2D transforms + vertices to pixel ON

This gives the closest to perfect look and fixes the worst screen tearing, but it still leaves some minor tilemap jittering as the camera slows to its final position. The tilemap shifting slightly isn’t a deal breaker, but the player shakes a lot when moving and stopping. This player shaking is very noticeable and disappears when Snap 2D transforms/vertices to pixel is disabled.

At this point I am essentially at a total loss. I cannot seem to get a smooth look no matter what I do. As a beginner, it is entirely likely I have done something stupid in the setup/creation of my project. Likely most of the things I have done so far have nothing to do with the core issue, I’m aware. I’ve just basically been stabbing in the dark for about 3 days.

All I want is a clean 4:3 aspect ratio (preferably running at 640x480), with 16x16 assets and an overall smooth look and feel. I have watched many videos trying to find something that works, and in the end nothing really has.

From scratch, what is the proper/recommended way to set up a game like this in Godot 4.6?

I’ve read a few forum posts suggesting NVIDIA cards may cause similar issues, but I don’t know. Is there a way i can see if that is the case? And if so, what does that imply for my game? Does it mean it will run poor on NVIDIA devices for others?

PC specs below.

PC (Windows 11):

  • Motherboard: B850M GAMING X WIFI6E

  • Processor: AMD Ryzen 9 9900X 12-Core @ 4.40 GHz

  • RAM: 32 GB (31.1 GB usable) @ 4800 MT/s

  • Graphics: NVIDIA GeForce GTX 1060 3GB

  • Storage: 5.46 TB total

  • Displays: 1920x1080 60 Hz (main) + 1600x900 75 Hz (testing)

PLZ HELP !!!

If you turn off position smoothing does it fix the jitter? If so you should consider leaving it off and writing your own camera movement code. If you do it yourself you can set your own tolerance distance at which the camera stops moving, so the tiny fractional sub-pixel movements you get from lerp can be prevented.

It actually sounds like you have a few issues combined here. Why does the player jitter when they move? If you are using lerps then again you should set a tolerance. This is more effective than is_equal_approx as that can still be too small a delta. Without a video of the issue or any code, we are just guessing.

Start a new test project and try to replicate the jitter as efficiently as possible. Just a camera and your player, does the jitter stop?

This is a problem you have most likely created with your code. If you think it’s your video card, try switching to Direct-X as your renderer. You’ve given us a lot of information, but you haven’t given us all the right information. Please read this.

Don’t do this you will always get vertical artifacts if you do. (and possibly horizontal too).

Choose a viewport res that is multiples of 1080p, and then set the scaling to an integer of that.

So for example 480x270, and then scaling set to 4. It does limit you to 1080p aspect ratio, but thats like 99% of people out there are using anyway.