Per-image setting to clamp specific directions

This is quite a big issue on our end, and I believe a pretty straightforward setting would fix it.

The problem is this:

When sprites are scaled, the sampling of the alpha channel for transparency will quite often prematurely fade pixels at the very edge of the sprite, if you’re using bilinear filtering.

This is understandable for self-contained sprites, but it’s a problem for sprites that are supposed to tile together.

Here’s a simple example of a tiling grass sprite, that tiles perfectly fine in photoshop, but gets this issue in-game:

I believe this can be solved, by giving the user the ability to specify extrusion for the alpha channel in the image settings. That way, the texture filtering will get the correct alpha value, and the mesh will handle the clipping properly.

My suggestion would be to add four checkboxes per-image:
[ ] Clip top
[ ] Clip right
[ ] Clip bottom
[ ] Clip left

In my case, I have a set of tiling wall structures that need to fit together perfectly, and they all need harsh/non-blended clipping, but only in specific directions, so I need to be able to mix them.

This is likely the biggest issue that is currently affecting our game

Would you mind giving us access to your project so we can run some tests?

Yes, done! Thanks for having a look!

Ok, thanks. For your specific case I would suggest using a tilemap for the background. That would eliminate the edges.

The background was just an example, the real issue happens to the the border sprites, the ones that spawn around the edges of the level.
They all need per-instance adjustment, as they are of different sizes and need to overlap some grid cells, which means I can’t use a tilemap either

Ok. We got to investigate what the cause of this is and how to proceed.

1 Like

Super, thanks a bunch!

I just tried to set padding to 0 in the atlas and that seemed to remove the artifacts. We’ll check why that is.

Yep, managed to work it out using that method, plus sketchy half-pixel offsets here and there