Afterglow simulation

I am trying to implement an afterglow effect for a radar simulator application using OpenGL. The screen is continuously updated with the contents of new radial scans and “older” scans need to leave a fading trail as time passes and eventually disappear, i.e the
luminocity of the screen contents needs to be continuously reduced by a constant value.
The application needs to run at 16-bit color
depth because of graphics card performance issues.

I’ve used a texture object to accumulate radial scans so that I only need to render one radial at a time, and then try to “fade” the entire texture to achieve the afterglow effect. My rendering loop involves
the following steps:

1) render texture to screen,
2) render new radial to screen,
3) blend a quad over screen to reduce its brightness,
4) copy contents of screen to texture using glCopyTexImage()

What should the blending function be for this sequence to behave correctly?
I’ve tried using

glBlendFunc(GL_ONE, GL_ONE);
glBlendEquationEXT(GL_FUNC_SUBTRACT);
glColor3f(reduction, reduction, reduction);

but I don’t get the expected results (the blend_subtract extension is present on my system).

What other alternative solutions are there to achieve this effect? Would for instance multitexturing with a separate alpha texture possibly do the trick?

Use render to a text and not lower color but using the alpha channel to create a simi-transparent overlay.

pass 1 radar’s current position
pass 2 texture applied simi-transparent of prevous radar position.
copy radar screen to a texture for next redraw of screen.

This will create a fading out of the radar line as it rotates.

Originally posted by emilts:
[b]I am trying to implement an afterglow effect for a radar simulator application using OpenGL. The screen is continuously updated with the contents of new radial scans and “older” scans need to leave a fading trail as time passes and eventually disappear, i.e the
luminocity of the screen contents needs to be continuously reduced by a constant value.
The application needs to run at 16-bit color
depth because of graphics card performance issues.

I’ve used a texture object to accumulate radial scans so that I only need to render one radial at a time, and then try to “fade” the entire texture to achieve the afterglow effect. My rendering loop involves
the following steps:

  1. render texture to screen,
  2. render new radial to screen,
  3. blend a quad over screen to reduce its brightness,
  4. copy contents of screen to texture using glCopyTexImage()

What should the blending function be for this sequence to behave correctly?
I’ve tried using

glBlendFunc(GL_ONE, GL_ONE);
glBlendEquationEXT(GL_FUNC_SUBTRACT);
glColor3f(reduction, reduction, reduction);

but I don’t get the expected results (the blend_subtract extension is present on my system).

What other alternative solutions are there to achieve this effect? Would for instance multitexturing with a separate alpha texture possibly do the trick? [/b]

If I had to implement this, I would try to get along without any multipass/render-to-texture/blending stuff, but simply put the radar point position values (I guess there are such!?) in a FIFO list, and then for each frame render the list as points (or quads or point sprites or whatever) and fade color from node to node when traversing the list. Also should be rather faster than slower.

Jan

Now that I think of it you can just use a texture and rotate the texture.
The texture will be drawn with an alpha channel that has a varing degree of transparency as the image trials off.

Does this make sense???

Originally posted by JanHH:
[b]If I had to implement this, I would try to get along without any multipass/render-to-texture/blending stuff, but simply put the radar point position values (I guess there are such!?) in a FIFO list, and then for each frame render the list as points (or quads or point sprites or whatever) and fade color from node to node when traversing the list. Also should be rather faster than slower.

Jan[/b]

I think if you change the alpha on the whole texture,
you won’t really get that ‘radar’ effect.

I did it one time under libvga(-gl)
I simply took my current angle, and drew
their relative x,y positions with different colors depending on how many degrees ‘ago’
they were.

This worked pretty swell, even under normal vga. So I suppose it will work pretty fast.

Addendum : Another advantage is that you can add an extra 3D effect later,
like drawing the ‘latest’ lines a little higher and
rotate the radar a little
(I love 3D and it’s expandability :wink:

Originally posted by nexusone:
[b]Now that I think of it you can just use a texture and rotate the texture.
The texture will be drawn with an alpha channel that has a varing degree of transparency as the image trials off.

Does this make sense???

[/b]