Jump to content


how to create a shader like this?


4 replies to this topic

#1 Xcrypt

    New Member

  • Members
  • PipPipPip
  • 144 posts
  • LocationBelgium

Posted 06 June 2012 - 02:38 PM

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?

#2 TheNut

    Senior Member

  • Moderators
  • 1696 posts
  • LocationThornhill, ON

Posted 06 June 2012 - 03:09 PM

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.
http://www.nutty.ca - Being a nut has its advantages.

#3 Xcrypt

    New Member

  • Members
  • PipPipPip
  • 144 posts
  • LocationBelgium

Posted 06 June 2012 - 04:08 PM

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?

#4 Stainless

    Member

  • Members
  • PipPipPipPip
  • 577 posts
  • LocationSouthampton

Posted 06 June 2012 - 04:45 PM

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.

#5 Reedbeta

    DevMaster Staff

  • Administrators
  • 5305 posts
  • LocationBellevue, WA

Posted 06 June 2012 - 04:57 PM

The spreading is likely a Gaussian blur pass being run on the background texture each frame.
reedbeta.com - developer blog, OpenGL demos, and other projects





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users