Jump to content
  • Advertisement
Sign in to follow this  
Raptisoft

Rotating a billboard

This topic is 2157 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 all,

 

I'm drawing a billboard by the old method of extracting the up and right vectors, then just drawing a quad based on those.

 

However, I want to draw a swirl (as a billboard) that rotates as it fades away (kinda like the puffs of smoke in Wind Waker).  Can anyone recommend a good method of doing that?

 

Also, I'm able to extract the up and right vectors from my draw matrix-- is there a way to extract a BILLBOARD matrix from my draw matrix?  If I can do that, I can probably throw the rotation into that and just draw that way.

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Not sure what you mean by a "billboard matrix." Can you just use the draw matrix's up/right/forward vectors and the object's translation for your billboard matrix? Edited by Samith

Share this post


Link to post
Share on other sites

You can extract a billboard matrix from the 3x3 rotational part of the inverse of the view matrix you're using (which is what I assume your refer to by your "draw matrix").

 

To add an additional rotation you can pre-multiply the billboard matrix by a matrix that first rotates the object "in 2D" around the z-axis:

 

matrixRotateAxis(vec(0, 0, 1), angle) * matrixKillTranslation(matrixInverse(viewMatrix));

 

This effectively "undos" the rotation that will be caused by the view matrix. This you then multiply by your existing world and view matrices.

Edited by eppo

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!