All Questions

Community

B
Martin Beaussart

Tiles images bug with a drowing line on the top

It seems that the tiles images bug like that :


I wonder what i did wrong

Have you any ideas of how to fix it ? 

  • Nathan Lovato replied

    This is a texture filtering issue, and it's really common in all game engines. You are seeing it in part from how you are sizing your game view (you're zooming in onto the tilemap).

    When you scale a texture in a game engine, based on the texture filtering setting you use, the graphics cards is going to sample pixels around the pixel it's currently drawing from the texture. It then averages all the samples to draw the final color.

    As there are places that are transparent in the texture, the average gives you some semi-transparent lines.

    How to fix this

    The easy fix is to turn on pixel snap in the Project Settings. It makes your canvas snap to whole pixels, getting rid of most sampling issues. But it also causes the camera to snap to whole pixels and will reduce the smoothness of your game scrolling.

    The ideal fix is to draw all the assets that need to tile differently. You draw them with a border around them where you expand the tile.

    It's called bleeding pixels, and it is something game artists use both in 2D and 3D. 

    I haven't done that here to keep editing the tileset as simple as possible.

    But so if you wanted to get rid of those issues when you scale the game window (it shouldn't happen much if you play the game at its target resolution, without any scaling), modifying the art assets is how you would go about it.

  • B
    Martin Beaussart replied

    Many thanks Nathan for this OVER-SATISFYING response haha

    I'm really glad to know about this issue, and now i know this is related to the "bleeding pixels" key words ! I will care about this in the future for sure !
    For now, your first solution works perfectly :



    And for sure, as you mentionned, the ideal solution must be drawing tile assets correctly to avoid this !

    Thank you for the time you took to give me this answer me!