how to create a shader like this?

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Jun 06, 2012 at 14:38

http://www.kongregate.com/games/JGames/pwong-2?acomplete=pwong+2
How would I create a shader like the one used in there?
(The smooth colour transitions that look like some kind of plasma)

I’m guessing this might be some kind of additive blending, but can someone tell me more?

4 Replies

Please log in or register to post a reply.

6837d514b487de395be51432d9cdd078
0
TheNut 179 Jun 06, 2012 at 15:09

It looks like the streaks are written to a texture as the ball passes over it, using a linear gradient perpendicular to the ball vector. The blue and green channels gradually fade out over time. The green channel fades out quicker than the blue, which causes the cyan colour trailing the balls to disappear leaving only the blue channel that fades out much slower.

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Jun 06, 2012 at 16:08

Hmm, thanks for the hints. So I could just write the colours away to a buffer as the objects pass over it, and fade those colours out over time?
Cool, but what about the spread effect?

B5262118b588a5a420230bfbef4a2cdf
0
Stainless 151 Jun 06, 2012 at 16:45

The easiest way to create that sort of effect is, instead of clearing the screen, draw a fullscreen alpha blended quad over the top.

Or to make the effect more exciting, grab the backbuffer, run a blur filter over it, then alpha blend that over the top instead of clearing the screen.

You can even make different colours fade at different rates by changing the draw colour.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Jun 06, 2012 at 16:57

The spreading is likely a Gaussian blur pass being run on the background texture each frame.