Page 2 of 2

Posted: Fri Oct 22, 2004 8:51 am
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?

Posted: Fri Oct 22, 2004 2:29 pm
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

Posted: Sat Oct 23, 2004 7:21 am
by POi
Any ideas ?

Posted: Wed Oct 27, 2004 5:59 am
by POi
Any news ?

Posted: Wed Oct 27, 2004 6:03 am
by Guest
i think there is no solution.
probably a bug with EMT_TRANSPARENT_ALPHA_CHANNEL ?
i don't no :(

Posted: Thu Sep 28, 2006 8:53 am
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?

Posted: Thu Sep 28, 2006 8:59 am
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.

Posted: Thu Sep 28, 2006 9:39 am
by Magnet
Please, write me code which create in scene 5% transparant box with texture.
I can't set transparency for object.

Posted: Thu Sep 28, 2006 10:48 am
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

Posted: Thu Sep 28, 2006 11:57 am
by Magnet
Hm..
But first parametr is IMesh...possible do this for any ISceneNode or at least for CubeSceneNode

Posted: Thu Sep 28, 2006 12:52 pm
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

Posted: Fri Sep 29, 2006 12:34 pm
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]

Posted: Fri Sep 29, 2006 12:44 pm
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();