Hi together,
I am searching for a way to blend a mesh or a material from invisible to visible and back step by step. Other 3d-libs have that possibility to set a transparence value (typically a one byte value) for a whole object/entity.
What I found so far in Irrlicht is the possobility to manipulate transparency with a texture (alpha channel) or with the pixel's alpha. But that wouldn't be a nice way to do blending, cause I would need 255 or so textures with different alpha channels in the first case or to change all pixel's alpha for each step.
Any tipps what I could do?
Regards
Ayman
How to blend scene node or material in and out?
I havn't done it yet (but will do it soon)
So my idea is:
scene:ISceneNode myNode;
// Load and init node
myNode->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);
// Later on when need to fade out...
video::ITexture nodesTexture = myNode->getMaterial(0).Texture1;
void* PointerToPixelArray = nodesTexture.lock();
// use ITexture::getSize() to access each pixel
// chaning it's alpha value
nodesTexture.unlock();
Dont know if this is a wise and fast solution, but maybe at least initial idea.
So my idea is:
scene:ISceneNode myNode;
// Load and init node
myNode->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);
// Later on when need to fade out...
video::ITexture nodesTexture = myNode->getMaterial(0).Texture1;
void* PointerToPixelArray = nodesTexture.lock();
// use ITexture::getSize() to access each pixel
// chaning it's alpha value
nodesTexture.unlock();
Dont know if this is a wise and fast solution, but maybe at least initial idea.
@MeisterK: Thanks for the answer.
I see three problems with your idea:
1.) The Irrlicht Help File says that EMT_TRANSPARENT_ALPHA_CHANNEL is currenly NOT IMPLEMENTED.
2.) Although, if it would work, I can't use the same texture for several SceneNodes or objects. Blending out one object/entity would result in blending out all objects/entities that use the same texture. So I would have to load the texture again and again. But that seams to be no efficient usage of the video cards memory.
3.) It's a whole lot of pixels I have to change if I use large textures or, even worse, lots of textures for one object/entity.
Any other suggestions?
Regards
Ayman
I see three problems with your idea:
1.) The Irrlicht Help File says that EMT_TRANSPARENT_ALPHA_CHANNEL is currenly NOT IMPLEMENTED.
2.) Although, if it would work, I can't use the same texture for several SceneNodes or objects. Blending out one object/entity would result in blending out all objects/entities that use the same texture. So I would have to load the texture again and again. But that seams to be no efficient usage of the video cards memory.
3.) It's a whole lot of pixels I have to change if I use large textures or, even worse, lots of textures for one object/entity.
Any other suggestions?
Regards
Ayman
docs need to be updated. EMT_TRANSOPARENT_ALPHA_CHANNEL is implemented. Also, the meshManipulator allows one to set the alpha of a mesh, though that would affect all nodes using the mesh.
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.
Crucible of Stars
Crucible of Stars