Hello! I'm trying to draw textures with transparency.
I already tried to set BlendOperation to BlendOperation.Add for the material. The problem is that black borders appear.
So I would like to use textures with premultiplied alpha, drawing them using the following blend mode:
blend(source, dest) = (source.rgb * source.a) + (dest.rgb * (1 – source.a))
The problem is that I don't know how to configure this blend mode in Irrlicht. Please help!
Note: I'm currently using the Irrlicht Lime .NET wrapper.
Thank in advance!
Blend mode
Re: Blend mode
Premultiplied - so your texture are not having alpha anymore but using black for clipped out areas already?
That would need EMT_TRANSPARENT_ADD_COLOR as materialType, but that doesn't fit with your formula.
Your formula looks more like what you get for EMT_TRANSPARENT_ALPHA_CHANNEL which directly uses the alpha-channel of the texture.
It's also possible to set custom formulas with EMT_ONETEXTURE_BLEND, but that one changed a bit between version 1.8 and svn trunk and I also have to figure it out myself each time (bit tricky stuff...).
That would need EMT_TRANSPARENT_ADD_COLOR as materialType, but that doesn't fit with your formula.
Your formula looks more like what you get for EMT_TRANSPARENT_ALPHA_CHANNEL which directly uses the alpha-channel of the texture.
It's also possible to set custom formulas with EMT_ONETEXTURE_BLEND, but that one changed a bit between version 1.8 and svn trunk and I also have to figure it out myself each time (bit tricky stuff...).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm