Page 1 of 1

Problem with alpha texture

Posted: Mon Sep 27, 2010 9:52 am
by sylpheed
I have a problem using a texture with alpha channel. If I use

Code: Select all

material.MaterialType = EMT_TRANSPARENT_ALPHA_CHANNEL;
then my mesh looks like this:

Image

You can see that background is shown in mesh edges. If I use

Code: Select all

material.MaterialType = EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
Then background is not shown in mesh edges, but I only get two levels of alpha value, so results are not smooth:

Image

I've tried with irr_material.MaterialTypeParam in first method, but can't get a decent results. Is there any way to get the mesh looking cool?

Thanks in advance

Posted: Mon Sep 27, 2010 11:02 am
by hybrid
Setting the MaterialTypeParam to something like 0.01f should do the job. What does it look like?

Posted: Mon Sep 27, 2010 11:18 am
by sylpheed
It looks like this:

Image

Almost the same with MaterialTypeParam = 1.0. I would use shaders to fix this, but I'm using Irrlicht materials for whole scene, so I would have to implement a shader per object in the scene (lighting issues).

Posted: Mon Sep 27, 2010 11:23 am
by hybrid
Do you render the head with an alpha material as well? It looks like the browes are rendered first, and blended with the background. Only then the head is rendered. You need to either switch the head's materials, or change the render order (probably by rendering the browes in a second scene manager).

Posted: Mon Sep 27, 2010 12:14 pm
by sylpheed
hybrid wrote:Do you render the head with an alpha material as well? It looks like the browes are rendered first, and blended with the background. Only then the head is rendered. You need to either switch the head's materials, or change the render order (probably by rendering the browes in a second scene manager).
That's it! Now it renders fine. Sorry, it's my fault, I supposed Irrlicht would render mesh with no alpha first and then meshes with alpha, but I guess Irrlicht just order whole nodes.

Thanks for your help.

Posted: Mon Sep 27, 2010 1:57 pm
by hybrid
No, solid meshes come first. That's why I assumed that the head also uses transparent materiuals (even if the transparency has no effect). I guess we could use a certain dependency marker in the scene node graph somehow. Well, other topic :wink: