Combining alpha map and vertex transparency?

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
sabaal
Posts: 10
Joined: Mon Mar 20, 2006 10:19 pm
Location: Las Vegas, NV

Combining alpha map and vertex transparency?

Post by sabaal »

I've got this spiffy little PNG image which has built-in alpha, and I've gotten that to work on a material just fine. But I also need to be able to use vertex transparency, and while one material type allows me to do so, it does not process the PNG's original alpha values too. It is vital that I get the two working together somehow, so any solution, no matter how hacked and awkward, is acceptable.

Sorry for the lack of specificity. I don't have the manual with me right now, and my memory sucks. Please feel free to ask insulting questions and/or call me a moron. :P

Thanks in advance for your help. :wink:
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

AFAIK Irrlicht does not support both transparencies at once. You'd have to add your own material to set up all driver properties correctly.
sabaal
Posts: 10
Joined: Mon Mar 20, 2006 10:19 pm
Location: Las Vegas, NV

Post by sabaal »

Hmm... That's what I was afraid of. :(
Now... where would I look to find the definitions of existing materials, so's I can example-ize 'em while I make my own? Or perhaps there's a tutorial I've overlooked that explains it in detail?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No tutorials, you have to dig into the sources. The C*Material*.cpp files are the ones you want to look at. Also the Driver files will provide some insights since draw2DImage handles vertex and alphachannel transparencies (but not at once, or maybe I am wrong? Maybe look there first).
Xaron
Posts: 310
Joined: Sun Oct 16, 2005 7:39 am
Location: Germany
Contact:

Post by Xaron »

For draw2DImage and DirectX9 you could use this patch:

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=12387

Regards - Xaron
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Better use the SVN version, as that also has some other changes applied (but also the mentioned patch), and you're using the version that will be used for Irrlicht 1.2.
I've just checked the OpenGL driver and there's no support for both transparencies currently.
ProSoft
Posts: 59
Joined: Thu Sep 08, 2005 10:55 am
Location: Brasil

Post by ProSoft »

Search forum for CLODSceneNode. Its a scenenode i made some time ago, thats fade mesh LODS with distance. I used it for trees, then the custom material uses alpha and vertex transparency. This material also support vertex alpha and lightmap at same time.
sabaal
Posts: 10
Joined: Mon Mar 20, 2006 10:19 pm
Location: Las Vegas, NV

Post by sabaal »

Thanks for your help, everyone, but DirectX isn't an option. I'm kinda SOL with that patch. :?

While I was sifting through the sources, something did catch my eye:

Code: Select all

//! Transparent vertex alpha material renderer
class COpenGLMaterialRenderer_TRANSPARENT_VERTEX_ALPHA : public COpenGLMaterialRenderer
{

...

			glDisable(GL_ALPHA_TEST);

...

};

...

//! Transparent alpha channel material renderer
class COpenGLMaterialRenderer_TRANSPARENT_ALPHA_CHANNEL : public COpenGLMaterialRenderer
{

...

			glEnable(GL_ALPHA_TEST);

...

};
It appears that this, and most of the surrounding code, has to do with alpha blending. Im'a do some experiments and report back with the results.

Please keep in mind that I have nothing near an idea what I'm doing. :wink:
Post Reply