MSAA is disabled when turning on postProcess

Here is a playground example:

https://www.babylonjs-playground.com/#HMCHI3

If you remove the post process, the edges on the sphere become smooth, if the post process is on then they become jagged. Assuming this is expected behavior, why isn’t this mentioned in the documentation?

Anti aliasing is only turned on by default on the main canvas buffer, not manually created frame buffers, fortunately since webgl2 you can enable it on frame buffer. To do so, you can simply set the samples value of the post process to your chosen number of samples.

https://www.babylonjs-playground.com/#HMCHI3#1

2 Likes

Does that mean MSAA will dissappear when using iOS and macOS, when using post process effects?

Yes as long as they do not support webgl2…

Or you would need to rely on FXAA or other Post Process to do manually fullscreen AA.

Does WebGL 1 support MSAA at all? Or this this only concern frame buffers?

yes it works on the main canvas so without post process.

Would it be possible to fake a simple post process effect by using blending. i.e. an effect that isn’t reliant on the underlying scene color. Would I need to create my own screen-space mesh for that?

Actually it is mentionned on another page: Use the default rendering pipeline - Babylon.js Documentation but maybe this should also be noted on the page you’ve linked

1 Like

Why not use Fxaa as @sebavan suggested?

https://www.babylonjs-playground.com/#HMCHI3#2

Because FXAA is shit, of course.

Well this is really constructive

Can you (politely) tell us why the canvas AA or FXAA are not enough?

Maybe super sampling then ? (using engine.setHardwareScalingLevel(0.5))?

MSAA is just a nice balance between performance and quality: Anti-aliasing techniques comparison

SSAA is expensive. FXAA always looks flickery. TAA would solve post process flickering, but would be hard to accomplish with WebGL. But this discussion, while enriching, doesn’t have much to do with this topic.

I would love to know if I am able to use the postProcess pipeline to create a fake post effect without the need to the the original color pass, since I will not be using it.

EDIT: i.e. a quad drawn over the screen with post fragment-program blending.

yes :slight_smile: Sorry that the thread was kind of diverging :smiley:

You can create a scene with just a camera and a postprocess (that can be rendered on top of another scene if required). Then you can create your own post process to do what you want

https://doc.babylonjs.com/how_to/how_to_use_postprocesses#custom-postprocesses

I am using a custom postProcess. But I’m just curious what will happen if I don’t render the original scene in a PassPostProcess. I predict it will show garbage, but I will find out.

As long as you are not reading from the source sampler it should be all fine

1 Like

Great, I just wonder how one would add the blend functions to the post process effect.

With:

postProcess.alphaMode = BABYLON.Constants.ALPHA_COMBINE;

or any other ALPHA_XXX constant.

1 Like

Fantastic