The isometric sprites are rendered as images mapped onto basic 3D primitives, drawn in back-to-front order. The sprites are rendered from Blender using anti-aliasing, and pre-multiplied alpha. The blending function used is glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA). The Irrlicht analog for this blend mode, of course, seems to be pack_texureBlendFunc(irr::video::EBF_ONE, irr::video::EBF_ONE_MINUS_SRC_ALPHA). The problem is that it doesn't seem to work properly. Here is a shot of the existing engine:
Look at the rock sprites in the top of the screen. Now, here is a shot of the same sprites rendered using Irrlicht:
You can see that the alpha edges are not being properly blended. The alpha channel is pre-multiplied with the color channel in Blender's output, and wherever the alpha is fully opaque or fully transparent it operates as expected, but the partial alpha pixels are not being correctly handled. Aside from using the above packed texture blending function, here is the gist of how the material is set up:
Code: Select all
material.Lighting=false;
material.Wireframe=false;
//material.MaterialType=irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL;
material.MaterialType = irr::video::EMT_ONETEXTURE_BLEND;
material.MaterialTypeParam = irr::video::pack_texureBlendFunc(irr::video::EBF_ONE, irr::video::EBF_ONE_MINUS_SRC_ALPHA);
material.setTexture(0, texture_);
driver->setMaterial(material);