Multi-sampling (full-screen anti-aliasing) on iOS

Posted on

iOS anti-aliasing
iOS without multi-sampling requested (some anti-aliasing done anyway)
iOS with multi-sampling requested (more anti-aliasing done)
No multi-sampling (desktop)

You can now activate multi-sampling on iOS using Window.AntiAliasing := aa4SamplesFaster. You should set this before window is opened, which usually means it should be done in the initialization section of a unit like GameInitialize.

What values of AntiAliasing are actually meaningful?

Internally iOS supports only “none” or “4” multi-sampling values. So actually there are only 2 different states on iOS depending on Window.AntiAliasing:

  • aaNone, aa2Samples* -> means no anti-aliasing
  • aa4Samples* and higher options -> means 4x anti-aliasing

The suffix “faster” or “nicer” also doesn’t matter for anti-aliasing on iOS, e.g. aa4SamplesFaster and aa4SamplesNicer are equivalent. This suffix matters only on OpenGL with NV_multisample_filter_hint.

Testing

Unfortunately the log always says Current: 1 samples per pixel because it seems Apple didn’t bother to implement glGetInteger(GL_SAMPLES) correctly. It always returns 0 (so it would seem that no multi-sampling happens).

But if one looks at actual rendering, then yes, multi-sampling does make an effect!

Actually, it seems that iOS always does some multi-sampling, which I guess is just something they do on the high pixel resolutions on iOS (these are results of my tests on iPhone SE). But there’s definitely more multi-sampling when you request aa4SamplesFaster than if you leave it at aaNone. See the screenshots from iOS device with and without multi-sampling requested on the side of this post. They show an unlit box, which should produce very sharp edge without anti-aliasing (see desktop screenshot).

Start the discussion at Castle Game Engine Forum