Billboards that don't roll with the camera?

Started by
2 comments, last by d h k 11 years, 10 months ago
Hello there,

I'm trying to find a way to easily render billboards (ie. quads that are always looking exactly at the camera)! The only method I can find is to use the inverse view matrix of the camera as the billboards world matrix (without the translation part of the matrix). That works fine but means that my billboards always even roll with the camera when it rolls itself.

What I need is a method that will have my billboards looking at my camera but still maintain their roll! If you picture a 2D sprite of a barrel in an old-school first-person shooter, for example, if you could roll your camera in these games, the barrel should not 'rotate along' with the camera's roll, the barrel should still stand perpendicular to the ground even when the camera is rolling!

My idea was to find the roll components of that inverse view matrix and set them to 0,0,0 or whatever just like you do with the translation but I wasn't able to get that working, it either completely broke the billboarding or didn't make a difference at all. My main problem here is that I just can't find any decent information on how d3d9 even lays out view matrices...

I'm using D3D9 so it's row vectors from what I know!

I hope I was able to make my question clear (it is kinda hard to describe), if anything doesn't make sense, let me know and I'll gladly update with more info. Thanks ahead of time!
Advertisement
What you need is to constrain the rotation around the Up-axis. Have a google of cylindrical billboarding.
Perhaps these links will help:
http://www.fastgraph.com/makegames/3drotation/ (look at Building a Rotation Matrix, it talks about making a camera rotation without roll)
http://stackoverflow.com/questions/2396087/direct3d-how-do-i-calculate-roll-from-view-matrix (looks at calculating yaw, pitch and roll from a rotation)
Thanks guys, I figured it out! I didn't realize the term was cylindrical (and spherical, which is what I ended up needing) billboarding, that was the problem! Thanks for pointing me in the right direction.

This topic is closed to new replies.

Advertisement