[Solved] Yet another Alpha Blending problem

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
nmn
Posts: 23
Joined: Tue Sep 02, 2008 7:35 pm

[Solved] Yet another Alpha Blending problem

Post by nmn »

edit: Solved.
Using the EMF_ONETEXTURE_BLEND patch. Works excellent.

--

Okay, So I'm trying Irrlicht again after a long time of not using it. It always was good but it just keeps getting cooler ;) Not to be Ogre bashing but I feel so much more in control of the development with Irrlicht. Don't even get me started on my own Game Engine attempts (Err, Getting it to work on Windows was just... MEH.)

My question is yet another n00by alpha transparency question. I want to combine PNG alpha channel transparency with vertex color transparency - I've done this in OpenGL before, and it's pretty much just a matter of setting the blending mode. I tried doing the equivalent custom blending func. in Irrlicht to no avail. Next I tried the EMT_TRANSPARENT_ALPHA_CHANNEL and EMT_TRANSPARENT_VERTEX_ALPHA. And of course, they did what i wanted, but separately (And no offense, But I really think having an alpha threshold by default is redundant. Can someone please explain that?)

Code: Select all

    IBillboardSceneNode* introboard = smgr->addBillboardSceneNode(NULL,dimension2d<f32>(0,0),vector3df(0,0,0));
    introboard->setMaterialTexture(0,driver->getTexture("res/np-light.png"));
    introboard->setMaterialFlag(EMF_LIGHTING, false);
    introboard->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);
    introboard->getMaterial(0).MaterialTypeParam = -0.5f;
    introboard->setSize(dimension2d<f32>(1.333,1.000));
    smgr->registerNodeForRendering(introboard,ESNRP_TRANSPARENT);
I should further explain my issues - I have a billboard that I was using for my splashscreen. 3D is appropriate for this splashscreen as I do a 3D fade in effect that involves the Z parameter to make it look a little less plain. Well, I managed to solve that with a hackish solution, or sort of hackish - By drawing a 2D box over the entire screen, that is the color of the background (white) + 256 minus the alpha the logo should be. Worked great so that issue was gone.

However, I need this problem to be fixed once again, as I need to do this again in the game. The background is not just a predictable color in this case..


Also, I was testing out Klagui and noticed that tooltips have the effect of not having per-pixel alpha :P Is this the same issue? Or is it more draw-order? The same thing happens when running the Klagui application under Wine, so it could be my own little OpenGL issue (doubt it, everything else runs excellent - perhaps this ones an obscure issue with the new nvidia drivers, Linux only?) The issue does NOT OCCUR with Burnings Video nor Software - but only tooltips and text show up, which doesn't indicate much really. (Doesn't Burning's Video support some of the alpha blend modes?)

My specs:
OS/Video: Linux 2.6.25.5 with NVidia drivers 173.14.12 on a GeForce 8800 GTS
Distribution: OpenSuSE (based off of 11 but running bleeding edge repos)
Compiler: gcc version 4.3.1 20080507
Irrlicht: libIrrlicht.so.1.4 (Should I be compiling my own?)

Thanks for reading my hunk of mostly useless information.
Last edited by nmn on Sat Sep 06, 2008 9:46 am, edited 1 time in total.
nmn
Posts: 23
Joined: Tue Sep 02, 2008 7:35 pm

Post by nmn »

Okay so I must have done something wrong in this post (I tried not to, but I guess I failed :X)

Or, If it's really a legit question that nobody can answer right now, can anyone suggest an alternative? I've been looking into shaders but I want to avoid high level shaders. Actually, I really want to avoid shaders for something like this at all, So I'm still hunting for the real solution. It's just not anywhere I can see...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, you made much text without clearly expressing the things you want to achieve. Also, you often say that you made this or that already, so just give some screenshots to ease understanding.
The 2d render mode supports vertex and texture alpha values, 3d mode only has either one. Moreover, there's a patch for ONE_TEXTURE_BLEND to support both alpha values (IIRC). Maybe that will already help.
nmn
Posts: 23
Joined: Tue Sep 02, 2008 7:35 pm

Post by nmn »

Whoops, my bad. I needed this for a lot of things, so I wasn't sure how to put it. "I want to combine PNG alpha channel transparency with vertex color transparency" Is the most accurate I could really get.

Thanks though. I'll look into ONE_TEXTURE_BLEND patch, though I was kinda hoping that it was already possible without a patch (SVN would work too if there's a solution with that.). Does it work on OpenGL and DirectX?
nmn
Posts: 23
Joined: Tue Sep 02, 2008 7:35 pm

Post by nmn »

Danke ;) Worked great. Had to manually apply the patch and change a few functions in Klagui but it's all working fine now. Thanks again.

Will this patch be applied? I think It's pretty useful considering existing games probably don't expect messing with the vertex color alpha to do anything anyways so it probably wouldn't break anything.
Post Reply