8
\$\begingroup\$

I am curious how I could create an effect similar to the ship's tail in the following picture:

enter image description hereenter image description here

\$\endgroup\$
6
  • \$\begingroup\$ ähem, nice picture... the 'tail' is it the 'mercedes star' in the lower picture? or is it the fading thick line from the white center-object? (excuse my stupid question, but it's not so clear for me what exaclty is the tail, sorry) \$\endgroup\$ Sep 23, 2014 at 12:36
  • 2
    \$\begingroup\$ @MartinFrank oh i didn't thought there will be a problem spotting the tail ,its the thick line behind the player.But I don't think its very different from tail behind the "mercedes star".The game is "Geometry wars : dimensions" \$\endgroup\$
    – SteveL
    Sep 23, 2014 at 12:40
  • \$\begingroup\$ thanks for clearing that out! now i might be able to answer correctly ^^ \$\endgroup\$ Sep 23, 2014 at 12:41
  • \$\begingroup\$ Not really applicable for this particular question, but EVE Online has had its ship engine trails reinvented back in 2011. The way they are done now is described in their devblog. It has a lot of the nice properties you seem to be looking for here. \$\endgroup\$
    – Ordous
    Sep 23, 2014 at 16:17
  • \$\begingroup\$ @Ordous ,interesting post but the math look like Chinese to me :( . \$\endgroup\$
    – SteveL
    Sep 23, 2014 at 16:57

3 Answers 3

7
\$\begingroup\$

I was about to start an answer going over splines, but realized there was probably already a pretty good explanation in the internet. And here it is. The relevant steps are 1 and 2 (3 isn't directly applicable)

The gist of it is:

  • Every so many frames, record where the player is:
                     

The key here is to make sure you're recording the position at a constant time interval, so when the player goes faster, the trail gets longer (as the old points start to "lag" behind)

  • Form a spline and from those points (Steps 1 and 2). The result will be something similar to the wireframe image in that tutorial.

    Because you don't have "infinite" resolution in a mesh, you get a bunch of short straight sections gradually curve. Pretend that the width of the segments is constant, (I was drawing with a trackpad). You don't address the fact that the trail gets thinner just yet :

                     
  • Now you get to shading the mesh.

    The tutorial I linked to was trying to do something a little different. It has points that stay in the same place, and uses a shader to move the trail (that's Step 3).

    You're moving the points, so you use different approaches. One I could see is using a simple shader that interpolates between a color and a texture along the entire mesh. The texture would be combined with a solid base for the mesh. Something like:

                   

But you should also look at the tools you have access to. Most middleware has some sort of "trail renderer" already implemented, and it's probably well optimized. Unity3D and UDK both do, in fact that tutorial's goal could have been be implemented in Unity without any of that extra work (a properly configured trail renderer could have been animated)

\$\endgroup\$
1
  • \$\begingroup\$ That's a nice answer. \$\endgroup\$
    – SteveL
    Sep 23, 2014 at 21:27
2
\$\begingroup\$

You can implement such effect using Polyboards. If you can get yourself a copy of Mathematics for 3D Game Programming and Computer Graphics, there is a section in the book dedicated to this technique. (actually, the section for polyboards is available for free here).

This technique is also sometimes called a "LineRenderer" or "TrailRender".

\$\endgroup\$
0
\$\begingroup\$

when you have an object you can simply draw line to that object as seen as a red line on my pic ^^

enter image description here

MY line is drawn in red but you can tell the computer to not use a plain fill but use a gradient filling... now

enter image description here

now haing such a gradient for filling (using black/white on the alpha channel) will result in beeing a fading tail

after seeing your other picture i must add that you don't need a strict line but can do it with any form!

\$\endgroup\$
3
  • \$\begingroup\$ there are many many ways to implement a gradient... \$\endgroup\$ Sep 23, 2014 at 12:47
  • 4
    \$\begingroup\$ Oh the problem is not really the gradient but how It will follow the player ,I don't want it to be always straight behind the player but to just follow him and curve when the player changes direction like if the player was leaving a trail.But thanks for the answer. \$\endgroup\$
    – SteveL
    Sep 23, 2014 at 12:54
  • \$\begingroup\$ might have been better you had written that into your question, hahaha =) \$\endgroup\$ Sep 24, 2014 at 4:57

You must log in to answer this question.

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