Topic was automatically imported from the old Question2Answer platform.
Asked By
zdimaria
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:
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: GitHub - crashinvaders/gdx-texture-packer-gui: A simple way to pack and manage texture atlases for libGDX game framework. , 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).
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.
I have the exact same problem but can’t find how to disable Filter
zhadeOak | 2019-11-17 05:39
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.
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:
…/…/_images/tileset_filter.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.
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.
If true, generates an internal texture with an additional one pixel padding around each tile. Texture padding avoids a common artifact where lines appear between tiles.