0
\$\begingroup\$

I tried the sprite's import settings with point filtering, with billinear filtering, I also tried changing my canvas' UI Scale mode to Screen Space - Camera, but nothing seems to fix it.

I also tried scaling it up and down, but it rendered with these edges all the time.

How could I smoothen it? Thanks in advance.

enter image description here

\$\endgroup\$
1
  • \$\begingroup\$ The antialiasing Unity implements by default is Multi-Sample AA. This type of antialiasing is only effective at fixing geometry aliasing, along the edges of polygons. Aliasing inside a single polygon, due to texture sampling or shader calculations, is completely invisible to MSAA, so that part is up to you to anti-alias. Have you tried enabling mipmaps in addition to your bilinear (or even trilinear) filtering? \$\endgroup\$
    – DMGregory
    May 29 '20 at 10:35
1
\$\begingroup\$

As DMGregory pointed it out, in the asset's import settings I have to

  • enable Generate Mip Maps,

  • and have a Filter Mode at least Bilinear.

The result with Mip Maps and Bilinear filtering:

enter image description here

With Mip Maps and Point filtering:

enter image description here

With only Point filtering:

enter image description here

And with only Bilinear filtering:

enter image description here

\$\endgroup\$
2
  • 1
    \$\begingroup\$ For context as to why this happens: it looks like your source asset is much, much larger than the size you're displaying it on-screen. So when bilinear filtering tries to smooth it, it's only smoothing within a 2x2 block of texels in the source texture, which might be just a fraction of a pixel at your display size, so it's not enough to properly average the colour over the domain of the whole display pixel. By turning on mipmaps, Unity generates versions of the image at half, quarter, eighth, etc. sizes, and chooses the closest one to read from, so the filtering is better matched to the size. \$\endgroup\$
    – DMGregory
    May 29 '20 at 14:05
  • 1
    \$\begingroup\$ That said, you'll get the crispest results if you can size your source assets to be exactly the size you want them displayed on screen. Then there's no filtering/blurring happening at runtime, just 100% the pixels the artist authored, straight to the player's eyes. \$\endgroup\$
    – DMGregory
    May 29 '20 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.