I want to switch camera smoothly and I have a SSAO post process effect in both cameras. SSAO effect doesn’t get updated position and rotation of the camera I switch to. I made a bad workaround where I recreate SSAORenderingPipeline after I detach active camera and before I attach next camera. But It causes one second screen freeze. I couldn’t get it working otherwise so I’m guessing there is a bug somewhere in babylon. I tried to locate it from babylon source code but couldn’t find anything with my knowledge. I’m aware of SSAO2 and I don’t want to use it as this one looks better and is faster for my project. I don’t know if the bug occurs with SSAO2 too. Here’s a playground example, press 4 to switch camera:
Adding @CraigFeldspar in case he could help on this one.
I see that you are using SSAORenderingPipeline
which is the legacy fallback for WebGL1.
Is there any chance you can use SSAO2RenderingPipeline
if your target platforms can run with WebGL 2?
I can give it another go.
Okey the bug doesn’t reproduce with SSAO2. I think the reason why I didn’t start using SSAO2 was the fact that in inspector it defaults samples value to 8 and which is also then the maximum value, the scene started to look good with 14 samples. Now when I tested it I copy pasted SSAO2 code from a playground which had 16 samples so this time it looked nice immediately. Performance was better with the legacy SSAO, is it because of the high samples count? Any tips to improve performance? These are my properties:
var ssao = new BABYLON.SSAO2RenderingPipeline("ssao", scene, ssaoRatio);
ssao.radius = 0.4;
ssao.totalStrength = 0.9;
ssao.base = 0.15;
ssao.expensiveBlur = false;
ssao.samples = 14;
ssao.minZAspect = 0.5;
ssao.maxZ = 40;
ssao.textureSamples = 0;