[Solved]Post process lag on first use

Hi,

I created custom post process but I need it only at some time so I use camer.detachPostProcess / attachPostProcess to pause / play it. All works well except on first usage it have noticeable lag (compiles some effect maybe ?), all next usages are ok. Is there any way to pre compile / create / warm up to avoid lag on first call ?

Thank you

Yes this is a compilation time.

You can call posptProcess.isReady to force a conpilation

@Deltakosh somehow didnt worked with isReady, but managed to do with

this.scene.executeWhenReady(() => {
   camera.detachPostProcess(this);
});

Looks like post process need to be rendered at least 1 frame with loading screen removed (visible game), in order to force compile

Yep which should be the case with isReady as it forces the shader to compile