## particle with tail and billboarding

### particle with tail and billboarding

I sent it on cga.opengl, but now I realized it's probably better place...

Particle is located in point P0.
Its tail (trace) is located in points: P1, P2, P3, etc...
Camera is located in point C.

I want to draw "line" from P0 to P1, then from P1 to P2, then from P2 to P3,
etc...
However, it can't be just GL_LINES, because its thickness should differ when
particle is far or close to camera.
So I need to construct set of rectangles, based on P0 and P1, then P1 and P2,
then P2 and P3, etc... And draw them with positive alpha inside and alpha=0 on
edges.

The problem is how to do it correctly, so rectangles will be faced directly to
rotating objects, but about generating points around "lines", to make
rectangles.

example:

this is part of tail:

P0--------P1

this is rectangle:

A--------B
|      |
P0--------P1
|      |
D--------C

It's obvious that AD and BC are perpendicular to P0P1.
There is infinite set of vectors which are perp. to P0P1, but only one (?)
which is faced directly to camera.

How to calculate it? :-)

PS. CP0 x P0P1 == AD ?

--
Free Software - find interesting programs and change them
NetHack - meet interesting creatures, kill them and eat their bodies
Usenet - meet interesting people from all over the world and flame them
Decopter - unrealistic helicopter simulator, get it from http://decopter.sf.net

### particle with tail and billboarding

> So I need to construct set of rectangles, based on P0 and P1, then
> P1 and P2, then P2 and P3, etc... And draw them with positive alpha
> inside and alpha=0 on edges.

Looks like you're going at this the wrong way.  The object you're
constructing is sometimes referred to as a "tube", sometimes as a
"worm" or "snail".  It's "thick line" situated in 3D.

I don't think your plan of using billboarding to draw it will lead you
anywhere.  Better draw it the way it actually looks: a surface of
cylindrical topology, with constant diameter, going from P0 to P1,
from there to P2, and so on.

--

Even if all the snow were burnt, ashes would remain.

### particle with tail and billboarding

Quote:> I don't think your plan of using billboarding to draw it will lead you
> anywhere.

Why?

Quote:> Better draw it the way it actually looks: a surface of cylindrical topology,

But it will be much slower. What exactly are bad sides of using billboarding
here?

--
Free Software - find interesting programs and change them
NetHack - meet interesting creatures, kill them and eat their bodies
Usenet - meet interesting people from all over the world and flame them
Decopter - unrealistic helicopter simulator, get it from http://decopter.sf.net

### particle with tail and billboarding

[...]

Quote:> But it will be much slower. What exactly are bad sides of using billboarding
> here?

You say the line extends from P0 to P1, and you did mention them to be
at different depths.  This means your tube inherently has the
opportunity to vanish behind some object object, be lighted
directionally, or do lots of other 3D-only things.

At the heart of it, your tube simply is not a flat piece of cardboard.
It's not even close.  It could just as easily wrap around the whole
scene in weird orientations, or be stretched out almost parallel to
the local camera projection vector, and extend over very long ranges
in the depth coordinate.

Billboarding is a trick that can work with objects whose z extent you
can safely ignore.  This simply is not the case for a generic
tube-shaped object, especially not one whose z variation is large
enough that you have to deal with the perspective effect.

Assuming a tube is flat and orthogonal to the view, when it isn't,
will introduce very visible errors.

--

Even if all the snow were burnt, ashes would remain.

### particle with tail and billboarding

Quote:> You say the line extends from P0 to P1, and you did mention them to be
> at different depths.  This means your tube inherently has the
> opportunity to vanish behind some object object, be lighted
> directionally, or do lots of other 3D-only things.

I will disable lighting and texturing, only colors with alpha will be used.

Quote:> At the heart of it, your tube simply is not a flat piece of cardboard.
> It's not even close.  It could just as easily wrap around the whole
> scene in weird orientations, or be stretched out almost parallel to
> the local camera projection vector, and extend over very long ranges
> in the depth coordinate.

I will try to make tail short, all I need is good looking particle system, I am
not going to create huge objects this way.

Quote:> Assuming a tube is flat and orthogonal to the view, when it isn't,
> will introduce very visible errors.

I will try to code it, and if it's true I will build full-3D object.

--
Free Software - find interesting programs and change them
NetHack - meet interesting creatures, kill them and eat their bodies
Usenet - meet interesting people from all over the world and flame them
Decopter - unrealistic helicopter simulator, get it from http://decopter.sf.net

Particle is located in point P0.
It's tail (trace) is located in points: P1, P2, P3, etc...
Camera is located in point C.

I want to draw "line" from P0 to P1, then from P1 to P2, then from P2 to P3,
etc...
However, it can't be just GL_LINES, because its thickness should differ when
particle is far or close to camera.
So I need to construct set of rectangles, based on P0 and P1, then P1 and P2,
then P2 and P3, etc... And draw them with positive alpha inside and alpha=0 on
edges.

The problem is how to do it correctly, so rectangles will be faced directly to
rotating objects, but about generating points around "lines", to make
rectangles.

example:

this is part of tail:

P0--------P1

this is rectangle:

A--------B
|      |
P0--------P1
|      |
D--------C

It's obvious that AD and BC are perpendicular to P0P1.
There is infinite set of vectors which are perp. to P0P1, but only one (?)
which is faced directly to camera.

How to calculate it? :-)

PS. CP0 x P0P1 == AD ?

--
Free Software - find interesting programs and change them
NetHack - meet interesting creatures, kill them and eat their bodies
Usenet - meet interesting people from all over the world and flame them
Decopter - unrealistic helicopter simulator, get it from http://decopter.sf.net