Page 1 of 1

How to blend scene node or material in and out?

Posted: Wed May 11, 2005 3:58 pm
by ayman
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

Posted: Wed May 11, 2005 6:19 pm
by MeisterK
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.

Posted: Wed May 11, 2005 6:37 pm
by ayman
@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

Posted: Wed May 11, 2005 6:42 pm
by Electron
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.

Posted: Wed May 11, 2005 7:13 pm
by keless
I actually suggested the neccesity to fade in/out scene nodes, and Niko has stated that he's now working on adding it to the engine.

Posted: Sun Aug 21, 2005 5:14 pm
by ayman
Any progress on that?
I still can't find a proper method to set a scene node's transparency.