Sprite filtering: Point/Bilinear

I’m currently working on a pixel-art type of game (using Unity 4.3’s new 2D feature), and I would really like the graphics to scale well so I can zoom around and do other crazy camera stuff.

If I set the Filter Mode on my sprite to Point, it scales up very nicely, but loses a lot of fidelity and looks outright broken when it starts to scale down. On the other hand, when I use Bilinear filtering, the sprite scales down nicely, but looks blurry when up close.

Here’s a picture I made to illustrate (please excuse the programmer art):
19709-spritefilter.png

My main question is this: is there any way to cause the sprite to change filter modes depending on how large it appears onscreen? (i.e. point at x2 scale and above, bilinear anywhere below that)

Alternatively, is there a better way to display pixel art?

You can set a texture’s filter mode programatically.

See: Texture2D.filterMode for an example.

Awaken ancient thread!

There are a number of settings on Texture that can cause them to become oddly pixelated.

For me, not having TextureFormat.RGBA32 was the troublesome one.

Here is some loader code that worked for my situation:

   static public Texture2D LoadTexByPath(string pathedFName) {
    byte[] pngBytes;
    try {
      pngBytes = File.ReadAllBytes(pathedFName);
    } catch(System.Exception e) {
      Debug.LogWarning($"DocsWin.LoadTexByPath: {e.Message}

No {"{pathedFName.Replace(Application.streamingAssetsPath,"")}"}. Using DocImages/Placeholder.png."); pngBytes = File.ReadAllBytes(“{Application.streamingAssetsPath}/DocImages/Placeholder.png”);
}
Texture2D tex = new(2, 2, TextureFormat.RGBA32, false) {
filterMode = FilterMode.Point,
anisoLevel = 0,
requestedMipmapLevel = 0
};
tex.LoadImage(pngBytes);
return tex;
}