Domanda

How would you create a realistic neon coloured SKShapeNode? My best attempts involve multiple overlapping shape nodes using successively less glowWidth and increased strokeColor brightness.

This can achieve something like this...

enter image description here

This solution is satisfactory but it suffers from slower than desired performance, which I was able to mitigate mainly by rendering SKShapeNodes to SKTextures and using SKSpriteNode instead.

I believe normally this effect is achieved using bloom effects, and examples I have seen from other environments appear visually superior, is there anyway to either use or simulate bloom quality neon effect in SpriteKit?

Update:

Using an approach similar to what was suggested by theis I was able to achieve a more vibrant effect.

enter image description here

È stato utile?

Soluzione

First a warning: Be aware that SKShapeNode has some memory leaks.

To achieve a nice bloom effect I would do two shapenodes on top of each other with the same glow. I would then set the blendMode of each of them to additive. I would then let the second node trail lazily after the first one. You can achieve this by subclassing SKShapeNode and override "setPosition:". Then just offset the child SKShapeNode by the delta of the new and the old position times some factor, that gives you trailing.

Neon light effects has a lot to do with the aftereffect on the retina. So to make it look neon you usually do some sort of trailing effect. You don't have direct access to shaders in spritekit so you have to do it manually somehow.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top