I am following Apple's SpriteKit documentation, now I am trying to use SKEffectNode, but my problem is the effect will not be applied! Here is my code :
SKEffectNode *lightingNode = [[SKEffectNode alloc] init];
SKTexture *texture = [SKTexture textureWithImage:[UIImage imageNamed:@"Spaceship"]];
SKSpriteNode *light = [SKSpriteNode spriteNodeWithTexture:texture];
self.filter = [self blurFilter];
lightingNode.position = self.view.center;
lightingNode.blendMode = SKBlendModeAdd;
[lightingNode addChild: light];
[self addChild:lightingNode];
//applying blur
- (CIFilter *)blurFilter
{
CIFilter *filter = [CIFilter filterWithName:@"CIBoxBlur"]; // 3
[filter setDefaults];
[filter setValue:[NSNumber numberWithFloat:20] forKey:@"inputRadius"];
return filter;
}
When you run the app it just show spaceship without any blur effect.
It looks like @"CIBoxBlur" filter doesn't exist anymore, at least in iOS 7.0. You can use @"CIGaussianBlur". You can see full list of the filters by running:
NSArray* filters = [CIFilter filterNamesInCategories:nil];
for (NSString* filterName in filters)
{
NSLog(@"Filter: %@", filterName);
}