File format support alpha channel?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
feelthat
Posts: 194
Joined: Sat Feb 02, 2013 5:27 am

File format support alpha channel?

Post by feelthat »

Follows are my code example

dwarf.x alpha channel in win32 OpenGL is Good

but in ios android OGLES-1 not good


{ninja.b3d} can show transparent alpha in OGLES-1 and use MyAlpha to adjust high low

why the {dwarf.x} can not show transparent effect in OGLES-1?

1.
is the file format not support alpha channel for .x in OGLES-1?

2.
what formats support?


///////////////
//mesh = smgr->getMesh( (GetBaseAppPath()+"game/ninja.b3d").c_str() );
mesh = smgr->getMesh( (GetBaseAppPath()+"game/dwarf.x").c_str() );
node = smgr->addAnimatedMeshSceneNode( mesh );


//////////////////////////////texture/////////////////////////////////////////////////
node->setMaterialTexture( 0, driver->getTexture((GetBaseAppPath()+"game/nskinrd.jpg").c_str()) );
node->setMaterialFlag(EMF_LIGHTING, true);
node->setMaterialFlag(EMF_NORMALIZE_NORMALS, true);

u32 MyAlpha = 100;
u32 MaterialCount = node->getMaterialCount();
for(u32 i=0; i<MaterialCount; i++)
{
video::SMaterial& tex_mat = node->getMaterial(i);
tex_mat.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
tex_mat.MaterialTypeParam = 0.1;
tex_mat.MaterialTypeParam2 = 0.1;
tex_mat.AmbientColor.setAlpha(MyAlpha);
tex_mat.DiffuseColor.setAlpha(MyAlpha);
tex_mat.SpecularColor.setAlpha(MyAlpha);
tex_mat.EmissiveColor.setAlpha(MyAlpha);
}

//use it or not by platform
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(MyAlpha,255,255,255);
vertex[j].Color.setAlpha(MyAlpha);
}
}
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: File format support alpha channel?

Post by mongoose7 »

If the X file loader has not been rewritten then, yes, it does not support alpha. The OBJ loader supports a single value of alpha for a material (d < 1) but not an alpha map. I had an argument with CuteAlien about it but just got "oh, well". The alpha map is mapped to EMT_TRANSPARENT_ADD_COLOR and replaces the diffuse texture :shock:
feelthat
Posts: 194
Joined: Sat Feb 02, 2013 5:27 am

Re: File format support alpha channel?

Post by feelthat »

He told me he has a busy game project~~~ so myabe this problem answer oh well

Do you have any idea for .X support alpha channel

any code example?
mongoose7 wrote:If the X file loader has not been rewritten then, yes, it does not support alpha. The OBJ loader supports a single value of alpha for a material (d < 1) but not an alpha map. I had an argument with CuteAlien about it but just got "oh, well". The alpha map is mapped to EMT_TRANSPARENT_ADD_COLOR and replaces the diffuse texture :shock:
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: File format support alpha channel?

Post by mongoose7 »

No, I do not know the X file format. If you do, you can go into the loader, find the relevant section and set the material parameters. But the proper support of transparency requires new shaders. I don't know what shaders are being written for GLES but in "trunk" there is only one, and it doesn't handle transparency.
feelthat
Posts: 194
Joined: Sat Feb 02, 2013 5:27 am

Re: File format support alpha channel?

Post by feelthat »

thanks man

if anyone have idea please let me know
mongoose7 wrote:No, I do not know the X file format. If you do, you can go into the loader, find the relevant section and set the material parameters. But the proper support of transparency requires new shaders. I don't know what shaders are being written for GLES but in "trunk" there is only one, and it doesn't handle transparency.
CuteAlien
Admin
Posts: 9634
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: File format support alpha channel?

Post by CuteAlien »

Guys, if it works with the same code and model on Win32 then this is obviously not a mesh-format problem but a driver problem! The mesh-loaders have no platform specific code.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
feelthat
Posts: 194
Joined: Sat Feb 02, 2013 5:27 am

Re: File format support alpha channel?

Post by feelthat »

in windows .x need use vertex alpha as follow code
but .b3d do not need~~~

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(MyAlpha,255,255,255);
vertex[j].Color.setAlpha(MyAlpha);
}
}


does OGLES1 and OGLES2 support vertex alpha texture?
CuteAlien wrote:Guys, if it works with the same code and model on Win32 then this is obviously not a mesh-format problem but a driver problem! The mesh-loaders have no platform specific code.
CuteAlien
Admin
Posts: 9634
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: File format support alpha channel?

Post by CuteAlien »

Sorry, I also only know what is supported and what not by trying it out - I didn't write those drivers.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
feelthat
Posts: 194
Joined: Sat Feb 02, 2013 5:27 am

Re: File format support alpha channel?

Post by feelthat »

its ok u help a lot for me
CuteAlien wrote:Sorry, I also only know what is supported and what not by trying it out - I didn't write those drivers.
Post Reply