transparency in textures does not work

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
warden
Posts: 11
Joined: Thu Nov 24, 2005 3:54 pm

transparency in textures does not work

Post by warden »

hi there, now i'm really stuck. hope some of you guys can help me out.

i'm trying to create a 3d-user interface. however, starting with the basics I want to create round circular widgets. to keep it simple I put a circle image texture on a testscenenode (simple cube mesh) and make the corners transparent.

well, and thats the problem. i don't get it to be transparent.

plz take a look at the following code snippet:

Code: Select all

scene::ISceneNode* widget = smgr->addBillboardSceneNode(0,core::dimension2d<f32>(1.0f,1.0f),core::vector3df(0.0f,0.0f,-1.0f),-1);
//scene::ISceneNode* widget = smgr->addBillboardSceneNode(0,core::dimension2d<f32>(1.0f,1.0f),core::vector3df(0.0f,0.0f,-1.0f),-1);
//device->getVideoDriver()->setTextureCreationFlag(video::ETCF_ALWAYS_16_BIT, true);
video::ITexture* wgtex = driver->getTexture("../../media/circle.bmp");
driver->makeColorKeyTexture(wgtex, core::position2d<s32>(0,0));
widget->setMaterialTexture(0, wgtex);
widget->setMaterialFlag(video::EMF_LIGHTING, false);
widget->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
//widget->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
//widget->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
as you can see i tried many ways. theoretically, the makeColorKeyTexture should be best. it doesn't work at all, anyway! not with 16 bit textures, not with 32 bit, not if 16 bit is forced (32bit is standard in .14, right?), not if I add a material type.
the only transparent effect I get, is when the corners of the circle are dark and I choose EMT_TRANSPARENT_ALPHA_CHANNEL_REF. This is unacceptable as I need dark colours for UI design. EMT_TRANSPARENCY_ADD_COLOR works as well, but I need bright colour to be solid as well. with EMT_TRANSPARENT_ALPHA_CHANNEL the whole texture is invisible. All this is independent of the use of makeColorKeyTexture which as no effect at all.

Other options I tried: orthogonal projection vs perspective, billboardscenenode instead of testscenenode.

erm, please help me!

best regards,
warden
dawasw
Posts: 357
Joined: Tue Aug 10, 2004 4:39 pm
Location: Poland

Post by dawasw »

Why not trying up a .tga file with alpha channel selection ;) ?
warden
Posts: 11
Joined: Thu Nov 24, 2005 3:54 pm

Post by warden »

dawasw wrote:Why not trying up a .tga file with alpha channel selection ;) ?
i didn't know how to do it. thanks to your advice I tried something with photoshop and it looks quite good. I assume I add an alpha channel and use the eraser or could you give me a short tutorial on this?

thank you, sometimes you try to open a door while standing next to it touching the wall... erm yeah! next glass of zoladkowa gorzka is devoted to you!!
miko93
Posts: 54
Joined: Sat Nov 12, 2005 5:24 pm
Location: Regensburg, Germany
Contact:

Post by miko93 »

Well, although having a solution as proposed by dawasw, I tried the same way warden did. And ran into exactly the same problems (see above). Anyone got this working?

Thanks
"Yessir, I'll be happy to make these unnecessary changes to this irrelevant document." (Dilbert)
Post Reply