Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Billboards that don't roll with the camera?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 d k h   Members   -  Reputation: 435

Like
0Likes
Like

Posted 07 June 2012 - 01:49 PM

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, 07 June 2012 - 01:54 PM.


Sponsor:

#2 dAND3h   Members   -  Reputation: 214

Like
0Likes
Like

Posted 07 June 2012 - 07:44 PM

What you need is to constrain the rotation around the Up-axis. Have a google of cylindrical billboarding.

#3 jefferytitan   Crossbones+   -  Reputation: 2246

Like
0Likes
Like

Posted 07 June 2012 - 08:52 PM

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)

#4 d k h   Members   -  Reputation: 435

Like
0Likes
Like

Posted 09 June 2012 - 08:49 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS