Sign in to follow this  
SoaringTortoise

HUD models?

Recommended Posts

Hi, Can anyone tell me how to render a 3D model in my HUD in DirectX 8? I want to display an inventory type of thing that shows the model of what you're carrying. I can obviously do this using 2d art, but artwork is a bottleneck at the moment, so it'd be faster to just render the model.

Share this post


Link to post
Share on other sites
The first thing that springs to mind is that you could set the world matrix to identity, then set the view matrix to be slightly in front of and above the object so it's looking at it. Then, you set the D3D viewport to the rect of the HUD item you want to draw, then draw the model as normal.

I dunno what performance hit you get by setting the viewport willy nilly, but it should work. :)

Oh yeah, you'll probably want to clear the zbuffer before rendering it as well (maybe just clear it once before rendering the hud).

Share this post


Link to post
Share on other sites
Muhammad Haggag    1358
- Render model to texture. Slap texture on quad. Render quad: I think it's going to be slow for any reasonable number of models.
Also, you'll need to use 2 or 3 (or more) RT textures and recycle them.

- Is the model animated in the view? If not, you can just render all of them to a big texture once, create a sprite out of it, and that's it.

Share this post


Link to post
Share on other sites
Muhammad Haggag    1358
Quote:
Original post by SoaringTortoise
Well, I am hoping to animate them slightly (rotation only, most likely). How did it used to get done before render to texture was available?

Good question. Things that come to mind:
- Software rendering (old stuff)
- Pre-made art (artists are there to do something, right?)
- Off the top of my head: Perhaps a projection matrix hack can achieve the effect without viewport change or something?

Share this post


Link to post
Share on other sites
Sphet    631
We do this by simply having a different camera for our hud, and placeing objects in the world with respect to the difference camera.

We also clear the z buffer before doing it, but you may be able to do something messing with the z depth of writing, biasing it so it is compressed in the foreground of your viewspace.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this