No "Pixel Snap" option in 'Sprite-Lit-Default' material causing some sprites to tear

The Problem:

I have a pixel-art based project that uses tilemaps and etc. Previously with just the default material Sprites/Default, I have this “Pixel Snap” option:

162883-screen-shot-2020-07-07-at-45829-am.png

However, ever since I upgraded to LWRP/URP; and used 2D Lights (my game has a day/night cycle); all of the sprites have to be upgraded to a new Sprite-Lit-Default material which allows my sprites to be affected by the 2D Lights. The only problem I noticed in this new material is that it hasn’t got any “Pixel Snap” option:

162884-screen-shot-2020-07-07-at-45838-am.png

And after I used this new material, I notice some of my sprites (specifically the ones on the Tilemaps) tear. It’s not game breaking and it occurs sometimes, but it’s really quite annoying (and let’s face it, it looks bad for your game to have that bug).

I haven’t noticed this tearing bug on my other sprites (player, trees, obstacles, etc) only particularly on the tilemaps.

What I’ve Done So Far:

-My sprites are set to Point (no filter), and Compression is set to None. On my tile sprites, there are no transparent edges etc. Even if I use Unity’s Pixel Perfect Camera, the problem is still there.

-Duplicated my tilemaps and offset the other ones to -0.01 or -0.02 on its X axis (so just in case it would tear, the player would still see the same tilemap).

None of these things have fixed the problem so far.

Are there any ways to bypass/fix this issue?
Thanks a lot!

Try placing your tilemap sprites in a sprite atlas to add some padding on the side.

I’ve run in to this exact same issue just recently! I was getting some strange artifacts on my sprites, edges being extruded and clipped weirdly in some positions and I could not for the life of me figure it out. I had my camera clamped to pixel grid positions and using the “UnityEngine.U2D.PixelPerfectRendering.pixelSnapSpacing” feature to get sprites to align to the grid… but I was still getting weird sprite artifacts that would not go away!

I thought it was an issue with the Sprite Atlas, as it’s adding these extruded opaque pixels to my sprites:

163111-extrudedpixels.png

(if anyone knows why this is happening, I’d love to know as it’s extremely weird!)

Using the default sprite shader with pixelsnap on fixed the issue however, so I just copied the UnityPixelSnap() function from the unitycg.cginc over in to a custom lit sprite shader, and that’s sorted the issue out. I think in my case I’m getting the classic 0.5 offset issue as my sprites are cropped very tightly to avoid overdraw, which the Pixel Snap setting seems to sort out.

Ideally this should be included in the new URP 2D shaders as standard, but I guess it’s been an oversight.