# Rotating a billboard

This topic is 1878 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
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 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

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 15
• 14
• 46
• ### Forum Statistics

• Total Topics
634059
• Total Posts
3015291
×