Seeing line artifacts when running


Do you know why appear to me so many artifact lines?

Here moving the player:


Thank you and keep up the good work!


  • Nathan Lovato replied

    This is a common issue unfortunately in many game engines. The way tilemaps work is that your graphics card is going to draw each tile side by side and for each of them the graphics card has to go fetch the corresponding tile's region on the source texture and draw it on the screen.

    But as the camera moves the drawn tiles don't map exactly to pixels on the screen and there are small number errors that cause the graphics card to sample transparent pixels next to your tile map texture.

    Long story short, you can address this in Godot 3 by going to your project settings and looking for GPU Pixel Snap. This option prevents those small number errors and make sure there are no gaps in exchange for slightly less smoothness in camera movement.

    This is the easy solution. The more complicated solution that you have to use in most engines is to design your textures in such a way there is an extra border around each tile to prevent the graphics card from sampling transparent pixels (which is what causes gaps in the first place).

    Note though that Godot 4 has this feature built in, so once you start using Godot 4, it will do that automatically for you.

    2 loves