Transparent planes

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
mikkis
Posts: 64
Joined: Mon Jan 28, 2013 2:38 pm
Location: Fi

Transparent planes

Post by mikkis »

If I create, say bush, with planes (with image of leaves, includes alpha channel), I want to read+write to zbuffer but only
where alpha!=0. Havent succeeded with this yet.

Current code:

Code: Select all

 
        sceneManager->getParameters()->setAttribute(ALLOW_ZWRITE_ON_TRANSPARENT, true);
 
        ITexture *image = driver->getTexture("../media/leaf.png");
        tree.load("tree.md2", sceneManager);
        tree.getNode()->setMaterialTexture( 0, image );
        tree.getNode()->setMaterialFlag(EMF_LIGHTING, false);
        tree.getNode()->setMaterialFlag(EMF_BLEND_OPERATION, true);
        tree.getNode()->setMaterialFlag(EMF_ZWRITE_ENABLE, true);
        tree.getNode()->setMaterialFlag(EMF_ZBUFFER, true);
        tree.getNode()->setMaterialFlag(EMF_BACK_FACE_CULLING, false);
        tree.getNode()->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);
 
What I'm missing?
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Transparent planes

Post by Mel »

Use EMT_TRANSPARENT_ALPHA_CHANNEL_REF, or use a shader
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
mikkis
Posts: 64
Joined: Mon Jan 28, 2013 2:38 pm
Location: Fi

Re: Transparent planes

Post by mikkis »

Oops somehow I missed that one, now it works right. Thanks.
Post Reply