Make sprite movement smooth

Godot Version

4.2

Question

I have a problem smoothing the movement of sprites. Especially when you zoom out/in with the camera, the sprites start to flicker.
Here is an example (note the side edges of the square):
ex

The image is 55px wide and the camera zoom is at 0.6. I thought there was a problem with it if you e.g. zoomed to 0.5 there are no half pixels and that’s why it flickers, but at 0.6 the 55px image should be at 33px and move normally. Does anyone have an idea what exactly the problem is?

Code:

extends Sprite2D

func _process(delta):
	position.x += delta * 20

I can rule out input lag because the sprite moves without of input.
I’ve tried everything in the linked forum post, but nothing changed. With the camera zoom 1.0 or higher it is hardly noticeable, only when I go below 1.0 is it more noticeable.

I tried lerp and also the jitter addon, nothing changes the phenomenon (I don’t think the plugin helps here anyway, since the sprite is moved normally in the _process function instead the physic_process)

EDIT:
The slower you move the sprite, the clearer it becomes. here is another example: (position.x += delta)
ex2

It looks like each square is moved individually, instead of simply moving a 55x55 box from position 0 to 1

and what are the native dimensions of the green bitmap? and is the square scaled?

obrázok

and turn off Flag Filter in Import:
obrázok

Based on my guess with half a pixel, I based my tests on only moving the sprite by as many pixels as the camera zoom value is set. i.e. with 1.6 only every full 5px.
Actually only then will the sprite move without being distorted, but of course only with a very stuttering effect. I wonder how the other game developers solve this problem, because it’s the same everywhere, you can’t display half pixels…

Sure, it would be possible to only set zoom to full values ​​(1.0 / 2.0 / 3.0…), but there are so many games where the zoom works seamless and everything doesn’t move just like a predator…

The sprite is at its original size. Its 55x55 px
Importfilter (Nearest/Linear) also change nothng in movement

there is no such thing :slight_smile: there is only a pixel, it can’t be split… rendering filters the information what pixel to put on the physical pixel of the hw screen from the texture, there can only be one at a time

Yes, that is exactly what I mean…
I just thought you could somehow tell Godot to just move the sprite pixel by pixel, and if you want it to move by 1.5, then move the image by 1 pixel and next time by 2 pixels. …

Currently the image is basically pulled apart slightly because the right side moves while the left side stays still and in the next frame the left side is drawn.

can you please tell me the path in the settings where to find these options?

click on the image in the godot filesystem and then click on the import tab and there you can set everything you need and reimport

ex3
(Each white bar is exactly 1 pixel in the original, camera zoom is at 3.6
There is 1 pixel space between the bars)

Okay, so from the coordinates it seems to move pixel by pixel, only the screen pixels are spread apart differently, so that it gives this spongey impression, because that’s exactly why the sprite always seems longer depending on its position, especially if the sprite moves a little bit faster.

But in the import inspector I can’t find the options you mentioned above. Wasnt it in the project settings?

yes, it’s in project settings


and then it is better to process the motion in _physics_process(delta)