material type EMT_TRANSPARENT_VERTEX_ALPHA not working?

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

material type EMT_TRANSPARENT_VERTEX_ALPHA not working?

Post by arras »

Firsth, I am using Dev-C++ and OpenGL. I was not triing it with DirectX since I do not have it compiled to Irrlicht.dll.

From Irrlicht Engine 1.3 API documentation:
EMT_TRANSPARENT_VERTEX_ALPHA Makes the material transparent based on the vertex alpha value.
My problem is that when seting material of scene node to EMT_TRANSPARENT_VERTEX_ALPHA and vertex color alpha value to 0 I expect my scene node to disapear. However when lighting is on (by default) there is no change to node appearance. It is solid as before. If I turn lighting off then node appear transparent only partly, even if vertex alpha is 0 which I expect to cause node to disappear completly.

Here is code I use to set node:

Code: Select all

    scene::IAnimatedMesh* testmesh = smgr->getMesh("Media/test.3ds");
    scene::IAnimatedMeshSceneNode* test = smgr->addAnimatedMeshSceneNode( testmesh );
    //test->setMaterialFlag(video::EMF_LIGHTING, false);

    test->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
    
    scene::IMesh* mesh = test->getMesh()->getMesh(0);
    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(0,255,255,255);
        }
    }
Does somebody have this material working?

[Edit:] I have found out that setting vertex color to (0,0,0,0) make node disappear completly (which is not what API reads but OK) however only if I turn lighting off. If lighting is on this material doesnt work at all ...or did I missunderstand something?
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

I did some testing an if there is not something wrong with my hardware I think there is definetly something wrong with EMT_TRANSPARENT_VERTEX_ALPHA material type.

I went for 08.SpecialFX example since EMT_TRANSPARENT_VERTEX_ALPHA is used there on particles:

Code: Select all

ps->setMaterialFlag(video::EMF_LIGHTING, false);
ps->setMaterialTexture(0, driver->getTexture("../../media/fire.bmp"));
ps->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
And here are results:
Image
1. picture: shows demo without changes ...everything seems to be OK.

2. picture: I removed room.3ds so there is nothing on particles background. When light affects particles from certain angles something goes wrong with them.

3. picture: I let ewerything as it is just change lighting for particles to true ...and EMT_TRANSPARENT_VERTEX_ALPHA failed to work at all.

I think this is enought to post it in Bug reports room but before I want to be sure It is not my hardware which is causing trouble. Could be somebody so kind and compile 08.SpecialFX example with line 189:

Code: Select all

ps->setMaterialFlag(video::EMF_LIGHTING, false);
changed to:

Code: Select all

ps->setMaterialFlag(video::EMF_LIGHTING, true);
Thanks.
Last edited by arras on Sat Mar 24, 2007 1:23 am, edited 3 times in total.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Happens with 1.2 when using the OpenGL driver. Doesn't happen with any of the other drivers.

Travis
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Changing line 133 won't make a difference, but i think you did mean line 189 and with that i get the same result as in the right image.

I tested it with 1.2 and 1.3 with opengl/linux.
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Right, I was refering to code I was modifiing when testing it. Excuse me. Misstake corrected, its line 189 not 133. Thanks CuteAlien.

vitek >> thanks for testing. What about 1.3? Does it run correctly to you?
Dorth
Posts: 931
Joined: Sat May 26, 2007 11:03 pm

Post by Dorth »

This problem is still present in 1.3.1 and rather a nuisance.

I'm also rying to work out a test case to submit another bug in the material that have the Zbuffer completelly out of order or nearly. Since I want only part of my scene node to be transparent, this causes may headaches.
Elmaron
Posts: 27
Joined: Sat Jan 10, 2009 7:22 pm

Post by Elmaron »

This report was more than a year (nearly two years?) ago. And the bug still seems to be present??

I have exactly the same problem, as soon as I turn lighting on, all transparency on my EMT_TRANSPARENT_VERTEX_ALPHA triangles is gone! (OpenGL device on Linux with Irrlicht SDK 1.5)
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

It probably just sank in this forum because nobody put a bug report on the tracker.
So the transparent vertex alpha renderer is actually the same as transparent add colour, and turning lighting on colours the vertices and causes it to become visible? I can't believe more people haven't had problems with this before :roll:

Edit: yes it does look like it's exactly the same as EMT_TRANSPARENT_ADD_COLOR. In both direct3d and opengl

Edit 2: Okay I'm talking rubbish.. The test case in the bug report shows that transparent vertex alpha works, but not with lighting enabled.
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
pera
Posts: 460
Joined: Wed May 14, 2008 1:05 pm
Location: Novi Sad, Serbia
Contact:

Post by pera »

This issue seems to be present in irrlicht 1.5, directX, I can not set model to be more or less transparent, its always the same no matter what vertex alpha value is.
Darktib
Posts: 167
Joined: Sun Mar 23, 2008 8:25 pm
Location: France

Post by Darktib »

I have the bug too, in both OGL and DX. Irrlicht 1.6 SVN (revision ~2500).
Post Reply