Alpha blending functions for HUD graphics

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Gorbstein
Posts: 37
Joined: Wed Nov 25, 2009 8:44 pm
Location: Scotland

Alpha blending functions for HUD graphics

Post by Gorbstein »

Hi All,

Feel like a bit of a noob, but not sure how to get Irrlicht to blend my hud graphics on top of my game graphics in the exact way that I'd like.

I have a radar screen which is displayed while the player holds down a key. Currently it looks like this:

Image

As you can see everything is a bit too bright, and you can hardly see the blips of the other ships on the radar. I'd like the hud radar graphic to darken the screen slightly, rather than lightening it.

The radar is a simple quad scene node added to a second scene manager which draws the HUD graphics.

After setting up the node I set it as transparent with:

Code: Select all

radar->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
I understand irrlicht has other blend functions, but how do I set these, and what combination am I likely looking for?

Cheers,

D
Image
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

Wouldn't normal alpha blending make more sense? That would darken the screen, and wouldn't make things bright. You could try subtractive (though irrlicht doesn't support it by default) but that has its fair share of problems too.
Gorbstein
Posts: 37
Joined: Wed Nov 25, 2009 8:44 pm
Location: Scotland

Post by Gorbstein »

Yep, that does work, although I was wondering if there was a way to do it without either changing the individual vertex alpha or the texture's alpha channel (long story).

I was sure I found a post about using one of the blend functions to achieve this, although I can't find it now and I can't for the life of me remember the code for doing it.

This screeny is with using the texture's alpha channel which I adjusted to about 80% in PS, which I suppose is pretty much the look I wanted, so I'll go with that in the meantime.

Image

D
Image
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

There's not. Using the texture's alpha channel is by far the best way.
Blend functions can only work with the values they're given, and alpha blending can only work when they are given alpha values. They're given by vertex alpha or texture alpha.
Post Reply