Pixel image strangely distorted, I'm stumped

Godot Version

4.6

Question

Hey all, I’m running into this weird problem and I wanna make sure I’m not doing anything wrong before claiming it’s a bug. I have toyed around with texture compression settings but didn’t get anywhere.

I wanna make a prototype of a badminton game, and I’ve draw a court to official scale (where 1 pixel is 1cm). An official court is 6.1m x 13.4m, so that gives me an image of 610x1340. In this image I have carefully measured the dimensions of everything. White lines are 4 pixels wide, and the different areas have the dimensions written in the image. For example the top left green area, “back court side”, is 42x72, then directly on the right of it there’s a 4 px wide white line, then a 253x72 px wide backcourt area. The white vertical line at the right edge of the picture is, like all others, 4 px wide. Everything was done and measured in Aseprite.

Here’s the image, you can check that its dimensions are indeed 610x1340.

Now, problems start right from the editor, hovering over in the FileSystem inspector, where it incorrectly states that the pic is 612 wide, not 610.

Using the measuring tool in the editor, this top left area is indeed 50 px wide (4 + 42 + 4):

The next area, even though it is really 253 px wide in Aseprite, is measured in Godot at 252 px. In Godot, still, the last white vertical line is shown and measured at 6 px wide instead of 4! You can try this for yourself and check the original PNG above.

Also - and this might be related - if I just add the image as a Sprite2D with the origin in the center of it, it’s weirdly offset by 1 px to the right. But maybe this last thing has to do with the width of the image being an even number? Not sure if there’s a way to handle that.

Help appreciated!

MSPaint agrees with you that it’s 610x1340. Try reimporting it. I copied it from your post and saved it to MSPaint and then dropped it into a godot project, and it showed me the correct 610x1340 dimensions.

I just dragged you png into a scene and it correctly lists it at 610x1340.
Try it yourself on a clean/empty project.

I tried numerous import changes including VRAM compressing and it never reports anything except 610x1340.
How did you load it?

The file system inspector keeps showing 612 pixels wide even after reimport, but the dimensions show correctly in the Sprite2D inspector, see below:

I loaded the texture by dragging it from my Assets folder onto the Sprite2D texture property. This is probably a stupid question but how do I make it NOT a CompressedTexture2D?
I have deactivated all compression in the rendering settings, and I’ve set the filtering to “nearest”

In fact I was able to reproduce the problem being VRAMCompression.
Its in the import settings at the top under Compress/Mode.
Change that back to lossless (and reimport) and it will report correctly in the file manager.

1 Like

That fixed it! thank you very much!