I have my tiles sized at 18 x 18. According to the TileMap Basics tutorial, the PPU for the tiles must be the same as the size of the tiles. But my usual sprite PPU is 32, so the tiles appear blown up in the game.
I would like to keep my PPU for tiles at 32, but when I import the tiles into the tile palette, I get a small blank border around the each tile palette. When I want to paint on my grid, it leaves a space in between each cell (which is the blank border around each palette).
I was able to solve this by changing the cell gap, but there is tearing and visible lines in between sprites when the camera moves. How do I keep my tile PPU at 32 while making it ‘fill’ the entire tile palette?
Hi, thanks for the reply! But the gaps are created on the tile palette, so the gaps appear when I paint it on the grid. I don’t think I can oversize my tile sprites because they won’t be pixel perfect anymore. Or maybe I’m not understanding your question :S could you be a bit more specific?
I don’t know if you still need the answer, but I guess @FMark92 is talking about doing this.
Anyway, I gotta say that I’m a little bit disappointed with Unity having this issue for so many years. Tile maps should render perfectly out of the box like they do on other game engines. After all, when I create a new project I choose between 2D and 3D, and when I pick 2D I expect a smooth environment ready to work. I don’t like having to go after workarounds.
If you find a better solution, make sure to post here, please.
Have you tried creating a SpriteAtlas, adding your sprites to this, and then adjust the padding as needed (the default of 4 should work for most cases). This should fix the gaps, it will probably only look correct when running the game and not in the scene view.
Finally had time to try tilemaps and came across this thread.
I think @PGJ_1 is right - seems like Atlasing is way to go. Unity tilemap editor seems to snap tile polygon edges to edge of each tile.There seems to be some inaccuracy with this and the neighbour tile pixels bleed a bit to each tile… there should be option to make the tile face .99 size (for example) so that neighbour pixel won’t end up in tiles -whic is horrible. There is no way to slightly scale down each tile face (AFAIK), edges will only snap to pixels, and losing one pixel on each side would be too much.
Also what Gamesplusjames is doing requires quite a lot manual work, and Atlas does this automatically. Also, I’m quite not sure if he explained the reason for bleeding correctly. But I think there should be no reason to have gaps between tiles to fix pixel bleeding unless you want to use mipmaps. It is pretty much unacceptable.
Are there any other threads discussing this issue?
I tried the sprite atlas method, but like you said it didn’t appear correct in the editor and with how many tiled worlds I’ll be creating, having it appear properly in the editor was pretty important.
If anyone else has this issue where their tiles are NOT the same size dimensions as your PPU, what I ended up doing was setting my Tiles sprite PPU to the size of the tiles themselves (which causes them to be either bigger or smaller based on your actual PPU). Then I worked out some X and Y Scale math of the Tile Renderer Grid to make the tiles appear pixel perfect. That way you don’t get duplicate lines overlapping (which was causing bleeding) as well as having to mess around with gaps too much. Playing with scale plays nicer (in my case) in Unity than doing the other suggestions, though they are much appreciated!
So a quick recap:
Tiles are 20 x 20.
Usual PPU for all sprites is 32.
I set my Tiles PPU to 20.
When painting the Tiles with Tile Palette, notice that they are bigger than they are supposed to be, since the PPU is lower than your usual camera-to-sprite render.
Play with scale of Tile Renderer Grid component until it appears as it should. A quick way how I did that is to duplicate your Tiles Spritesheet and have one PPU set to your correct PPU, the other to your Tile sprite size. Then play around with scale till you get it!
Graphics are base 2 numbers. The best sizes are to follow that. 1,2,4,8,16,32, etc… Especially in DOS days I did everything as a 16px denominator.
If you did 16 then your 32 would match. I also have noticed that most artist do sizes like 16x16 , 16x32, and 64x64. So picking the closest to a multiple of 16 will probably get you the best sizing.
I also use 16 as the PPU when importing spritesheets. I also noticed that most spritesheet scripts used by artists are a base 16 grid, so it saves time instead of getting exact.
I’m playing around with the brushes right now to see how quickly I can get this process. I really like tilemaps, but I think im going to create my levels in Tiled, and then procedurally create the levels. I like the tool, but until they have a custom toolbox for drawing on the grid that we can customize, it seems to be more of a hindrance than productive.
I say this being an Indie. I don’t have an employee that I can have creating me custom brushes all day. There’s just a lot of setup involved to really make it fast and painless.