How to blend scene node or material in and out?

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
ayman
Posts: 51
Joined: Sat Feb 05, 2005 7:33 pm
Location: Piefke State

How to blend scene node or material in and out?

Post 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
MeisterK
Posts: 66
Joined: Sat Feb 26, 2005 1:20 pm

Post 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.
ayman
Posts: 51
Joined: Sat Feb 05, 2005 7:33 pm
Location: Piefke State

Post 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
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post 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.
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post 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.
a screen cap is worth 0x100000 DWORDS
ayman
Posts: 51
Joined: Sat Feb 05, 2005 7:33 pm
Location: Piefke State

Post by ayman »

Any progress on that?
I still can't find a proper method to set a scene node's transparency.
Post Reply