0

I read all the million posts about the problem with black lines shown on screen when rendering tilemaps on libgdx. All the solutions talk about add padding to the tile sets. So I did it, but it didn't solved the problem. I think maybe I didn't understand it well, so I will post here the process I'm doing, and I will be glad if someone can point out my mistake, if any:

This is an image of my initial tile set:

initial tile set

This is an image of my tile set after adding padding using GIMP plugin which was suggested from this post:

tileset after padding

Then in Tiled, I add this tileset and set Margin to 1px and Spacing to 2px like written in this post.

Now as I understand the problem should be solved, but still when I run the program I get:

result

I can add code parts if you want, but there is really nothing special the way I render my map- just load it with TmxMapLoader and render with MapRenderer (using camera also, of course, otherwise the problem wouldn't appear).

dot_Sp0T
  • 389
  • 4
  • 26
TNT6
  • 1
  • 2
  • I think you understood It wrong, let me give you a hint, If you used the plugin right, you could get a duplicated border pixel in each of 4 dimensions with each tile. What you need to do is play the plugin more, and observe the output image to find the effect I mentioned. – Tokenyet Dec 10 '17 at 08:25
  • I think I figured it out- in the plugin, I should set the "Gutter" option to "yes", and that will generate the padding with duplicate border instead of transparent padding like I did before – TNT6 Dec 10 '17 at 19:20
  • Well done, you got it! – Tokenyet Dec 11 '17 at 10:50

3 Answers3

1

I know this thread is very old, but it took me two hours to figure out the solution myself. So in case somebody has the same problem in the future:

I noticed that only some tiles behaved like this - for example, a grass tile would, a water tile wouldn't. Even if they were used on the exact same position in the map. For me the problem was - apparently - that my PNG tile sheet's height was not a power of 2. A few days before, I added a line to an existing tilesheet and changed the height from 1024px to 1056px. After a lot of experimenting, I found out that after removing this line again, the black stripes would disappear.

Tobias Baumeister
  • 2,107
  • 3
  • 21
  • 36
0

Load your maps like this:

TmxMapLoader.Parameters() params = new TmxMapLoader.Parameters();
params.generateMipMaps = true;

TmxMapLoader mapLoader = new TmxMapLoader();
TiledMap map = mapLoader.load("pathToMap", params);
icarumbas
  • 1,777
  • 3
  • 17
  • 30
0

I had the same problem I fixed it by changing the size of my spritesheet to a power of two example :

  • 640*640 --> wrong
  • 512*512 --> right
Dharman
  • 30,962
  • 25
  • 85
  • 135