2
\$\begingroup\$

I'm trying to use a TextureAtlas for all my textures for better performance. Every time my game starts all my tiles are packed into one texture atlas. I have put following code into my DesktopLauncher class that does that:

TexturePacker.Settings settings = new TexturePacker.Settings();
settings.maxWidth = 512;
settings.maxHeight = 512;
settings.filterMin = Texture.TextureFilter.Nearest;
settings.filterMag = Texture.TextureFilter.Nearest;
TexturePacker.process(settings,"blocks","texturePacks","blockPack");
TexturePacker.process(settings,"items","texturePacks","itemPack");

The atlas is loaded with the asset manager and I'm getting the texture region with

atlas.findRegion(..);

It all works, but I have came across an issue. The texture is not filling the whole space anymore. It should fill a 32 by 32 pixel area, but it doesn't. Here is a picture of whats happening:

There are fine blue lines between the tiles and I don't know what I'm doing wrong. My background is blue, if that's helpful information.

I have tried so far:

  • Loading the texture region from the .png file directly -> no blue lines, so it is an issue with the texture packer

  • Changing the texture filters, but no one I have tried helped

Thanks in advance for any comments and answers!

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

I don't know if it will helps you but, I had a similar problem. I resolve it by adding a border to my assets in "TexturePacker". You just have to open the "Advanced Settings" Advanced Settings

And at the bottom, just add a border padding of 2 pixel as it recommended. Border padding

It should help you =)

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .