Wobbly movement on pixels (hardware related?)

Godot Version

v4.2.1.stable.official

Question

So i don’t know if this is an issue with Godot itself, or hardware related. But when testing games my character’s sprite tends to be rather janky in its movement. It’s particularly noticeable with white sprites on black background, sometimes pixels will suddenly “jump” forward. And the character sorta jitters around all the time, it’s super bad on diagonal movement.

I played around with Godot’s settings, VSync, FPS, Antialiasing, Pixel Snap, etc., as well as the settings on my Nvidia card, and the settings on my monitor directly. Nothing seems to fix this. I can make even worse, but i can’t make it go away.

I seem to have a very poor monitor, the amount of ghosting i get is through the roof. And i didn’t even know ghosting was a thing until i started making games and noticed how awfully blurry my sprites become. So is that just it? Is it all just my monitor/hardware’s fault, nothing i can do?

Yeah i already tried everything there. No dice.

any screenshot or video, how exactly does the problem look like?

maybe it would be good to try the project on other hw( another notebook, friend computer etc. ) if this problem is also manifested there

After doing some research, it seems i’m suffering from the exact same problem described here:

The blurryness may very well be my monitor, but this weird “jumpyness” of the sprite really is a Godot specific problem. And as far as i can tell, nobody has a cure-all fix for it.

I’ve been having this issue ever since i started working with Godot over a year ago. I’ve been ignoring it to my best ability, figuring i’ll stumble on a solution eventually. But if this is an Engine problem, then frankly, i’m giving up and just live with the crappy visuals. I’m no tech expert, i have no clue how pixel calculation or physics engines work under the hood. I just wanted to make some games for fun.

Shoulda gone with Unity.

including texture filter?
also i dont know how is your character sprite looks like, is it a pixel character?

is this what it looks like? it was solved here if it is a similar case

It’s a very small sprite, 32x32. The base viewport resolution is 512x288. I’m not changing the sprite’s scale. And even running the game while keeping it at its native tiny resolution, the sprite appears to jitter. (Though hard to tell with a tiny window size like that.)

The sprite will move relatively smoothly with these settings:

Vsync = OFF
Pixel Snap = OFF
Stretch Mode = Canvas_Item
Aspect = literally doesn’t matter, same jitter in all modes

Pixel Snap makes it significantly worse, sprite is freaking out all over the place. Vsync makes minimal to no difference as far as i can tell.

But no matter how much i play with the settings, the “jumpiness” will persist. My sprite moves smoothly for a couple of seconds and then BANG, shakes back and forth for several seconds. Until it calms down again for a few seconds, and then ZAM, back to shivering. It repeats in a cycle.

Apparently subpixels (and i hardly understand what that means?) can cause a problem. So one suggestion is trying to round the pixels to full numbers before getting applied to velocity. Ok. Tried that. Doesn’t make a difference. Though it’s very possible that i’m not applying the rounding correctly (or misunderstanding what exactly you’re supposed to round, i’m still at a beginner level as far as coding goes.)
I mean the rounding doesn’t appear to do anything, seeing how there’s still decimals in the velocity’s printout.

Screenshot 2024-02-29 084851

So maybe my movement/input code is just trash, and that’s the root of the problem?

func move_state(delta):
	var input_x = Input.get_axis('LEFT','RIGHT')
	var input_y = Input.get_axis('UP','DOWN')
	var input_axis = Vector2(input_x, input_y)
	if input_axis != Vector2.ZERO:
		var round_x = move_toward(velocity.x, input_x * MAX_SPEED, acceleration * delta)
		var round_y = move_toward(velocity.y, input_y * MAX_SPEED, acceleration * delta)
		round(round_x)
		round(round_y)
		velocity = Vector2(round_x,round_y)
	else: 
		var round_x  = move_toward(velocity.x, 0, acceleration * delta)
		var round_y = move_toward(velocity.y, 0, friction * delta)
		round(round_x)
		round(round_y)
		velocity = Vector2(round_x,round_y)
	print(velocity)
	velocity.normalized()
	move_and_slide() 
	move_animation()

try set to nearest mipmap
also because you want sub pixel perfect sprite, then you will need shader Sub-Pixel Accurate Pixel-Sprite Filtering - Godot Shaders

and filtering is turn off? when you imported the image

there are other settings in project settings, I don’t know what all you tried

obrázok

and disable the filter here when reimporting( import tab )
obrázok

My current settings:

Activated mipmap & re-imported the sprite as well.

But I doubt it’s my sprite or filtering that’s the problem here. If it was, wouldn’t it be jittery all the time? It only jitters sometimes, which makes it highly suspect that it’s the engine that’s causing the issue.

I’m uploaded a video of it to youtube, it’s a bit tough to make out on recording (make sure to it to HD), but if you look closely you notice every now and then the pixels “jump” forward. It’s a lot more noticable when running the game directly.

And it happens both when testing the game in Godot, and exporting the game to an .exe file.

Also, i tried setting the physics_jitter_fix to 0, and then to ridiculously high values, changes nothing.

edit: Also tried running the movement code in process and phyics_process to see if that makes a difference. No difference.

I even tried running the game on a different lower resolution monitor. The jumping is there the exact same way.

The most frustrating thing here is that i just don’t know WHAT is causing it, so i have no clue where to even begin to start fixing it…

use shader

This shader? Does nothing.

Also that seems to be for Godot 3, so i don’t know if that works at all with Godot 4. I have the shader applied to my sprite, i see no change. Unless i’m missing another texture setting somewhere.

*edit, Alright setting filter to Linear does make the sprite’s outline more smooth when moving. That’s nice, but.

But that isn’t the main issue i’m having. My issue is the jumping. And i’m slowly feeling like i’m taking crazy pills because nobody else seems to even see what i’m even talking about.

I swear, either my pixels are jumping or my computer is haunted.

in project settings

the one i sent here, not that

I tried that, and it makes it MUCH worse. Makes the sprite jitter non-stop.

Same result for both shaders. And these don’t fix jumping, these fix the outline wobbling.

and isn’t the sprite of the character actually scaled in some way?

this is what’s happening to you
ex
ex2

and you need to get to this
ex3

have a look at these links maybe it will help

the link I sent above, it was solved and partially solved, I don’t know if you checked the topic

I feel like we’re talking in circles. What you’re showing me here with the green squares is the “wobble” effect which yes, that is fixed by the shaders.

But that isn’t my problem.

My sprite doesn’t wobble smoothly, my sprite JERKS like an actual jump of several pixels.

Imagine holding a paper cutout of a sprite in your hand. You move it perfectly smoothly to the right, and then you suddenly jerk it quickly forward. And then move it smoothly again, and then suddenly jerk it forward again. That is what my eyes are seeing on my screen. Someone jerking my character’s sprite violently forward every couple of seconds.

Since nobody else seems to even see what my problem is, i’m yet again back to thinking that it’s my own hardware that’s causing problems.