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).

Comments on the forum ➀

Many new things: Various editor, glTF, physics, sprite sheets and other improvements. Upcoming more: tutorial, sprite sheet editor, particle system news.

Posted on

Castle Game Engine editor

We’re busy doing a lot of things 🙂

  1. The pull request with our own sprite sheet editor and format is in-progress. Thanks to Andrzej KilijaƄski!

  2. New tutorial is being finished: using CGE editor, from scratch to a complete game. Thanks to Eugene Loza!

  3. GPU-based particles in 2D and 3D. See forum posts about GPU-based 3D particle system for CGE (with editor), 2D particle system now supports GPU-based particles. Thanks to Trung Le (Kagamma)!

    Try it out already — I want to make dedicated posts about them, and also think about integrating into engine core in the future.

The new engine features available now as part of regular engine download:

  1. CGE editor: Directory operations: create, delete directory from the editor. Proper refresh (to show new dirs on the left, available in both panels, done automatically too when switching applications).

  2. CGE editor: Undo for properties changed by a dialog (thanks to Eugene Loza).

  3. CGE editor: Easier textual input of TCastleTransform.Scale, you can just type a single float (by Andrzej KilijaƄski and Michalis).

  4. CGE editor: Less alarming exception messages. Better behavior when opening invalid design files.

  5. CGE editor: Remembers window state and sizes (thanks to Eugene Loza).

  6. glTF: Support STEP interpolation in animations (you can try glTF-Sample-Models/2.0/InterpolationTest/ (from Khronos) to test).

  7. glTF: Important reading fix, in particular visible on some Kenney glTF models.

  8. Sprite sheets and images loaded to TCastleScene: by default do not force power-of-2 texture.

  9. Physics: gravity strength, very useful for 2D game when often 1 unit is not 1 meter (thanks to Andrzej KilijaƄski).

  10. Physics: capsule collider (thanks to Andrzej KilijaƄski).

  11. Transform feedback (TGLSLProgram.SetTransformFeedbackVaryings) with demo in examples/3d_rendering_processing/transform_feedback.lpr (thanks to Trung Le (Kagamma)).

  12. Theme images now use TCastlePersistentImage (thanks to Eugene Loza). Updated documentation about theme — the usage is now often simpler.

  13. Fixes to handlings URLs with anchors (by Andrzej KilijaƄski and Michalis).

Comments on the forum ➀