• ### What is your GameDev Story?

#### Archived

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

# Facing the Screen

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

## Recommended Posts

This is pretty embarasing to ask, but I have never thought of the problem before. I have some quads "flying" around the screen. How can I make them always face my vector camera. (Like sprites in old 3d games, such as Duke Nukem or Doom) ?? [edited by - PhiberOptic on December 3, 2002 3:52:42 PM]

##### Share on other sites
Use billboarding.
You can read up on it in The Red Book or in any OpenGL programming book or reference.
Unfortunetely, I do not have a link to give you.

Hope this helps,

TommyB

##### Share on other sites
There are many possible approaches. If your "vector camera" has up and right vectors, then an easy approach is to just draw your quads using these (unit length) vectors, e.g., define each quad with a single, central point (corresponding nicely to particle in a particle system) and generate the four vertices using this point and then up and right vectors, appropriately scaled.

##### Share on other sites
or just have all your quads (particles) share a common normal vector of 0,0,1 or something. then each frame do a single rotational interpolation between that normal vector and your camera view vector. then draw your particles with:

glPushMatrix();
glMultMatrixf(yourInterpolatedRotationAsMatrix);

drawParticles();

glPopMatrix();

as long as your default coords for your quads are consistent with the 0,0,1 normal vector that will work well, and be reletively efficient (you only needing to do one interpolation per frame for the entire quad/particle system).

but yeah, look up billboarding, that''s probably better. i just made the other thing up some time ago responding to someone elses similar question somewhere else.

-me

##### Share on other sites
I do it like this:
I push the matrix, then rotate the object with -x,-y,-z angles, draw the object, pop the matrix.

##### Share on other sites
Thanks.. Billboars is just fine! =)
I''ve found a sample! =)

• ### What is your GameDev Story?

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

• 27
• 16
• 10
• 10
• 11
• ### Forum Statistics

• Total Topics
634098
• Total Posts
3015525
×