[Performance] Magenta background as transparent

0 favourites
  • 13 posts
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • I'm just wondering, I've seen old sprites from classic games, they used Magenta as registered color to make transparent background in runtime, do sprites with magenta background as transparent improve the performance and reduce memory usage?

  • As far as I know, classic games on classic consoles were a combination of different pixel with color related to the palette, so it wasn t "magenta as background" in the end, however, magenta I think is a color that is rarely used directly, and I think some program cannot use direct transparency (bitmap with no transparancy only allowed by default, png with no transparency is fine too for them too sometimes), so it is more conventionnal to use this least used color as transparency, maybe it is also easier to extract sprite with this color too

  • Old systems did not support alpha channels in images, so they would make a special color (often magenta) that would not render, so would appear transparent. These days it is completely redundant, because PNG has full alpha channel support so the image itself can contain varying levels of transparency.

  • Aphrodite Thanks for the info, but I'm interesed to know about the performance and memory usage for using color manipulation.

    Ashley I already know that why you didn't answer my question about performance and memory usage. Can you?

    Not only for transperency, this method is used to make house colors. (RTS games have team color like red, blue, etc. more like team color)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I don't think it has any important effect on performance or memory use.

  • Ashley Hmmm... It makes me to think about PNG files without big transparency background would not cause performance drop.

  • Ashley Hmmm... It makes me to think about PNG files without big transparency background would not cause performance drop.

    Then don't use PNGs with large areas of transparency. You wouldn't do that if you were keying out any color (there's no reason it has to be magenta), either.

    As Ashley said, it's not a performance issue. Technology has come a long way since there was any real need to key out a specific color for transparency. Your phone is probably 10000x as fast as the computers that were around when that was a thing.

  • All images are decompressed in to memory as 32-bit ARGB and the alpha channel is always processed regardless of whether it's fully opaque or fully transparent. Alpha has no effect on performance.

  • Disclaimer:I'm not sure I know enough about this subject to express myself so maybe I am wrong this time.

    First of all, the problem with big backgrounds is that they take memory, even with transparency, reason?

    a stored picture is a group of informations about color (and alpha too), by using such an image you are telling the memory to store it entirely, even the informations that says "there are nothing here", I am not sure if all material will act like that in that case, some may filter first.

    And then there is the concept of drawing, I'm pretty confident that the graphical rendering part of actual devices is set to skip drawing an alpha of 0 the same way other devices did with a referenced color.

    I think the only difference is that rather than choose yourself one color (like for exemple Worms Armageddon, plain Black was transparent at rendering), here the color is already choose (everything that has 0 opacity color wise)

    Then there is also the fact that a sprite set to a transparency of 0 will still be drawn at screen some will say, but I think this is for other reasons

    As I said I could be wrong.

  • Aphrodite Thanks for the info, but I'm interesed to know about the performance and memory usage for using color manipulation.

    Are you not asking about it for old technique clarification and more for changing colors on sprites with the Replace Color effect you can add to an object?

    With the SC Sprites you can do the same with Replace Color in C2, but I've always wondered what kind of performance hit would take to do that.

  • Aphrodite It makes sense, also I was confident about skipping to render alpha of 0, too bad it does draw alpha of 0.

    Thndr Yes, I forgot about Replace color effect as webGL effect, it would work for team color. Current replace color effect doesn't have alpha option. There a difference between WebGL renderer and WebGL effects, actually the effects may cause performance drop.

  • Old games mostly did use the actual color palette of the computer(fullscreen only games were fullscreen for that reason I think), by changing it, and so they just did "do not render color #0" for exemple, that applied everywhere.

    Now the Webgl effect does not work like that, it ll check every pixel of the image, and change some of them, which can be intensive.

    At the end transparent is an information, like magenta was, the only difference being that, since nothing renders it, it appears transparent in every image editor (however it is line the magenta, still an information existing, and so will be stored in memory)

  • Aphrodite Oh I see, it does store information in memory, anyway alpha option for Replace color would be useful in some cases.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)