transparency in textures does not work
Posted: Fri Jan 27, 2006 9:05 pm
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:
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
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);
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