Postprocess with prepassRenderer caused msaa not work

PG: Babylon.js Playground
It is really wired that msaa not work any more when I enable prepassrenderer in the post process, how can I fix this?

And when I try to use geometryBufferRenderer instead of prepassRenderer, part of the sphere often disappears, how can I improve it?

To enable MSAA with the prepass renderer, you can set:

scene.prePassRenderer.renderTargets[0].samples = 4;

Regarding the sphere disappearing when using the geometry buffer renderer (GBR), that’s because we use a 16 bits depth buffer by default with the GBR.

This PR will allow you to change the format of the depth texture:

Once this PR is merged, this PG will work as expected (see line 54):


I accidentally tried the playground on mac today and the final result was playing the position sampler, but it worked fine on windows or without the samples setting on mac.

What is the problem on Mac? Are there any error messages in the logs?

I have tested on iOS 16.4.1 and it does work (except for the antialiasing that does not work, but that’s a bug with latest iOS versions: iOS Anti-aliasing issue April 2023).

I’m using Mac OS 12.6.3 and Chrome 112.0.5615.121 and there is no errors nor warnings.

MSAA works but looks using the position sampler, if I comment line 71, it looks right but without AA.

It looks like a bug with this version of MacOS if changing the MSAA parameter changes the texture that is bound to the post-process… There can be no impact on the Babylon.js side between the value of the MSAA parameter and the way we bind textures to shaders.

Can you try with other backends available in the Angle setting (in chrome://flags):

(you won’t have the same list on MacOS)

1 Like

Thanks! It works after I change OpenGL to Metal.