Random glitch in tiles

Hi,

Sometimes get gaps in tiles on the horizontal as can be seen below in first dirt block of tiles (second row). Any ideas why this happens or could be happening?
If I render the scene to fbo then it is fine, but direct to screen, I get gaps now and then?

Thanks

This is called texture bleeding. Your texture region for each tile type has an area from your main texture. However, sampling of the texels can lead to “bleeding” from outside of that region.

There are some solutions to this problem. First, you can add padding to each region in your atlas, and extend the edge pixels outwards so when it samples, it will sample from the “same” texel.

If you don’t feel like redoing your entire atlas, you can shrink the texture region area a tiny bit by a fraction of a pixel and it usually solves it. I have a utility class here you can freely use. Simply apply the debleeding method to each of your regions and it should be good to go. The default value is 0.25 of a pixel, and its effectiveness can vary from 0.01 to more than 0.25. Try what works for you.

or you disable filtering, clamp to the texels you want to draw and do manual filtering.

do you use large pixelated textures ?

make sure your window has a power-of-2 dimension. Anything else, can make your textures not full fit together.
Guessing your FBO is a power of 2, so the problems aren’t there.

possible the same as this problem:
http://www.java-gaming.org/topics/libgdx-rendered-tiled-and-non-tiled-sprite-lines-not-smooth/37401/view.html

Many thanks,

My rendering target is 1920x1080 so not power of 2 - fbo’s are so this is why works with them.

Set res to power of 2 and all fine :slight_smile:

Thank you.

Are you using OpenGL/Slick-Util?

Hi,

LibGdx. Got it sorted anyway, wasn’t using power of 2 for render target.

told ya! ;D 8)