Page 1 of 1

use EMT_TRANSPARENT_ADD_COLOR to make model invisible

Posted: Tue Jan 16, 2007 5:41 am
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

Posted: Tue Jan 16, 2007 8:03 am
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.

Posted: Tue Jan 16, 2007 8:30 am
by esaptonor
why not just use node->setVisible(false); ?

Posted: Tue Jan 16, 2007 2:01 pm
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...

Posted: Tue Jan 16, 2007 7:53 pm
by Warchief
Lol, my mistake. Just misunderstood. Thought he wanted full transparency for some parts of the model.

Posted: Wed Jan 17, 2007 3:36 am
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

Posted: Wed Jan 17, 2007 8:20 am
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.

Posted: Wed Jan 17, 2007 1:36 pm
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