Default pipeline AA disabled when applying MotionBlurPostProcess

I’m using the default rendering pipeline with samples set to 4 and fxaa enabled and it looks good.
But when I try to add a MotionBlurPostProcess it seems to be disabling AA for some reason.

Here’s the code:

    const pipeline = new DefaultRenderingPipeline(
      'defaultPipeline',
      true,
      this.scene,
      [this.camera],
    );
    pipeline.samples = 4;
    pipeline.fxaaEnabled = true;

    const mb = new MotionBlurPostProcess('mb', this.scene, 1.0, this.camera);
    mb.samples = 4; 

Is that expected behavior?
I saw this other thread the recommendation to set the samples of the mb post process as well so that’s why I have it in there, it didn’t solve the issue for me.

I created this playground where we can see that happen if you uncomment the motion blur lines:

1 Like

Welcome aboard!

By default the motion blur post process is using the pre-pass renderer. You enable MSAA on the pre-pass renderer by doing scene.enablePrePassRenderer().renderTargets[0].samples = 4; but for some reason it does not work in your PG…

A workaround is to use the geometry buffer renderer instead (set the 10th parameter of the motion blur constructor to true to use it):

2 Likes

Thank you @Evgeni_Popov ! Both enabling msaa on the pre pass renderer and using the geometry buffer for motion blur worked. Although I did have a slowdown on perfomance using the geometry buffer :thinking: .

I still have a few newbie questions if you wouldn’t mind answering:

  1. Does the default rendering pipeline uses the geometry buffer? Is there/ do you think there will ever be a way to make it use the pre-pass renderer instead?
    2 - Is the issue happening because we can’t have some effect using the pre-pass renderer while other uses the geometry buffer at the same time? If so, is this a bug or intended behavior?
    3 - Is there a way to enable FXAA on the pre pass renderer? - I guess not from my research

They are doing essentially the same thing, so I don’t think the perf should be too different… You can try to use Spector.js and see if something differs between both cases.

It does not use it because none of the effects managed by the default rendering pipeline is using it. Only a small subset of the post processes have a need for the pre-pass renderer/geometry buffer renderer: SSAO, SSR, Motion blur and I think that’s it.

I think it’s a bug with the pre-pass renderer, we will investigate to find the reason why it is not working.

FXAA does not need the pre-pass renderer/geometry buffer renderer (see above the list of post processes that need to use the PPR/GBR).

3 Likes