SFML community forums

Help => Graphics => Topic started by: ErA on July 14, 2019, 11:03:21 am

Title: Seams between isometric tiles
Post by: ErA 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: (https://i.ibb.co/L55H05t/Seams.png)

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?
Title: Re: Seams between isometric tiles
Post by: Hapax 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:

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.
Title: Re: Seams between isometric tiles
Post by: ErA 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.
Title: Re: Seams between isometric tiles
Post by: Hapax 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. :)