Advertisement Jump to content
Sign in to follow this  

Billboarding with gluLookAt?

This topic is 4971 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

My game engine features a 3D environment with 2D billboarded sprites. I've gotten most of the basic code up and running quite well, and keep my camera centered on my main character with gluLookAt(). My camera system works exactly as I want it to, allowing me to do fly-bys, rotations around all axises, and to focus on different parts of the scene for cinematic events. Problem is, I can't seem to get billboarding to work with my sprites... Now, the mechanics behind 3D maths is one thing I rather suck at. Hunting around for tutorials or explanations of how to achieve billboarding and attempting to implement it has failed, as they all feature custom camera systems with glTranslatef()/glRotatef() and, from what I've observed, it seems that whatever gluLookAt() does is far different than what glTranslatef()/glRotatef() does. I've attempted to build my own camera system, but I can't seem to build something that works like I want it to. Googling for this has turned up articles that, quite frankly, went way over my head; most of them skipping the math or dumping complicated expressions without explaining the how and why. I'd LOVE to keep gluLookAt() as my camera system is entirely built on top of this. It's just getting sprites to face the camera that doesn't work out too well for me. :x Many thanks in advance. Edit: Hehe, nevermind. Took me a bit of mucking about and experimenting, but I finally got it to work! Yay! :D [Edited by - RuneLancer on June 11, 2005 12:53:51 AM]

Share this post

Link to post
Share on other sites
Try this algorithm:

Matrix billboard = Camera->GetViewMatrix();
billboard = TransposeMatrix(billboard)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!