How to fix tearing between Tiles


How to remove tears appearing between tiles - Blogpost by Sunny Valley Studio (yeah me)

Sprite Atlas documentation

00:00:00:03 - 00:00:35:25


Screen tearing appears between tiles sometimes in your 2D games in Unity and do my best knowledge. It is because there sprites representing each tile might be drawn in different draw calls, and the easiest ways to fix it is to use Sprite Atlas. Pack your sprites are your tile maps or your atlas that represents your sprites into a Sprite Atlas in Unity, and this will make it to be drawn in a single draw call instead of in separate ones so that we can avoid having those screen tears appearing in our game.

00:00:36:04 - 00:01:00:05


If you go to the Sprite Atlas documentation, you can read a bit more about this. That single project can contain many texture files. Unity typically issues a draw goal for each texture in a scene. However, in projects with many textures, multiple draw goals become resource intensive and can negatively impact the performance of your project. So this is why it is very useful to use the Sprite Atlas to pack your sprites into it.

00:01:00:12 - 00:01:26:02


And also it should fix our issue. So let's go to our project. Okay. In our project we want to go to our project stub, find the exterior pack folder in the spirit world assets where we have this Atlas and Atlas one. Those are the sprite sheets that we are using to draw our map, and that's where we have this screen tearing with our atlas of our up in our farm scene.

00:01:26:15 - 00:01:55:28


So what we want to do it, we can do it here in this assets folder. We need to right click create 2D and we are going to find a displayed atlas somewhere in the middle. Let's select this and we can call it Atlas or Farm Atlas. Okay. Now if we are selected in the inspector, we are going to see that it has similar settings to what we had previously set on our Atlas and Atlas one.

00:01:56:04 - 00:02:22:07


So those are those settings here. We will need to duplicate them and input them into those settings here in the Atlas Inspector. So the important part is to set the filter mode to be out, no filter and a default compression. Not now. What we can do is we can go to our projects tab and drag our atlas to the objects for parking and Atlas want the objects for parking.

00:02:22:15 - 00:02:43:00


As far as I can tell, we do not need to modify any other settings. We can select, pack, preview, and now we are going to see that all those sprites were packed into a single atlas that will be used for a render call, and this should remove screen tearing from our game. Yesterday, Test Atlas struck again in the hierarchy.

00:02:43:00 - 00:03:03:27


Domain camera. As a child, the object of our player agent and let's press play. Okay, let's test if we can spot any screen tearing or not, though those appear a bit at random, but we should really take a look at it. And I think that it is much better right now. Let's take a closer look. Let's look for a bit longer here.

00:03:04:07 - 00:03:24:22


I think that now we are not going to experience the screen tearing, but later on we are also going to add a cinema machine and a pixel perfect camera just to be on the safe side to remove any unwanted artifacts in our to the township. But I think that is is working okay. But if it is not, don't worry about it.

00:03:25:00 - 00:03:49:20


We are going to add more fixes to this so that our game looks as good as it can be in terms of the pixel art that we are using. Okay, let's stop the game and once again make sure that we move the main camera from the player agent, from being its child to the general tab. Okay, let's make sure that we use control as to save our project.

Complete and Continue