Skip to main content
GameDev.net gamedev.net
🔒 Locked

HUD models?

Started by SoaringTortoise Jul 8, 2004 at 4:19 AM 5 replies 1.4k views
Original Post
SoaringTortoise
SoaringTortoise
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.
Always prey on the weak, the timid and the stupid. Otherwise you'll just get your butt kicked
For a tortoise, this is extremely hard to do, but when you get it right... the expression on their faces ...
cow_in_the_well
cow_in_the_well
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).
SoaringTortoise
SoaringTortoise
That's a novel way to approach the problem, but the hit has been a bit too heavy. Any other approaches?
Always prey on the weak, the timid and the stupid. Otherwise you'll just get your butt kicked
For a tortoise, this is extremely hard to do, but when you get it right... the expression on their faces ...
Muhammad Haggag
Muhammad Haggag
- 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.

SoaringTortoise
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?
Always prey on the weak, the timid and the stupid. Otherwise you'll just get your butt kicked
For a tortoise, this is extremely hard to do, but when you get it right... the expression on their faces ...
Muhammad Haggag
Muhammad Haggag
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?

Sphet
Sphet
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.