Applying a CIFilter with SKEffectNode to a SKSprit

2019-07-24 02:01发布

I am trying to apply a CIFilter with SKEffectNode to a SKSpriteNode. Can't get this to work and not sure why. I got this working using a blur but cannot get the mono photo effect. Anyone have any insight? Thanks again.

//Mono Effect (not working)
    let filter = CIFilter(name: "CIPhotoEffectMono")
    filter?.setDefaults()
    effectsNode.filter = filter
    self.addChild(effectsNode)
    effectsNode.addChild(SKSpriteNode)

//Blur Effect (working)
    let filter = CIFilter(name: "CIGaussianBlur")
    let blurAmount = 4.0
    filter?.setValue(blurAmount, forKey: kCIInputRadiusKey)
    effectsNode.filter = filter
    effectsNode.blendMode = .alpha
    self.addChild(effectsNode)
    effectNode.addChild(SKSpriteNode)

0条回答
登录 后发表回答