Advertisement

Particles

Started by October 05, 2001 03:34 PM
3 comments, last by Patrick S 23 years, 4 months ago
Hi, how do I make particles always facing the camera? Regards, Patrick
Regards,Patrick
I guess your question is the same as "how do I make a polygon always face the camera?". It is called billboarding and a search for it will give you some help.
Advertisement
I''ll be releasing a demo all about a full billboarded particle engine in the next few days (with full source code given)... That should help you out quite a bit. The demo is completely done, I''m just polishing some of the code, and fully commenting it as we speak.

------------------------------
Trent (ShiningKnight)
E-mail me
ShiningKnight Games
Thanks for reply!

Yeah. Now I know what I have to search for.

ShiningKnight: work faster, harder and well documented!! And by the way: FASTER!!! )) I''m very interested!



Regards,Patrick
While the tutorial is being written, this question really depends on how you''re determining the origin for your particle generator. If you''re using glRotatef() and glTranslatef() to change the location, then you just need to reverse all of your glTranslatef()''s (in reverse order). In other words if you have...

glRotatef(x, 1.0f, 0.0f, 0.0f);
glRotatef(y, 0.0f, 1.0f, 0.0f);
glRotatef(z, 0.0f, 0.0f, 1.0f);

Then right before you render your particles you''d put:

glRotatef(-z, 0.0f, 0.0f, 1.0f);
glRotatef(-y, 0.0f, 1.0f, 0.0f);
glRotatef(-x, 1.0f, 0.0f, 0.0f);

This is a very simple solution (and may not apply to your situation), but if you search on google for OpenGL Billboarding it''ll turn up lots of different ways to do it. I actually ended up not using this method at all, but rather getting the x,y,z components from my matrix after performing all of my rotations and translations. This issue has been addressed many times in this forum as well, so I''d encourage you to do a little searching here =)

"It''''s better to be thought of as insane than to eat your next door neighboors and remove all doubt".
"It''s better to be thought of as insane than to eat your next door neighboors and remove all doubt".

This topic is closed to new replies.

Advertisement