TextureAtlas seams

Anything libgdx related goes here!

TextureAtlas seams

Postby Wavesonics » Wed Dec 29, 2010 6:47 pm

So I've got a texture atlas of some tiles that I'm rendering next to each other. But I am intermittently seeing seams, the edges of other sprites in the packed texture.

Now I read the post about Texture Filters, (great post btw) And I'm using
min: NEAREST
mag: NEAREST
(no mip maps, though I tried MipMapNearestNearest as well)

The SpriteBatch is Orthographic Projection.

The textures are packed by hand and have no padding between them. I am planning on re-packing them w\ an actual texture packing program, but I would like to understand why, even with Nearest as my filter, I am seeing the edges of other sprites in the texture.
Wavesonics
 
Posts: 102
Joined: Sun Jul 11, 2010 5:10 am

Re: TextureAtlas seams

Postby mzechner » Wed Dec 29, 2010 8:29 pm

Because if you use ortho projection and move the "camera position" (if you think of it that way" to non-integer positions the sampling will be uneven as well and thus pick texels that might not exactly match pixel locations.
mzechner
Site Admin
 
Posts: 4879
Joined: Sat Jul 10, 2010 3:50 pm

Re: TextureAtlas seams

Postby NateS » Wed Dec 29, 2010 8:59 pm

1-2 pixels of padding should fit it. You can pack your stuff like this:

Code: Select all
TexturePacker.Settings settings = new TexturePacker.Settings();
settings.padding = 2;
TexturePacker.process(settings, inputDir, outputDir);
NateS
 
Posts: 1980
Joined: Fri Nov 12, 2010 11:08 am


Return to Libgdx

Who is online

Users browsing this forum: Google [Bot], MSN [Bot] and 1 guest