Node Transparency

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
Kuzy
Posts: 21
Joined: Fri Feb 18, 2011 10:30 am

Node Transparency

Post by Kuzy »

Hello,

I would like to show several nodes based on the same mesh with a certain transparency.
The following code works, but affects all nodes at once, because I change the mesh to create the transparency:

Code: Select all

 
node->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
IMesh* mesh = node->getMesh();  
    
    for(u32 i=0; i<mesh->getMeshBufferCount(); i++)
    {
        scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);        
        video::S3DVertex* vertex = (video::S3DVertex*)buffer->getVertices();
        for(u32 j=0; j<buffer->getVertexCount(); j++)
        {
            vertex[j].Color = video::SColor(transparencyValue,vertex[j].Color.getRed(),vertex[j].Color.getGreen(),vertex[j].Color.getBlue());
        }
    }
 
I would like to show each node with it's "own" transparency value. How would I achieve this?
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: Node Transparency

Post by serengeor »

Well, meshes are shared by nodes. So changing mesh would affect all the nodes.
To change that per node you should probably use material settings. But afaik proper looking transparency is hard to achieve.
Working on game: Marrbles (Currently stopped).
Post Reply