Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CIGaussianBlur takes too much processing [duplicate]

I am trying to apply CIGaussianBlur effect on Game Pause screen. Here is my code:

effectsNode = SKEffectNode();
let filter = CIFilter(name: "CIGaussianBlur");
let blurAmount = 10.0;
filter.setValue(blurAmount, forKey: kCIInputRadiusKey);

effectsNode.filter = filter;
effectsNode.blendMode = .Alpha;

This code is working perfectly but it takes too much processing power and reduces the FPS by a great deal! I just want a static blurred image of the background when the game is paused.

Is there a workaround to this problem?

like image 311
Adnan Zahid Avatar asked Nov 10 '22 18:11

Adnan Zahid


1 Answers

Are you applying the effect on each frame? You should apply it only once and then save the result, and show that result during pause. You can see an example of this in this post

like image 66
Cihan Tek Avatar answered Nov 14 '22 23:11

Cihan Tek