#### Archived

This topic is now archived and is closed to further replies.

# Keeping billboards orientated

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

## Recommended Posts

I know I can use the inverse of my view matrix to keep my billboard poly''s perfectly aligned towards the camera in my scene, but what do I do if I only want to keep the facing pointed at the camera, without rotating the billboard along its edges - i.e. if the camera spins then the billboard will seem rotated on 2-dimensions to the user, but the image will always be visible.

##### Share on other sites
Really - is there anyone who could help me or point in the direction of some useful articles? I''ve tried a couple of ways of doing this, one involving LookAt matrices as world matrices, but this only got it done partly (there were glitches as the camera moved about the sprite).

So bump - anyone?

##### Share on other sites
If I understand you correctly, you want the billboard rotating along a vertical axis through its center?

I do it like this, inside the vertex shader:

let''s assume we work in the XZ plane, and the billboard rotates along the Y axis.

find the vector from the camera to the billboard center in XZ plane; (take just X, Z coords, ignore the Ys)
normalize it;
rotate it by 90 degress (just swap X and Z)

The resulting vector, call it vBillB, is perpendicular to the view direction in the XZ plane. So, just multiply it by +/-1, add the coords of the center, and you''ll get the coords of the vertices.

• 12
• 9
• 13
• 41
• 15