HUD models?

Started by
5 comments, last by Sphet 19 years, 9 months ago
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 ...
Advertisement
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).

- Thomas Cowellwebsite | journal | engine video

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

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

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.

This topic is closed to new replies.

Advertisement