Jump to content

HUD's


Shard
 Share

Recommended Posts

I'm about to start working on the HUD for my Applied Project game and I wanted to know what the common ways the forum does it.

 

 

We have a HUD layout [attached] where we will have different sprites for gun models, an ammo count and a two layer health meter (shields/health).

 

 

From what I figure we would create a plane of some sort that would always be in front of the camera and we would draw the sprites onto the plane and make it see through but I'm not a hundred percent sure how one would go about doing this.

 

 

So forum, how do you make your HUD's?

post-26-12693763160267_thumb.jpg

simpleSigPNG.png

 

Programmer/Engineer/Student

www.reikumar.com

 

2.6 GHz Intel Core Duo - nVidia GeForce 8600 GT - Windows 7 64-bit - 4 Gigs RAM

C++ - Visual Studio Express - Dark GDK - Leadwerks SDK

Link to comment
Share on other sites

You could draw to a texture and then use the texture to texture a sprite which you could parent to the camera. This is good for transparency.

AMD Phenom 9850 (X4 2.5GHz) | 1066MHz CL5 GEIL Black Dragon (800MHz) | Powercolor ATI 4870 1GB | DFI 790FXB-M2RSH | 24" 1920x1200 | Windows Vista 64-bit Ultimate

Link to comment
Share on other sites

This is using the 2D method, drawing to an offscreen buffer. Draw to the buffer AFTER calling Render().

 

Look into CreateBuffer(Width, Height, BUFFER_COLOR), the buffer it returns you can use to draw using 2D commands.

 

Here's a little pseudo-code to give you an idea.

 

// save current buffer
tempBuffer = CurrentBuffer() ;

myhudbuffer = CreateBuffer(Width, Height, BUFFER_COLOR) ;
SetBuffer(myhudbuffer) ;

// We can give it a variable transparency or background colour by filling with a colour and alpha
SetColor(Vec4(red, green, blue, alpha)) ;
DrawRect(0, 0, width, height) ;

// Do lots of interesting drawing here...
// even OpengGL if it takes your fancy


// Done drawing so lets paste it at some screen co-ordinates
DrawImage(GetColorBuffer(myhudbuffer), x, y, width, height);
// restore original buffer so we don't upset anything
SetBuffer(tempBuffer) ;

 

 

That should be enough to get you going for your specific needs. You might want to assign a material to the buffer. Or use a smoothing filter. After creating the buffer...

 

material = CreateMaterial() ;
SetMaterialTexture(material, GetColorBuffer(myhudbuffer)) ;
TextureFilter(material.GetTexture(), TEXFILTER_SMOOTH) ;

 

Even use shaders on with the material too.

6600 2.4G / GTX 460 280.26 / 4GB Windows 7

Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT

Tricubic Studios Ltd. ~ Combat Helo

Link to comment
Share on other sites

just remember due to recent changes, the buffer you create needs to be the same size as your current buffer or you will have serious fps drop. :lol:

I don't think there is anything that would cause this. I think you mean rendering with the framework commands to a different buffer.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I use a helmet HUD which`s background is part of the nightvision/normalvision in its postprocess.frag. So i can colorise and fade or even fade it to zero.

 

alphaHUD

 

With that i guess ill use 3d models representing a compass, current weapon etc. - not sure about reflections on the visor because 1. dont want to obscure the players view too much 2. would better use a "complete" 3d model for such attempt and shake this model if the player got hit (atm i can shake the view within its postprocess shader).

 

Some issues i do have with my hud is like, should i go for a more cinematic look (minimal hud - fade it in on key press, enemy arrival) or the always present "simulation" kind of HUD iam using atm - the more quiet (search and destroy) moments do require the later but would look/feel plain awful in bright sunlight.

 

Another thing imho is that some huds are kind of overused - you know the kind of star track outlines HUD thing in light blue/green/orange. Maybe because it looks good. :lol::)

AMD 64 X2 Dual 5k - 4GB - XFX GForce9800GT - nv196.21 - WinXP Sp3

zBrush4R2 - Silo2Pro - Unwrap3DPro - Gile - MaPZone2.5

 

adv_banner-april2012_720x150_tex01.png

 

Xxploration FPS in progress ...

Link to comment
Share on other sites

DrawImage() is good enough for loading a texture and putting it on screen. No need to use OpenGL for that.

 

 

Unless of course you want to rotate it.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

You can also rotate images with OpenGL commands.

 

 

which was my point.

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...