Page 1 of 1

File format support alpha channel?

Posted: Sun Feb 15, 2015 11:36 am
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);
}
}

Re: File format support alpha channel?

Posted: Sun Feb 15, 2015 12:51 pm
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:

Re: File format support alpha channel?

Posted: Sun Feb 15, 2015 6:58 pm
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:

Re: File format support alpha channel?

Posted: Mon Feb 16, 2015 1:02 am
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.

Re: File format support alpha channel?

Posted: Mon Feb 16, 2015 7:57 am
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.

Re: File format support alpha channel?

Posted: Mon Feb 16, 2015 1:44 pm
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.

Re: File format support alpha channel?

Posted: Tue Feb 17, 2015 12:53 pm
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.

Re: File format support alpha channel?

Posted: Tue Feb 17, 2015 12:58 pm
by CuteAlien
Sorry, I also only know what is supported and what not by trying it out - I didn't write those drivers.

Re: File format support alpha channel?

Posted: Wed Feb 18, 2015 3:16 am
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.