Many SKShapeNodes inside SKEffectNode causes severe visual glitches

Number:rdar://16400203 Date Originated:2014-03-22
Status:Resolved Resolved:
Product:iOS SDK Product Version:7.1
Classification:Serious bug Reproducible:Always
Too many SKShapeNode instances added directly to an SKEffectNode  cause a severe visual glitch where the entire scene is instantaneously scaled down to roughly half size. It happens for a few frames when a new SKShapeNode is added, but is then instantaneously scaled back to full size.

This does not seem to occur when the SKShapeNode instances are added to other types of nodes.

Steps to Reproduce:
This occurs simply by adding several SKShapeNode instances directly to an SKEffectNode.

1. Create a new iOS Xcode project using the Sprite Kit template
2. Replace the scene class's implementation with the following code:

-(id)initWithSize:(CGSize)size {    
    if (self = [super initWithSize:size]) {
        SKEffectNode *container = [SKEffectNode node];
        [self addChild:container];
    return self;

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [touches anyObject];
    SKEffectNode *container = self.children[0];

    SKShapeNode *shape = [SKShapeNode node];
    shape.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(-10, -10, 20, 20) cornerRadius:4].CGPath;
    shape.position = [touch locationInNode:self];
    shape.strokeColor = [SKColor colorWithHue:drand48() saturation:1 brightness:1 alpha:1];
    shape.blendMode = SKBlendModeAdd;
    [container addChild:shape];

3. Run the application
4. Tap the screen at least 32 times

Expected Results:
Everything will be rendered correctly, at full 100% scale, on every tap.

Actual Results:
For the first few taps, shape nodes are correctly rendered. Subsequent taps (ie, when there are "too many" SKShapeNode instances) cause a visual glitch where the entire scene is scaled down to about half size. This happens only for a frame or two, but is enough to completely baffle users.

I've recorded a short video demonstrating the effect I see:

iOS 7.1 (11D167)


iPhone 5S
iOS Simulator




Attached a sample Xcode project to demonstrate the problem.

Tap the screen many times to observe the problem.

I've noticed since originally opening this bug report that the scaling seems to be related to the accumulated frame of the SKEffectNode. Tap in the center of the screen many times, then gradually move your taps outward to the edges of the screen to see that effect.

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!