Color key ignore alpha

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
n00bc0de
Posts: 125
Joined: Tue Oct 04, 2022 1:21 am

Color key ignore alpha

Post by n00bc0de »

I am color keying textures in my tilemap editor. I have a texture that has a transparent background ( rgba value of (0,0,0,0) ). But Some of the tiles use solid black ( rgba value of (0,0,0,255) ). When I try to color key with color value of 0 it also color keys the black values with alpha 255. Is it possible to color key with the alpha values or does it only use RGB?
CuteAlien
Admin
Posts: 9969
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Color key ignore alpha

Post by CuteAlien »

If you talk about makeColorKeyTexture - it ignores alpha's. Guess easiest solution is to copy the function (CNullDriver::makeColorKeyTexture) and then replace the if checks with refZeroAlpha by checks against the exact colors (for ECF_A1R5G5B5 you still have to convert color first I think).
edit: I've updated the documentation
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
n00bc0de
Posts: 125
Joined: Tue Oct 04, 2022 1:21 am

Re: Color key ignore alpha

Post by n00bc0de »

Thanks. I decided to just modify the tile sheet to remove all solid black from it. In Aseprite, there is an option called "Replace Color" that allows you to replace all instances of a color with a different color. I just made increased all the solid black with RGB(5,5,5). It worked like a charm.
Post Reply