Group Group Group Group Group Group Group Group Group

How to use color dodge blending in SpriteKit?

Hi guys,

I’m using SpriteKit and I want to achieve a Photoshop like color blending mode “dodge color” of a node in the foreground with other nodes and the background. My first approach was to use a SKEffectNode using a CIColorDodgeBlendMode filter. Unfortunately this filter needs a background image as parameter. I did not get this construction working.

My second though then was to use the SKShader class. But there seems to be no way to access the framebuffer (or the actual pixel data from the background to combine the color with).

So long story short: is there a way to have a dodge color effect in SpriteKit - or to access the background pixels in a SpriteKit shader program?

Thanks for your time and help :slight_smile:

I’m sorry that I don’t yet have the definitive answer for you, but it would make sense if you couldn’t access the color attachments in SpriteKit, because SpriteKit is available on OS X. The GPUs in Macs can’t do programmable blending, like the PowerVR GPUs in iOS and tvOS devices can, so there’s a lowest-common-denominator issue which actually works in the opposite direction from what one might expect.

Thank you for your answer!

I’ve also read a similar article to the one you mentioned. What the article states under “Fetch Framebuffer Data for Programmable Blending” does not work with SpriteKit. Your explanation sounds intelligible although it’s too bad.

This post was flagged by the community and is temporarily hidden.