Overlay texture in Material

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
fanaticguy
Posts: 9
Joined: Sat Feb 18, 2017 3:51 pm

Overlay texture in Material

Post by fanaticguy »

Basically, what i want to do is render one texture with alpha channel over another in the same Material something like on the snippet below. But in that case i have my overlay texture displayed with black color in places where there should be transparent. So i added buffer_side->Material.MaterialType = EMT_TRANSPARENT_ALPHA_CHANNEL. This allows me to display my overlay texture with correct transparency but there is no texture under this one. How can I achieve such effect where overlay texture have transparent places and there is another visible texture under it?

Code: Select all

    buffer_side->Material.setTexture(1, texture_side);
    if(texture_side_overlay) {
        buffer_side->Material.setTexture(0, texture_side_overlay);
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Overlay texture in Material

Post by CuteAlien »

Lightmap materials are probably the closest to what you want. If that's not enough you will need to create your own material (usually with a shader).
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
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Overlay texture in Material

Post by Mel »

In irrlicht, this is most suited for a shader. You need to read tex0 and tex1 and then, add them like this: tex0.rgb*(1-tex1.a) + tex1.rgb*tex1.a, where tex0 is your base texture and tex1 your overlay
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Post Reply