PDA

View Full Version : Particle Beam Effect?


Sean Doherty
01-02-2006, 08:31 AM
I am trying to create a particle beam effect. Basically, it is a straight line between the source and the target with a wavy line overlaid on top of the straight line. The attach image gives a rough idea (real rough).

The problem is: I don't want the wavy line to be compressed when the source and target are very close?

Thanks

luggage
01-02-2006, 09:14 AM
Draw the wavy line your self. Just a sin-wave would do it.

Might take some fiddling - I don't know if you can rotate graphics or not or draw additive images. But doing a particle affect which just moves using a sine wave down the beam would look nice. More particles you add the nicer it would look, if you can draw additive images you could vary the speed at which they move.

Sean Doherty
01-02-2006, 09:27 AM
I'm thinking that a sin wave would be a little slow (plotting pixel by piexel to the screen) and probably wouldn't look very good (no aliasing). Your idea to make the wav move up the beam is a good on.:)

luggage
01-02-2006, 09:30 AM
Draw the wavy part of the beam as particles. Like a little glow and just move them along in a sine wave is what I meant, sorry.

Sean Doherty
01-02-2006, 09:34 AM
Draw the wavy part of the beam as particles. Like a little glow and just move them along in a sine wave is what I meant, sorry.

That is a good idea. Why does the most complex and processor intensive solution always have to be the best?:cool:

PoV
01-02-2006, 09:56 AM
An alternate is to have a nice glowy sinewave texture. Then map it on to a simple set of 3 quads, two of them decrease their width, and the middle one takes advantage of texture wrapping for a consistent length. Then to do your pulsing effect, you simply move the texture coordinates up/down the texture.

http://www.toonormal.com/content/sineblaster.gif

techbear
01-02-2006, 10:40 AM
That's what I would do. If you can draw textured tris, and effect the UVs of said tris, then it's not too hard to do.

Remember that the ugliest parts of a "beam" made with a long, narrow quad, is the ends. So cover them up with a flare or dense particles, or preferably both.

Teq
01-09-2006, 11:44 PM
Use the sine wave approach using a precalculated lookup table. If you have this wrapped around a cylinder you'll have a similar effect to quake 2's railgun.

Mark Sheeky
01-11-2006, 08:45 AM
Generating a sine wave isn't slow, there are a few fast ways. Here is a good one:


// Initialisation
a=1
b=0
f=(desired frequency in hz)

// Iterate this...
a-=f*b;
b+=f*a;

// That's it, a=the sine wave, b=the cosine wave


This is pretty accurate too.

Mark