How can I achieve a node that will desaturate everything below it?

206 Views Asked by At

I am building a game where everything behind the player is greyed out as if it lives in a memory. But I don't know how I can achieve this effect. Is this where shaders are being used for?

Now I can create a SKLightNode to create the lighting and make it dark around the edges. But I like to field of view for the character to be 120 degrees. Everything outside of that angle should be greyed out.

Of course in the future I like the view to be blocked by obstacles but that is outside of the scope of this question.

enter image description here

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

A desaturation shader for SpriteKit can be found at my blog post on that subject. Note that this works in terms of an input texture, so you may need to adapt things to work on top of a tiled background. Also note that there is a new iOS 9 API to support capture of the output of a whole node, which may be useful to you in implementing this.