1
\$\begingroup\$

I have objects moving in OpenGL ES1 application. I want some of them to leave behind contrail – like if they would emit some radiation or something.

EDIT: the kind of contrail is:

  • light contrail – not smoke contrail,
  • the same effect occurs on LCD monitors with long pixel-switch time (it is called response time AFAIK).

HERE IS THE EXAMPLE IMAGE: https://i.sstatic.net/w3dHZ.jpg

\$\endgroup\$
4
  • 2
    \$\begingroup\$ Please edit your question to describe in more detail what you've tried already. Also show us some screenshots of what you have now and an example of what kind of effect you're trying to achieve (e.g. from another game or movie, or real life). \$\endgroup\$ Commented Jul 25, 2012 at 21:28
  • \$\begingroup\$ @NathanReed: is it better now? \$\endgroup\$
    – GoCoder
    Commented Jul 25, 2012 at 22:25
  • 1
    \$\begingroup\$ No, not really. You haven't described what research you've done or ideas you've tried already. Nor have you posted an image to give us a concrete idea of what your desired effect would look like. We can't read your mind! It's not likely you'll get good answers unless you can ask your question much more fully and completely. \$\endgroup\$ Commented Jul 25, 2012 at 22:49
  • \$\begingroup\$ @NathanReed: I have attached an example image \$\endgroup\$
    – GoCoder
    Commented Jul 26, 2012 at 12:05

1 Answer 1

5
\$\begingroup\$

The example image makes it much clearer what you want. "Contrail" probably isn't the right word for this; at my company we call it a "swoosh" but other people probably call it something like "sword trail", "sword slash" or similar.

Anyway, the way to do this is basically to generate dynamic geometry, by recording the position of two points on the sword (one at the hilt, one at the tip) each frame and keeping a history for the last n frames. Then draw a triangle strip that connects these points, with a translucent or additive shader.

To make it look better, you'll probably want to fade out the trailing edge of the swoosh, e.g. using vertex alpha based on the age of each vertex. You can also generate UVs for each vertex so you can put a texture on the swoosh. Finally, if sampling the sword once per frame doesn't give you smooth enough geometry, you can interpolate additional vertices using Hermite splines (these require calculating the velocites of the two sample points each frame, which are used as tangent vectors for the splines).

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .