Page 1 of 1

Alpha blending functions for HUD graphics

Posted: Fri Apr 08, 2011 4:54 pm
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

Posted: Fri Apr 08, 2011 5:00 pm
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.

Posted: Sat Apr 09, 2011 10:44 am
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

Posted: Sat Apr 09, 2011 9:36 pm
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.