Camera movement causing tile corner's to round when moving diagonally

Godot Version

Godot 4.3.stable.mono

Question

I’m having an issue that’s causing a rounding effect to happen to the corner of my tiles when I move my camera around the scene. It’s only happening when the camera’s in motion diagonally (so north-west, north-east, south-west, south-east). The corners appear sharp as expected when I move the camera in only the x or y axis.

It’s odd because when I try takinng a screenshot the corners appear sharp as normal so it seems this effect only appears in motion. I’ve recreated the effect below. Left is no camera motion, Right is with diagonal camera motion.

Godot Issue - Camera Movement Causing Rounded Tile Edges

My scene is 2D. Originally I thought it was related to my player character’s movement as my camera was simply just nested under my player. However it appears to be a camera movement issue as when I unnested the camera, the player could move around and the corners wouldn’t be affected. If I nest the camera under the player again, to follow the player, this issue pops up again.

The camera currently has no script attached to it.
The script for the player is this:

extends CharacterBody2D

var movement_speed = 80

func _physics_process(_delta):
	movement()

func movement():
	var direction = Input.get_vector("left", "right", "up", "down")
	velocity = direction.normalized() * movement_speed
	move_and_slide()

	position = position.round()

What I have noticed is that if I increase the movement speed the effect gets more pronounced and the roundedness is more drastic and large. It also appears that the edges seem blurred. I have tried other scripts to move the player with the camera nested but the effect still occurs.

So far I’ve tried:

  • Changing the Physics Ticks per Second
  • Enabling and disabling every Anti Aliasing option
  • Changing the renderer
  • Changing the default texture filter
  • Changing the camera’s and tilemap’s CanvasItem’s texture filter to Nearest
  • Enabling and disabling snap controls to pixels
  • Enabling and disabling V-Sync
  • Change the viewport sizes
  • Use only interger values for scaling and zoom (currently set to 1)
  • Enabling position smoothing
  • Disabling and enabling pixel snap
  • Creating a new scene from scratch, the effect is still there
  • Changing the scale of Windows
  • Recreating a test scene using MacOS, the effect is still happening
  • Disabling and enabling texture padding
  • Using different scripts to move the player around

Just wondering if anyone else has encountered this issue before or has an idea of where I’m going wrong. I’m new to Godot so forgive me if I’ve missed something obvious. Very appreciated, thanks!

I you can’t take a screenshot of the effect, the problem is probably that the pixels in your screen can’t change fast enough, and it’s not really even related to Godot.

Using Window’s snippet tool I couldn’t capture it but I managed to capture the effect in action with OBS. I even tried testing Brackeys’ tutorial and that has the same effect but to a smaller degree because of the camera smoothing.

This quick scene is using viewport width: 240, viewport height: 135, stretch mode: canvas_items, aspect: keep, scale: 1, scale mode: integer. And the scene is running at my monitor’s refresh rate of 144 fps. I even tried reducing the refresh rate of the scen to 60 and it’s still prevalent.

I do not see your described issue in the video, it is likely your monitor, eyesight, or a fact of life.

2 new videos with the camera much closer. Look at the corners. It isn’t my monitor, I’ve checked the scenes and the videos on both my desktop (Windows) and laptop (Mac) and it’s appearing on both. And it’s not my eyesight, wife sees it too.


Pretty sure that’s an optical illusion. I can’t explain why or how, but I’ve seen that many, many times before and I’d wager a lot of money that’s it’s only our perception that skews it that way, not what is rendered.

2 Likes

I can see the effect on the last video you posted, and it looks like an optical illusion caused by the presistence of vision combined with choppy movement. The corners are moving significantly more than 1 pixel per frame, which makes it hard to properly follow them with your eyes, and 60 fps is fast enough to make it impossible to distinguish individual frames.

If you try the same thing with a very low framerate (15 fps or less), the corners should be sharp, because you can clearly see the individual frames. If you try it with a very high framerate (240 fps or more), the corners should also be sharp, because the smoothness allows you to follow the movement. The weird illusion happens between the two extremes, where the movement is kind of smooth but not smooth enough.

Edit: I just realized that the illusion has nothing to do with the brain filling in the gaps, like I originally thought. Instead, when you’re trying to track the moving object with your eyes, your eyes are moving smoothly while the object moves in steps. So from the prespective of your eyes the object moves gradually in one direction and then suddenly jumps is the other direction. This sweeping motion together with the persistence of vision creates the diagonal lines on your retina.

2 Likes

You can set those videos to 0.25 playback speed.
For me it then looks like the corners are indeed sharp, but there is a “ghosting effect” where I see the edge outline slightly offset.

Ghosting could be explained by the video codec/compression/etc.