particle with tail and billboarding

particle with tail and billboarding

Post by Jacek Pop?awsk » Tue, 01 Jul 2003 13:21:15



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
camera. I read tutorials about billboarding, but this time it's not about
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

Post by j » Tue, 01 Jul 2003 17:45:05


if your camera is at C and you want to draw
a rectangle starting at P1 facing the camera, you need
a vector which is perpendicular to the line C - P1 and, preferably,
also to the line P2 - P1, right ? the cross product of two vectors
does just that, it gives you a vector that is perpendicular
to the two input-vectors and has the magnitude of
the area of the parallelogram formed by the two input-vectors.
so, to get a offset-vector from your first linesegment P1 - > P2,
take the cross-product V = ( C - P1 ) x ( P2 - P1 ) this will point
'up' from the linesegment, perpedicular to both the line of sight
and the first linesegment. Then normalize, ie divide V by it's own
length, scale it to the appropriate height for the rectangle,
 and you're ready to construct a billboarded rectangle like

glBegin( GL_QUAD )
glVertex    P1 + V
glVertex    P2 + V
glVertex    P2 - V
glVertex    P1 - V
glEnd()

... google 'vector crossproduct' and 'vector normalisation' to learn more
; )

J

--
reply to J at dynamica dot org
"The first principle is that you must
not fool yourself - and you are the
easiest person to fool" -- R.Feynman

Quote:> 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
> camera. I read tutorials about billboarding, but this time it's not about
> 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

 
 
 

1. 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
camera. I read tutorials about billboarding, but this time it's not about
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

2. Nvidia Quadro4 XGL vs Geforce4 Ti for 3D hardware texture mapping

3. I need help with my Particle Comet Tail

4. Postscript output from Render

5. Particle "tail"

6. Caret Size

7. Drawing particle "tail" help please

8. how to associate an application with Win Explorer Preview?

9. Adv. Particle Question-particles emiting particles

10. Particles, particles particles

11. = Tear-Drop Blob w/Curved Tail? =

12. EPSF pics leaving tails...

13. The Tail of the Moose