I'm trying out SpriteKit with the following setup:
- An SKScene with two child nodes used merely for grouping other nodes: foreground and background.
- background is really empty as of now, but would eventually hold some type of background sprite / layers.
- foreground is a SKEffectNode and whenever the user taps on the screen, a new intance of a SKnode subclass which represents a game element is added as child to it.
- This SKNode subclass basically creates 3 SKShapeNodes and two labels: an outter circumference, an inner circumference, 2 labels and an inner quarter circumference. The inner quarter circumference has an SKAction that makes it rotate forever about its origin / center.
Now here's the issue, as long as foreground doesn't have any CIFilter or has shouldEnableEffects = NO, everything is fine. That is, I can tap on the screen and my game elements are instantiated and added to the main scene. But the minute I try adding a CIGaussianBlur or CIBloom to the foreground, I notice two things:
- The framerate drops to about 2fps. Mind you, this happens even with as little as 6 nodes alive in the scene.
The effect seems to be constantly cropping its contents or adjusting it's frame. That is, if I have one node, the "full screen" effect seems to try and constantly crop or adjust its bounds to the minimum area required to hold all nodes. This is for one node:
And this is for 2 nodes:
In OpenGL ES 2, one would do a post blur / bloom by basically rendering the whole framebuffer (all objects) to texture, then doing at least one more pass to blur,etc on that texture and then either present that in the framebuffer attached to the display or compose that with the original render back to the framebuffer. I'd expect SKEffectNode to work in a similar way. However the cropping and the poor performance makes me think I might be using the effect node the wrong way. Any thoughts?