use EMT_TRANSPARENT_ADD_COLOR to make model invisible

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
sunnygraphy
Posts: 44
Joined: Mon Dec 05, 2005 8:15 am

use EMT_TRANSPARENT_ADD_COLOR to make model invisible

Post by sunnygraphy »

Hi..

I am trying to make model invisible using the following codes.

node->setMaterialFlag(video::EMF_LIGHTING, true);
node->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
node->getMaterial(0).AmbientColor.set(0,0,0,0);

but I could not get completely invisible model.
som part sill can be seen.


how to solve this problem?

thanks
Warchief
Posts: 204
Joined: Tue Nov 22, 2005 10:58 am

Post by Warchief »

Think add color is suppposed when you dont need full transparency. It will add the color to the color behind (best for particle systems). You may want to give an alpha value to the texture and use ALPHA or ALPHA_REF types.
Warchief's Warboard 3D Now hotseat release
esaptonor
Posts: 145
Joined: Sat May 06, 2006 11:59 pm

Post by esaptonor »

why not just use node->setVisible(false); ?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

esaptonor wrote:why not just use node->setVisible(false); ?
Right, why not ???


First you try to flip the surfaces and now with transparent color... :roll:
This also does not what you want to (like the surface flipping) !!!
It just makes the mesh/node transparent not invisible !!!

The only way would be to change the texture to full black (or was it full white) and then make it transparent, but I don't really know if then the node is really invisible...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Warchief
Posts: 204
Joined: Tue Nov 22, 2005 10:58 am

Post by Warchief »

Lol, my mistake. Just misunderstood. Thought he wanted full transparency for some parts of the model.
Warchief's Warboard 3D Now hotseat release
sunnygraphy
Posts: 44
Joined: Mon Dec 05, 2005 8:15 am

Post by sunnygraphy »

Warchief wrote:Lol, my mistake. Just misunderstood. Thought he wanted full transparency for some parts of the model.
I want model to disappear slowly not suddenly
Warchief
Posts: 204
Joined: Tue Nov 22, 2005 10:58 am

Post by Warchief »

Soz, have not tried that myself. But i have two ideas that could work:

1) Use a texture with alpha channel in gradient. Material type: EMT_TRANSPARENT_ALPHA_CHANNEL. Then, modify SMaterial::MaterialTypeParam so it goes hiding the model as it hides the values from the alpha gradient.

2) Use EMT_TRANSPARENT_VERTEX_ALPHA. Not sure about this one.
Warchief's Warboard 3D Now hotseat release
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

sunnygraphy wrote:I want model to disappear slowly not suddenly
Ahh, why you didn't tell this from the beginning ??? ;)
Maybe this thread can help you (I didn't test it yet)
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=18160
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply