Ogre::MaterialPtr meterialPtr=Ogre::MaterialManager::getSingleton().getByName(meterialName);
    Ogre::Pass *pass=meterialPtr->getTechnique(0)->getPass(0);
    if (pass)
    {
        pass->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
        pass->setDepthWriteEnabled(false);
        /*pass->setDepthCheckEnabled(false);*/
        pass->setDiffuse(1.0,1.0,1.0,(float)nAlpha/255);
        //pass->getTextureUnitState(0)->setAlphaOperation(Ogre::LBX_MODULATE, Ogre::LBS_TEXTURE, Ogre::LBS_MANUAL,1.0, (float)nAlpha/255);
    }

 

或者直接在材质文件里面配置

material 123
{
technique
{
pass
{
ambient 0.588 0.588 0.588 1
diffuse 1.0 1.0 1.0 0.15//修改alpha就可
specular 0.045 0.045 0.045 1 10
scene_blend alpha_blend
depth_write off
texture_unit
{
texture 123.bmp
}
}
}
}

 

posted on 2012-03-28 19:35  jackdesk  阅读(2071)  评论(0编辑  收藏  举报