Transparency: Texture Alpha + Vertex alpha?
Re: Transparency: Texture Alpha + Vertex alpha?
For anyone interested, I don't know if it works with alpha-channel textures, but using EMT_TRANSPARENT_ADD_COLOR material type and a color key texture, like "portal1.bmp", you can fade out billboards with billboard->setColor(SColor&)Nyxojaele wrote:Is it possible to combine both transparency methods?
What I'm looking at is having billboards that use the alpha channel on the texture to define their transparency, but I want to be able to fade these billboards out over time
You need to disable lighting for the billboard : bill->setMaterialFlag(video::EMF_LIGHTING, 0);
and set all 4 colors in setColor() to your new alpha:
Code: Select all
driver->beginScene(true, true, SColor(255,200,200,200));
bill->setColor(SColor(alpha,alpha,alpha,alpha));
// Set the color of all vertices of the billboard
Re: Transparency: Texture Alpha + Vertex alpha?
If someone ever wanders in this thread looking for an answer, there's now a way of doing it wihout having to implement a shader :
It works with one texture. For multiple materials, you'll need a shader.
This will blend the texture alpha with the vertex alpha. You can then "modulate" the color of your texture by setting the node's vertex color. Works great to fade in/out a billboard that has a transparent texture on it.
Code: Select all
setMaterialType(video::EMT_ONETEXTURE_BLEND);
getMaterial(0).MaterialTypeParam = irr::video::pack_textureBlendFunc(irr::video::EBF_SRC_ALPHA, irr::video::EBF_ONE_MINUS_SRC_ALPHA, irr::video::EMFN_MODULATE_1X, irr::video::EAS_TEXTURE | irr::video::EAS_VERTEX_COLOR);
getMaterial(0).setFlag(EMF_BLEND_OPERATION, true);
This will blend the texture alpha with the vertex alpha. You can then "modulate" the color of your texture by setting the node's vertex color. Works great to fade in/out a billboard that has a transparent texture on it.