• Advertisement

Archived

This topic is now archived and is closed to further replies.

"simple" billbording problem ...

This topic is 5901 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi peoples! I''m trying to implement billbording in my small ogl engine. I''ve written a simple camera class which sets the position and rotation via glTranslatef and glRotatef..: /***************************************************** updates the camera information and sets the camera *****************************************************/ void cSouse_Camera::update() { //yaw-rotation (y) glRotatef(yaw,0.0f,1.0f,0.0f); //pitch-rotation (x) glRotatef(pitch,1.0f,0.0f,0.0f); //roll-rotation (z) glRotatef(roll,0.0f,0.0f,1.0f); //sets the position glTranslatef(-pos_cam.x,-pos_cam.y,-pos_cam.z); } I''m just setting the same rotation to my particles: for(p=lPartikel.begin();p!=lPartikel.end();++p) { pos=p->getpos(); glPushMatrix(); //billbording... glRotatef(-pCamera->getpitch(),1.0f,0.0f,0.0f); //pitch x glRotatef(-pCamera->getyaw(),0.0f,1.0f,0.0f); //yaw y glRotatef(-pCamera->getroll(),0.0f,0.0f,1.0f); //roll z glTranslatef(0.0f,0.0f,0.0f); ...... It seems to work for the x and y axis but not for the z axis.... does anyone know what I may do wrong?? Does anyone know a better solution?? Thanks for your help!

Share this post


Link to post
Share on other sites
Advertisement
you are most probably expiriencing gimbal lock.

And anothen hint:
dont EVER use matrix manipulation per particle ( no rotate/translate/push/pop). Those calls have to multipy matarix with anothe one. That is way slow. Just calculate position of particle on CPU, get up and right vector from tha camera class and send quad to GPU. (you could also minimize function overhead with use of some kind of VA)

There are more worlds than the one that you hold in your hand...

Share this post


Link to post
Share on other sites
For your camera you''re rotating yaw->pitch->roll
For your particles you''re rotating pitch->yaw->roll

Results are different.
You have to use either method one or method two, but you have to use the _same_ method in _both_ cases.

DarkWing : I agree with you for simple billboarding (like quad particles) but in some complex cases (like billboarding a 3D polygonal model) it''s better to use matrices.

Share this post


Link to post
Share on other sites
vincoof : if your particle engine has meshes for particles then you usualy don''t need to billboard them. And even then it depends on their size (number of vertices) what is faster (GPU or CPU transform)

There are more worlds than the one that you hold in your hand...

Share this post


Link to post
Share on other sites
can some1 tell me please what billboarding is? i just don''t know what the word means. i don''t want to know how to do it...

thanks,
shurcool

Share this post


Link to post
Share on other sites
nm, i got it...

Billboarding is a technique that adjusts an object''s orientation so that it "faces" some target, usually the camera. In this tutorial several techniques to implement billboarding are covered. From cheating billboards to true billboards. In all techniques both Cylindrical and Spherical versions are presented.

thanks,
shurcool

Share this post


Link to post
Share on other sites

  • Advertisement