Ive been trying to setup a alpha mesh using EMT_TRANSPARENT_ADD_COLOR and EMT_TRANSPARENT_VERTEX_ALPHA which looks great from 1 place. but if i move the camera closer to 0,0,0 the alpha channel changes.
if i set my alpha to 0 it still has the same effect but the node goes black.
here is how im setting up the alpha
Code: Select all
MyAlpha = 0.5;
int IntAlpha = (int)(MyAlpha*255);
int swpAlpha = IntAlpha-255;
int MaterialCount = node->getMaterialCount();
for(int i=0; i<MaterialCount; i++)
{
video::SMaterial &mat = node->getMaterial(i);
mat.MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;//video::EMT_TRANSPARENT_ADD_COLOR;
mat.Lighting = false;
mat.DiffuseColor.setAlpha(IntAlpha);
mat.AmbientColor.setAlpha(IntAlpha);
}
Anode = (scene::IAnimatedMeshSceneNode*)node;
Amesh = Anode->getMesh();
for(u32 i=0; i<Amesh->getMeshBufferCount(); i++)
{
scene::IMeshBuffer* buffer = Amesh->getMeshBuffer(i);
video::S3DVertex* vertex = (video::S3DVertex*)buffer->getVertices();
for(u32 j=0; j<buffer->getVertexCount(); j++)
{
vertex[j].Color = video::SColor(IntAlpha,IntAlpha,IntAlpha,IntAlpha);
}
}