It’s not the first time I’m wondering why on webGL1 devices (yes I see you Safara on iOS…) we have a nice default antialiasing but as soon as we activated the default rendering pipeline it’ becomes hard to get rid of aliasing.
There is already info about that but we miss the “why” I think:
The MSAA antialiasing (only supported in webGL 2.0 browsers) effect is off by default (set to 1) but can be turned on to 4x
By reading this TrevorDev github answer + this old topic I’ve opened, this is my proposals to add to the doc, correct me if I’m wrong (and by the way, is MSAA clamped to 4? - and let’s ping @Deltakosh & @trevordev ):
Customizing
Antialiasing
The MSAA antialiasing (only supported in webGL 2.0 browsers) effect is off by default (set to 1) but can be turned up to 4x with:
pipeline.samples = 4;
and the FXAA antialiasing effect can be set using:
pipeline.fxaaEnabled = true;
Note that without using the pipeline, your scene already use a MSAA antialiasing, which is webGL native. When enabling the pipeline, you’re actually start using a post-process texture. Unfortunatly, webGL 1.0 devices will not be able to apply MSAA outside of render buffers. Still, FXAA is available but not as powerfull as MSAA.
That’s a short addition but can help everyone to better understand why this aliasing show up on some devices (yep, again, iOS…)
was looking at this thread. We have an issue on ipad pro where it looks like msaa is ether turned off or using a lower value than what we have set up ( pipeline.samples = 4). How do I query what is the max allowed samples on the device. It feels to me like on mobile using FXAA might be better?
engine.getCaps().maxSamples will give you the maximum MSAA samples supported by your GPU, and engine.getCaps().maxMSAASamples is the actual maximum used by Babylon. It can be different if we detect a faulty OS: in that case, we set maxMSAASamples to 1.
It’s a switch for the output framebuffer (canvas), antialiasing in this case is handled by the browser when you render objects in the canvas (that is, in Babylon, not in a render target texture).