Black blinks on the first iteration of variable blur postprocess

Here is the replicable issue:

  • Open the scene https://playground.babylonjs.com/#Y7STR8#2
  • Press B on the keyboard, it will trigger a blur postprocess, the blur amount will be increasing until it meets 32 px and after that it will decrease until 0.
  • The issue (black blinks) only happens the first time you trigger the blur process with the B key, after that it will work smoothly, you can replicate it again by relaunching the sample with the Play Icon on the Playground.

If I can help with any additional info I’ll be glad to help!!!

1 Like

That’s because new effects have to be compiled when you update the kernel property and it can take more than one frame to do so. You should pre-compile the effects for each value of kernel (1…32) before starting the PG.

You can do it like that:

https://playground.babylonjs.com/#Y7STR8#3

4 Likes

Thank you, in my case the requirements are not so strict so I can afford a small delay, here is my naive version based on your reply:
https://playground.babylonjs.com/#Y7STR8#4