Directional Glow

Hi,

I am trying to create a ‘tv screen’ effect where an object with a texture would emit a glow.

At the moment I have this:


And I am looking to get something similar to this (a bit crappy photoshopping, sorry):

I am assuming I should use a single pass blur with the direction corresponding to the direction of the plane in 3D space (based on Paul’s glow sample). I am writing here if someone has any other (probably better) ideas.

Many thanks in advance!
Mitja

Google “bloom”. This is the commonly used name for this effect. That should give you a wealth of information to go by.

Bloom is what my glow sample uses, but it would not yield a directional effect.

What I would try first is to render the scene as-is to a frame buffer, then apply a shader of your own design. Determine the 2D glow direction by taking the plane’s normal and projecting it into view or clip space (whatever is more convenient). Pass it as a uniform vec2.

For each fragment, you then sample multiple fragments along the glow direction vector and calculate the average color. If you don’t want any glow below the plane, you need to pay special attention to what fragments you sample. I can’t give you any more details without trying it myself and I don’t have the time for that at the moment.

Good luck, let us know how you fare.

~Paul

P.S.: for performance reasons, you should reduce the number of affected pixels as much as possible. For example by using the stencil buffer. This could have the added bonus that you can control where the glow should be cut off.

P.P.S.: a much simpler, cheaper way to get directional glow, is by drawing multiple planes on top of each other, getting darker the further away from the source plane they get. Use additive blending. Works best if your frame buffer uses floating point RGBA.

Thanks Paul, as always!

This should get me well on my way.

Well let you know how it goes.

Best regards,
Mitja