+2 votes

I have a tilemap that has edge issues on some of the tiles. I have checked both in gimp and in the editor that the tiles are pixel perfect.

When looking at the tilemap in the editor, there are none of these issues. They only exist while the game is running.

I've tried both filter and not filter on the texture flags, filter clip on the sprites and Use Pixel Snap in the project settings, but nothing has helped.

Are there any obvious things that I can check to help figure out what the issue is?

here is an imgur album with screenshots showing my issue:
https://imgur.com/a/xTcBM

in the editor, no issues:
in the editor, no issues

in the game grey edges == no good!
in the game grey edges == no good!

in gimp, 32x32 grid
in gimp, 32x32 grid

1x1 grid in editor
1x1 grid in editor

32x32 grid in editor
32x32 grid in editor

32x32 grid in texture region selector
32x32 grid in texture region selector

in Engine by (232 points)

4 Answers

0 votes

Have you tried the trick of creating a 1 pixel border around tiles that duplicate the pixel next to it? Assuming your problem is the usual artifact seen in games with tilemaps, this is the best (if most complicated) way to handle it. I believe this tool from libgdx can do it automatically: https://github.com/crashinvaders/gdx-texture-packer-gui , but you might have to fool around with the settings a bit to be able to use the output textures with godot. A simple way to test if it is the usual problem would be to use separate pngs for all the tiles and see if the problem disappears (you can do this in your project too, but it might get a little heavy if you have too many separate tiles).

by (529 points)
0 votes

FYI if you running Godot 3.1 you can solve this by selecting the asset used for the tileset and disable "Filter" and re-import the asset then it removes all the anti-aliasing and fixes the issue.

by (14 points)

I have the exact same problem but can't find how to disable Filter

FWIW, filtering doesn't solve it for me. I already had it off and I'm still getting issues with tile edges bleeding at certain camera zoom levels. I've made sure that the tile boundaries in the tileset are correct (they are indeed pixel-perfect), there seems to be deeper issues with the UV coordinates or sampling. Would love to have a better solution than adding extra padding to my texture pack.

0 votes

This could be helpful

Offset and scaling artifacts
When using a single texture for all the tiles, scaling the tileset (or even moving to a non pixel-aligned location) will most likely result in filtering artifacts like so:
enter image description here
../../images/tilesetfilter.png This is unavoidable, as it is the way the hardware bilinear filter works. So, to avoid this situation, there are a few workarounds. Try the one that looks better for you:

  • Disable filtering and mipmaps for either the tileset texture or all tile textures if using separate images (see the Importing Images
    asset pipeline tutorial).
  • Enable pixel snap (Set Project > Project Settings > Rendering > Quality > 2d > Use Pixel Snap to true, you can also search for Pixel
    Snap).
  • Viewport Scaling can often help with shrinking the map (see the Viewports tutorial). Simply adding a camera, setting it to Current
    and playing around with it’s Zoom may be a good starting point.
  • You can use a single, separate image for each tile. This will remove all artifacts but can be more cumbersome to implement and is
    less optimized.

https://docs.godotengine.org/en/3.0/tutorials/2d/using_tilemaps.html

by (22 points)
0 votes

I had a very similar issue when having textures tiled like this. I was able to solve it by disabling the "Repeat" flag in the texture import. Hopefully this can help someone else as well.

by (14 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.