Drawing HUD's in d3d

Started by
3 comments, last by NotTaxes 22 years, 9 months ago
Howdy, is there a really really simple way to draw flat bitmaps over a 3d scene in DX8? I figure I can do a billboard technique (or get cheap & nasty and use really big pointsprites), but positioning it so that it is just in front of the camera seems like a lot of work to just get a simple flat bitmap out (especially when the camera can move in any direction). I saw that there was a similar post a couple of months back and someone said something about a DrawSprite function, but that doesn''t seem to be available. Someone else also suggested changing the world/view matrix, but I''m not sure how to do that in this case (I''m already changing it for the camera so I *know* how to change it, but how do I do this in the middle of a beginscene/endscene without screwing up the rest of the rendering?). ... and a small note... I''m quite excited. The terrain engine I''ve spent the last two weeks working on is almost finished! It''s got height-mapping, mesh-file overlays (for trees & buildings etc.) and it''s got badies roaming around (well... OK, at the moment all the badies look suspiciously like malevolent traffic cones with hideous flourescent orange texturing... but they move around and they do interesting things so does it matter too much that they''re not pretty?). I''ve also got cliff-facing on the terrain (true verticle terrain), and animated water effects and it all runs at a playable 30-40 fps. Can''t get the damned lighting to work though... everything just keeps coming back at me in full-bright no matter what I do :-( Still, that''s all completely besides the point. Right now, I just want to get the HUD sorted out. I have plenty of talent and vision, I just don''''t give a damn.
'Doing the impossible is kind of fun' - Walt Disney
Advertisement
Both of those suggestions are ridiculous, unless you specifically want your HUD to look 3D like the rest of the game, in which case bill-boarding the interface is about all you can do. But if you want a conventional 2D HUD, you can create polygons using TLVertices and render them on top of the scene.

The TLVERTEX type is for people who want to write their own transformation/lighting pipeline, but they''re particularly useful for drawing polygons directly to the screen, because they use screen coordinates instead of world coordinates. You can texture them like normal polygons, and you can light the vertices yourself, making them full white or even colored. Very cool for producing good-looking HUD''s.

People have been talking about making 2D games using TLVertices for quite some time. I''m surprised you haven''t heard about it. Look in the docs for more information on TLVERTEX. They''re used pretty much the same way as the VERTEX and LVERTEX types.

GDNet+. It's only $5 a month. You know you want it.

Is your engine 1st or 3rd person? I am at the beginning of writing my own 3rd person isometric-view style engine, and am looking for some hints as to how people do stuff I am wondering how you implemented verticals. Do you draw a vertical for every tile, or only if there is a discontinuity in the height-map? Also, do you call draw-primitive for each tile, or do you set up a vertexbuffer for the entire map. Just curious and trying to get some ideas, THx.
Hey, thanks for that TOM. I had tried to use a TLVERTEX prior to posting the article, but it just wasn''t appearing at the right screen pos so I thought I was trying to do the right thing with the wrong method. But now, thanks to your response, I can keep on going with what I was originally doing and try to figure out a way to make it work. I think I may have been trying to use world-space co-ordinates... ooops:-) or it could be something completely unrelated, like not setting the VertexFormat properly at that point.

-zennehoty, the engine at the moment supports both 3rd and 1st person perspectives (pretty simple once you''ve got the camera thing working). I use a marker on the height-map to tell the engine to draw a tile as undulating terrain or as a cliff-face, and when it has to be done as a cliff-face, I just draw an extra two polygons, going from the height-map points straight down (and I tell the surrounding heightmaps to lay-off trying to link-up). As for rendering... I tried using drawprimitive, but I was only getting around 18fps, so I switched to using vertexbuffers for sections of the terrain (not the whole thing, since the texture management gets hairy, but I cordon-off chunks of the map and create vertexbuffers of like-textured surfaces within that chunk... and then only draw chunks that are visible at any given point).



I have plenty of talent and vision, I just don''''t give a damn.
'Doing the impossible is kind of fun' - Walt Disney
Tom: thanks for giving the advice, I was having the exact same problem in my simple 3d drag racing engine and now i have a perfect car interior.

NotTaxes: it works perfect on my screen, i followed the help file carefully though. check directx graphics->using directx graphics->Vertex Formats->Transformed and Lit Vertices and it''ll tell you everything you need to know

This topic is closed to new replies.

Advertisement