Hi all!
I'm having an issue with a transparent tga textures on a table:
Please look at the following. The table should be glass, but only half of the table legs are visible (see left image) , but if you go beneath it, all are visible. (see right image)
Any ideas?
Thanks in advance.
TGA and OBJ transparency problem
I tried setting SMaterial::MaterialTypeParam to 0, 0.5, 0.75, etc.hybrid wrote:Does this effect change if you use more or less transparency? Maybe try 0.75, 0.25 and 0.0 opacity.
The effect is still the same. Once i go over 0.52 the transparent material is completely gone! And below that value it just looks like it does now.
Other things i've tried:
- Changing the resolution of the texture (it is now 256*256 mapped onto it using UWV mapping)
- Changing the legs of the table
- flipping the normals
Nothing helps.
Does anyone have any other ideas?
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Ok, OBJ loader has no support for alpha channel transparency which is the type of transparency I would have expected here. So first of all I'd need to know which type of transprency you chose for your mesh in the modeller.
There are several types available in Irrlicht, this has to be adapted to the obj format. Currently supported are ADD_COLOR and VERTEX_ALPHA (which both don't use the ref parameter, though).
So in addition to the type you've set I'd also need the .obj file to see which format flag is used.
There are several types available in Irrlicht, this has to be adapted to the obj format. Currently supported are ADD_COLOR and VERTEX_ALPHA (which both don't use the ref parameter, though).
So in addition to the type you've set I'd also need the .obj file to see which format flag is used.
http://www.nimation.nl/yoran/table.ziphybrid wrote:Ok, OBJ loader has no support for alpha channel transparency which is the type of transparency I would have expected here. So first of all I'd need to know which type of transprency you chose for your mesh in the modeller.
There are several types available in Irrlicht, this has to be adapted to the obj format. Currently supported are ADD_COLOR and VERTEX_ALPHA (which both don't use the ref parameter, though).
So in addition to the type you've set I'd also need the .obj file to see which format flag is used.
Here you'll find the texture and the OBJ.
I switched from 3DS to OBJ because of bugs, and now OBJ seems to be lacking some things as well
First note: I tried loading this model in other 3d modellers and they have the same problem the irrlicht engine has, so it is probably an error in the model itself and nothing to do with irrlicht.
Anyway I have 1 mesh.
The mesh is UWV mapped using 3D Studio Max. The TGA contains an alpha channel. So certain parts, the top of the table will become translucent.
Here is a code snippet:
Anyway I have 1 mesh.
The mesh is UWV mapped using 3D Studio Max. The TGA contains an alpha channel. So certain parts, the top of the table will become translucent.
Here is a code snippet:
Code: Select all
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
driver->setTextureCreationFlag(video::ETCF_OPTIMIZED_FOR_QUALITY,true);
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true);
scene::IAnimatedMesh* mesh = smgr->getMesh(THE_TABLE_MODEL);
scene::ISceneNode* n = smgr->addOctTreeSceneNode(mesh,rootNode,FURNITURE_NODE, 1024);
n->setMaterialFlag(video::EMF_GOURAUD_SHADING, true);
n->setMaterialFlag(video::EMF_ANISOTROPIC_FILTER, true);
n->getMaterial(0).Shininess = 50.0f;
n->getMaterial(0).EmissiveColor.set(0,200,200,200);
n->getMaterial(0).DiffuseColor.set(0,200,200,200);
n->getMaterial(0).AmbientColor.set(0,200,200,200);
n->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
n->setMaterialTexture(0, 0);
n->setMaterialTexture(0, driver->getTexture( THE_TEXTURE_CONTAINING_THE_ALPHA_CHANNEL );