I'm trying to implement my own custom CIFilter
with SpriteKit. What I would like to achieve is to use my custom CIFilter
as the filter on a SKEffectNode
.
I wrote a very simple test filter (just returns the pixelValue), and it works fine in QuartzComposer
.
I followed the dev guide to write a CIFilter
subclass, register the filter, and provide filterWithName
and outputImage
implementations, as well initialize and init.
However when I try using the CIFilter
on my SKEffectNode
, I don't get an output image (just a blank image - blank as in clearColor
filled).
I don't think anything is wrong with my SKEffectNode
setup because if I switch to another (built-in) CIFilter
everything works as expected.
I also don't think there is anything wrong with the .cikernel since it runs fine in Quartz Composer (also it's really just one line that returns the pixelValue from the sample...)
I set breakpoints in the init and initialize of my CIFilter
subclass, both get called, the kernel gets initialized with the correct code string, and everything since to be going fine.
However my output remains infuriatingly blank ...
Has anybody been successful in using custom CIFilters
on SKEffectNodes
?
Thanks!
EDIT: forgot to mention that I do call [MyFilterSubclass class]
to intialize it prior to using it, and I also set a breakpoint in -(CIImage *)outputImage
and it does get called everyframe, so it looks like the filter is setup correctly and it's computing a result every frame, but that result somehow doesn't get used by the SKEffectNode
... help :( !