Dalmat
Member
|
2d Image alpha
Hello
Can someone please help with this issue..
We are trying to use imported image and apply it on the fly to a material that we use to override the mesh material.
We can do that easily but the problem is with the alpha channel, we simply cant get it work.
This is the import:
Code:
if (_img.ImportTry(fileName, EE::IMAGE_B8G8R8A8, EE::IMAGE_2D))
{
_mtrl.base_0 = &_img;
_mtrl.validate();
Base::pwMtrl = &_mtrl;
}
Locking the image and than changing the alpha with mulAdd or with alphaFromKey simply doesn't have any effect.. the alpha part of image is allways black..
|
|
04-30-2013 11:12 AM |
|
Esenthel
Administrator
|
RE: 2d Image alpha
Hello,
Please look into 2 things:
mtrl.technique (set some alpha technique, and not default)
if you use 2 textures (base_0 and base_1) then the alpha channel is taken from base_1 (please read comments on Material.base_0,base_1 textures)
|
|
04-30-2013 12:46 PM |
|
miro@3dea
Member
|
RE: 2d Image alpha
- Desired technique for us is MTECH_ALPHA_TEST, but setting it results in no texture at all - object is not visible. Setting other techs (default, blend...) have same result - black background
- we are using only single texture with alpha channel. Texture (image) is assigned to base_0
|
|
04-30-2013 12:56 PM |
|
Esenthel
Administrator
|
RE: 2d Image alpha
Make sure you have mtrl.color.w (alpha) set (try 0.5 or 1.0)
You can also try calling mesh.setShader();
If that won't help please attach sample project to reproduce the issue. Thank you.
|
|
04-30-2013 01:04 PM |
|
miro@3dea
Member
|
RE: 2d Image alpha
Tnx E for help!
After setting alpha to 0.5 +
Code:
mesh.setMaterial(&_mtrl).setShader();
works like a charm..
for others to avoid wasting time like me: I was whole time trying to change alpha on the image it self, not on the material - deeeerp.. doh.. etc..
|
|
04-30-2013 02:13 PM |
|