首页 > 解决方案 > SpriteKit Liquid Threshold Filter Effect

问题描述

I want to create a liquid effect in SpriteKit with Objective-C. At First I created a white blurred ball texture for the SKSpriteNode. Currently I am using the CIFilter "CIColorPosterize" as filter for the Threshold effect.

CIFilter *filter = [CIFilter filterWithName:@"CIColorPosterize"];
[filter setValue:@(2.0) forKey:@"inputLevels"];
[self.scene setFilter:filter];
[self.scene setShouldEnableEffects:YES];

And it looks okay: Like This

But now I want to change the color of the balls with the colorBlendFactor.

ball.color = [UIColor orangeColor];
ball.colorBlendFactor = 1.0;

This looks not correctly for me because the CIFilter manipulates also the blend color, but without filter I haven't the Threshold effect.

Now my question: Is there a way to have the Threshold effect without changing the color?

标签: objective-cswiftxcodesprite-kit

解决方案


推荐阅读