Help with PixelArt Viewport Settings

Godot Version

Godot 4.2.1

Question

I am creating a Pixel art shooter using viewport settings at 320x180 upscaled to 1280x720. This gives me the effect I want, but there is a problem while rotating my pixel art guns. At specific rotations, you can see some strange pixels that seem to be the outline of the texture. (The texture is a bit bigger than what you see, just because some guns are bigger than others, and I want the size to be consistent).

Here are some screenshots showing my problem:


I will gladly provide more information if you need it.
Any help would be awesome!

So you’re using a sprite sheet with region_enabled?

Having access to the texture (and region rect) you’re using would surely help! A minimal example project showing the problem would be even better!

My best guess would be that your regions are slightly too big or the gaps between regions are too small, and the “strange pixels” you’re seeing are anti-aliasing pixels from the neighbouring sprite (hence they only appear at specific rotations).

I am using a Sprite Sheet, but I do not have region_enabled.
Instead, I am actually using the Animation tab on Sprite2D. I have a proper amount of Hframes and Vframes, and depending on the gun I want, I just set frame_coords to the sprite I need. Should I switch to a region rect?

Also, here is the sprite sheet; each gun is 48x24p:
Weapons

I’ll make a minimal example project if this is not enough information.

What is your “Default Texture Filter”? (ProjectSettings > Rendering > Textures > Canvas Textures > Default Texture Filter) If it’s “Linear”, then yes, as I suspected, what you’re seeing there are the anti-aliasing pixels from the neighboring sprites. Setting it to “Nearest” should make the artifacts go away, though.

My “Default Texture Filter” is Linear, but I changed my code to use the region_rect, which solved the issue!

Thanks for the help @njamster!

1 Like

Nice! You might still want to open up an issue for this, though. There might be a technical reason for why the result differs between using region_rect and frame_coords, but it’s nothing I would have expected myself either.