Jump to content
  • Advertisement
Sign in to follow this  
kubert

floating text above players head

This topic is 4851 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

Does anyone have any insight or tutorial links as to how to implement the floating text used for player's names and guilds and such that floats over player's heads in many modern 3d games? I am thinking towards something along the lines of billboarding bitmapped characters, although if anyone has better ideas it would save me some trouble. I am using directx 9.0c Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Billboarding seems like a good idea although the player's name will get smaller the further into the distance they are.

Another idea might be to calculate where the player's head is on the screen and then blit the bitmap with the name several pixels above their head. This is done onto the back buffer after the 3D has been rendered.

Share this post


Link to post
Share on other sites
A popular technique is to take a point where the characters head would be in the 3d world space, and project it into screen coordinates using D3DXVec3Project.

Then you can offset X back by half the width of the rendered text for horizontal centering, and Y up by the the rendered text height plus a little bit for spacing.

Then the text can be drawn using your regular font rendering techniques.

This same method can be used for rendering health bars, or any other specific on-screen information that you desire.

Share this post


Link to post
Share on other sites
billboarding for text is probably not worth the trouble, especially if there's gonna be a lot. And working with text in 3d *may* not be wat you want because there are issues with scaling based on depth. Unless you intend text in the far background to be small and indecipherable, i believe you'd want Torment-style text that are a fixed font size irrespective of location and depth of the character. (sorry for bad example, couldnt think of a real 3D game with text right now).

just unproject the character position from 3d into screen coordinates to get the x-y coordinates, and render the text as needed in (wat i assume) is ortho mode for font rendering.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!