I hope to change my simple mesh(just sphere)'s opacity value...
I mean... alpha blending...
I think I have to change material's color with alpha value...
But, I can't find how I can change material...
I need your help...
I'm just beginner... please... I love you and thank you guys...
I can't find how I can change the mesh's material...
-
hybrid
- Admin
- Posts: 14144
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Depends on the material type you use. For ALPHA_CHANNEL you have to provide a texture with alpha channel, for VERTEX_ALPHA you need to alter the alpha value of the vertices. Check the mesh manipulator for vertex color methods. The diffuse color of the material could also help, but in the current SDK it's not supported on every platform.
But... It doesn't work again...
Thank you, hybrid!
But, I think I don't understand you well...
You mean... like this?
u32 Alpha = 50;
m_pNode->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
m_pFX->GetVideoDriver()->getMeshManipulator()->setVertexColorAlpha(m_pMesh, Alpha);
or...
m_pFX->GetVideoDriver()->getMeshManipulator()->setVertexColors(m_pMesh, video::SColor(Alpha , 255, 0, 0));
But, both works anyting....
Thank you so much... but... I think I need your help little more...
But, I think I don't understand you well...
You mean... like this?
u32 Alpha = 50;
m_pNode->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
m_pFX->GetVideoDriver()->getMeshManipulator()->setVertexColorAlpha(m_pMesh, Alpha);
or...
m_pFX->GetVideoDriver()->getMeshManipulator()->setVertexColors(m_pMesh, video::SColor(Alpha , 255, 0, 0));
But, both works anyting....
Thank you so much... but... I think I need your help little more...
Last edited by bckong on Fri May 15, 2009 3:14 pm, edited 2 times in total.
-
hybrid
- Admin
- Posts: 14144
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
For the 1.5 SDK you *must* use Direct3D for this effect on untextured models. However, you can simply use a white texture (or whatever color you want) and still use VERTEX_ALPHA. Your code looks fine, it should work. If you want to keep working with untextured models you should switch over to the latest SVN/trunk version of IRrlicht (upcoming Irrlicht 1.6) in order to use proper COLOR_MATERIAL property. Should work out-of-the-box with that version.
It works....!!!
Wow... It works...!
m_pMesh was NULL... Sorry...
Thank you very much hybrid!
And also thank you for reading my strange English
m_pMesh was NULL... Sorry...
Thank you very much hybrid!
And also thank you for reading my strange English