Sign in to follow this  
d h k

Billboards that don't roll with the camera?

Recommended Posts

d h k    439
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! Edited by d k h

Share this post


Link to post
Share on other sites
jefferytitan    2523
Perhaps these links will help:
[url="http://www.fastgraph.com/makegames/3drotation/"]http://www.fastgraph.com/makegames/3drotation/[/url] (look at Building a Rotation Matrix, it talks about making a camera rotation without roll)
[url="http://stackoverflow.com/questions/2396087/direct3d-how-do-i-calculate-roll-from-view-matrix"]http://stackoverflow.com/questions/2396087/direct3d-how-do-i-calculate-roll-from-view-matrix[/url] (looks at calculating yaw, pitch and roll from a rotation)

Share this post


Link to post
Share on other sites
d h k    439
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this