MSAA antialiasing in native C++

Hello,

We're creating an app for the ML2, which a portion of our rendering draws a grid of evenly spaced lines placed on the ground plane. Currently we do the grid rendering using a mesh of triangles, with a simple ml::app_framework::FlatMaterial for the material.

As the lines of the grid can extend far off into the distance, simply with the user slightly rotating his/her head results in moiré patterns and flickering of the individual grid lines.

We attempted to enable using MSAA antialiasing as an initial first step by adding the following sample buffer definition to the EGL configuration attributes in the GraphicsContext class:

                             EGL_SAMPLE_BUFFERS,
                             1,
                             EGL_SAMPLES,
                             8,

...however, while a valid EGL configuration is found with these attributes, the visual result remains unchanged.

Is there something else that needs to be done to enable MSAA with a native application?

Thank you!

ML2 OS version: 1.4.1
MLSDK version: 1.4.1
Host OS: MacOS
Error messages from logs: none

Hi @falken,

Welcome to the Magic Leap 2 Developer Forums. We are so grateful to have you here engaging with us.

I have reached out to our team regarding this issue and I will report back to you as soon as I learn more.

Best,

El

Hi @falken,

It is possible at this time to use MSAA on our device. However, from our tests, MSAA causes performance to drop very significantly so we do not recommend using this on the device's GPU.

If you still want to find a way to use MSAA, I will be happy to help you solve this.

Best,

El

Yeah, we're aware of the performance implications of MSAA.

There's definitely other ways to render the grid to avoid the aliasing issue (such as using textures), but we'd still like to see MSAA in action on the device to get an idea of both how it looks and what we can achieve with it enabled.

Hi @falken,

Changing the number of samples in the EGL configuration, unfortunately, will not give the desired result. You must turn it on in the GL. Please refer to the following docs to learn how to enable MSAA in OpenGL.

https://www.khronos.org/opengl/wiki/Multisampling

Best,

El