Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Seams between isometric tiles  (Read 1810 times)

0 Members and 1 Guest are viewing this topic.

ErA

  • Newbie
  • *
  • Posts: 4
    • View Profile
Seams between isometric tiles
« on: July 14, 2019, 11:03:21 am »
Im currently trying to implement a isometric tilemap in sfml. The map itself is working but for some reason i get a 1 pixel gap between my tiles:

I tried both, a rectangle shape with width of 100 and height of 50 drawn with the right offsets aswell as a convex shape that matches the tile exactly with the same result. I dont think its my placing code because if i use a fill color instead of a texture the tiles line up perfectly without any visible seams. Is there something about textures im missed that explains where the seam is coming from?

Hapax

  • Hero Member
  • *****
  • Posts: 3346
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Seams between isometric tiles
« Reply #1 on: July 15, 2019, 11:23:13 am »
This looks like the image you are using is shaped like the tile that you are attempted to fill so you are getting the surrounding area when the angled edge is 'travelling' along the outside corners of each pixel, 'grabbing' a pixel from the outside part.

A couple of possible solutions are:
  • Expand your diamond-shaped texture to fill the pixel around it as well
  • Contract your texture co-ordinate so that it no longer passes outside

The second suggestion above can be achieved by adding only a half to each co-ordinate (remembered to subtract from the highest values) if the final display will be the same size pixel-wise as the texture, otherwise it'd need to be a full one that gets added and subtracted to be sure.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

ErA

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Seams between isometric tiles
« Reply #2 on: July 15, 2019, 05:22:35 pm »
I got it to work by accident now. I swapped from the own shape for each tile approach to a vertex array containing all tiles. For some reason with the vertex array while using the exact same texture the seams are gone.  So it seems like it wasnt the texture tho. Maybe it has to do with the texture coordinates being set manually now.

Hapax

  • Hero Member
  • *****
  • Posts: 3346
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Seams between isometric tiles
« Reply #3 on: July 15, 2019, 09:57:34 pm »
Ah, another "solution" that I forgot to mention, which might be what you did inadvertently to solve it anyway:
Make sure that all alpha is correct, leaving a perfectly shaped tile with transparency. This should allow for the other stuff I mentioned.

Glad you got it fixed anyway. :)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*