Probleme with 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.
Thulsa Doom
Posts: 63
Joined: Thu Aug 05, 2004 9:40 am
Location: Germany

Post by Thulsa Doom »

Anonymous wrote:Not much luck ... if i set a grey texture (R 128 G 128 B 128) then i get a better result but not ok. And if an object gets in front of the "transparent" mesh it also gets transparent.

With the opengl driver the effect is much better but it stays at 50% transparent no matter what the alpha value is.
Have not observed that. Is the object in front totally transparent or only partially in overlapping areas?
POi

Post by POi »

Here is a little example ... i have enabled the vertex color alpha (due to hireacial objects in .x file not all objects even get affected with the alpha value but thats another issue) and the render order seems all messed up. Anyway on the right you se a small round object and on the left i have rotated the view a bit so it gets in front of the rest of the mesh and it dissapears (probably renders behind), The same thing happens if i have a water plane running in the middle of the mesh. When vertex col. aplha is set then the waterplane always renders in front of the mesh.

Image

//POi
POi

Post by POi »

Any ideas ?
POi

Post by POi »

Any news ?
Guest

Post by Guest »

i think there is no solution.
probably a bug with EMT_TRANSPARENT_ALPHA_CHANNEL ?
i don't no :(
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post by Magnet »

I seem that transparency is does not work.
I not even can create box with 20% transparency.

Code: Select all

C#:

            ITexture texWall = device.VideoDriver.GetTexture(@"..\..\media\wall.bmp");
            ISceneNode node = device.SceneManager.AddCubeSceneNode(15,
                   null, -1, new Vector3D(30, -15, 0));
            Material mat = new Material();
            mat.Lighting = false;
            mat.BackfaceCulling = false;
            mat.Texture1 = texWall;
            mat.Type = MaterialType.TRANSPARENT_ADD_COLOR;
            mat.EmissiveColor.Alpha = 10;
            mat.DiffuseColor.Alpha = 10;
            mat.AmbientColor.Alpha = 10;
            mat.SpecularColor.Alpha = 10;            
            node.SetMaterial(0, mat);
This box is 50% transparent. How to set 5% transparent for example?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Please don't cross post your questions all over, and only raise such old threads if this is really useful!
TRANSPARENT_ADD_COLOR takes the texel color and makes the texel transparent based on the color value (thus black becomes completely transparent, while white is completely opaque). You can also use vertex color alpha and texture alpha channel for the transparency by choosing the correct material. I don't know about light alpha settings to do anything useful.
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post by Magnet »

Please, write me code which create in scene 5% transparant box with texture.
I can't set transparency for object.
Xaron
Posts: 310
Joined: Sun Oct 16, 2005 7:39 am
Location: Germany
Contact:

Post by Xaron »

Code: Select all

smgr->getMeshManipulator()->setVertexColors( mesh, video::SColor( color, color, color, color ) );
This does work if I use EMT_TRANSPARENT_ADD_COLOR as material.

But it would be useful to have a real transparency for any scene node to fade things... ;)

Regards - Xaron
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post by Magnet »

Hm..
But first parametr is IMesh...possible do this for any ISceneNode or at least for CubeSceneNode
Xaron
Posts: 310
Joined: Sun Oct 16, 2005 7:39 am
Location: Germany
Contact:

Post by Xaron »

Magnet wrote:Hm..
But first parametr is IMesh...possible do this for any ISceneNode or at least for CubeSceneNode
This won't work as this is not yet implemented. There is no way to fade out or set an alpha for a complete scene node.

Regards - Xaron
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post by Magnet »

I am create new code:
This code build full scene:

Code: Select all

IMesh * mesh=smgr->getMesh("../storage/AquaBox/AquqBox.x")->getMesh(0);
smgr->getMeshManipulator()->setVertexColors( mesh, video::SColor( 25, 255, 255, 255 ) ); 
ISceneNode *Aqua = smgr->addMeshSceneNode(mesh);
Aqua->setMaterialFlag(EMF_LIGHTING, false);	
Aqua->setAutomaticCulling(false);
Aqua->setMaterialFlag(EMF_BACK_FACE_CULLING, false);
smgr->addCameraSceneNodeMaya();
But my model is not transparent :-(
Please fix this code.[/code]
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post by Magnet »

Many thanks!!!!
I am not set material type to EMT_TRANSPARENT_VERTEX_ALPHA
My object is transparent by this code:

Code: Select all

	IMesh * mesh=smgr->getMesh("../storage/AquaBox/AquqBox.x")->getMesh(0);
	smgr->getMeshManipulator()->setVertexColors( mesh, video::SColor( 100, 100, 100, 100 ) ); 
	ISceneNode *Aqua = smgr->addMeshSceneNode(mesh);
	Aqua->setMaterialFlag(EMF_LIGHTING, false);	
	Aqua->setAutomaticCulling(false);
	Aqua->setMaterialFlag(EMF_BACK_FACE_CULLING, false);
	Aqua->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA  );
	smgr->addCameraSceneNodeMaya();
Post Reply