Hello all, I have a weird problem never happened before. I’m developing a 1-bit graphics game and everything I move on the screen shows weird artifacts, in the following example I have a very simple Area2D with a shark sprite, please see the vertical bar that appears from nowhere on the right of the Shark.
Is the line at the front of the shark actually the line of the tail of the next frame? It looks like that might be the case and the spritesheet isn’t arranged in a grid properly.
Not at the moment, I just creating the shark, I loaded frames but I’m not playing the animation so far. Note that I have the same exact problem on another CharacterBody2D with AnimationSprite2D where I use animation.
You can try adding padding (at least 1px) as quick and dirty solution, but keep your sprite power of 2 (32x32, 64x64 etc.).
The problem may be in sprite import, or your projects window stretch mode. Also can happen if your sprite is scaled to non integer value in game scene.
All my sprites are 16x16 or 32x32 pixel, the problem happens even if I disable windows stretch option. All sprites are kept at scale 1. I tried on 2 different macbook pros with the same result…
I slighly improved the problem setting Texture → Filtering → nearest in the properties of AnimatedSprite2D.
The problem appears much more rarely but is not completely solved. Also it is strange because I had already set texture filtering at nearest globally in project settings.
What is your projects resolution settings? Did you try to replicate problem with 1x scale (or 2x)?
I think that somewhere in your project non integer scaling is happening before you calculate position or something like that… seeing how pixels warp on your example gif (if it was captured at 1:1 resolution)
Not mac user so don’t know if it even available on mac, but try to enable hiDPI in your project settings.
Also you can try to enable in your project settings:
rendering/2d/snap/snap_2d_transforms_to_pixel
rendering/2d/snap/snap_2d_vertices_to_pixel
This will force 2D rendering to snap to integer values (for full retro feel), while keeping all calculations in floats. But non integer movement will look choppy.
Thank you very much! With all the setting you kindly suggested to me, the problem is greatly improved, but it still happens on a totally random basis, this time only when the shark moves from right to left. I’m puzzled!
Without seeing project itself, i have no idea, at the moment, where problem can be.
Maybe try Compatibility rendering mode (if OpenGL is available on Mac).
It may be some rare bug with renderer or sprite import.
Did you try adding padding to a sprite, it should definitely fix the issue because its looks like texture wraps around.
One idea to test, try to replace your AnimatedSprite2D (if you are using one) by simple Sprite2D, maybe problem with some settings in there. I was doing my tests on Sprite2D and animating trough it’s animation settings.