Anti Aliasing on Mobile


I will soon be publishing a 2D game to the mobile stores. The core gameplay looks a little like this with 4x anti aliasing:


As you can see, it renders nicely… Without anti aliasing it, obviously, looks quite jagged.

I don’t have the resources to test on many phones so I wanted to ask: What are the implications of using 4x anti aliasing on mobile platforms for a 2D game like this? Should performance be a major concern for a 2D game using 4x anti-aliasing? Which specific devices should I expect to have problems (and therefore test on)? Other drawn elements include a GUI created in 2D Toolkit.

Also, if a device doesn’t support anti aliasing, but I have my setting at 4x: What will Unity do? Will it just drop down/disable anti aliasing? Or will it try to do the multisampling itself, causing an even bigger performance problem on those platforms? (I doubt it would, but I thought I’d ask)

My current draw statistics for this scene are:

Draw Calls: 4 Saved by batching: 66
Tris: 184 Verts 324 (This goes way up into the thousands when I add 2D toolkit items, especially those with spritefont rendering)

There are no textures on the core game, but lots throughout the GUI. The core game seen here is just a simple vertex/fragment shader that passes through the vertex color for each mesh.



EDIT: I did find this just now… It provides some insight: Trying Out Multisampling On iOS – Games from Within

There are a few variables that could affect this. However a common one for 2D is that the sprites are set to bi linear when point should be used. Under the sprite in the inspector you can change this.

Maybe I could monitor the framerate and set it through code using QualitySettings.antiAliasing. When the framerate drops consistently below 24fps, set antiAliasing to off.

using UnityEngine;
using System.Collections;

public class FramerateMonitor : MonoBehaviour
	public int ConsecutiveIntervalsFailedThreshold = 4;
	public float IntervalSeconds = 0.5f;
	public int TargetFramesPerInterval = 12;

	protected int frameCount = 0;
	protected float timeElapsed = 0;
	protected int failCount = 0;
	protected bool hasFailed = false;

	void Update()
		if (!hasFailed)
			timeElapsed += Time.deltaTime;
			if (timeElapsed >= IntervalSeconds)
				timeElapsed = 0;

				if (frameCount < TargetFramesPerInterval)
					failCount = 0;
				frameCount = 0;

				if (failCount == ConsecutiveIntervalsFailedThreshold)
					hasFailed = true;
					QualitySettings.antiAliasing = 0;

Does this sound like a good idea to you guys?

I think you should make it possible in the GUI for the player to turn AA on or off. Some people may like nice AA like 4x, some may find it slows down the device.