If SDL displays .png's with alpha transparency, do you need to bother with color keying? Or is color keying more efficient than displaying a .png with transparency?
SDL and Color Keying
Page 1 of 15 Replies - 528 Views - Last Post: 02 October 2012 - 02:45 AM
Replies To: SDL and Color Keying
#2
Re: SDL and Color Keying
Posted 26 September 2012 - 09:48 AM
Well, this is an art question really. Secondly you need to know the specifics of how your graphics engine supports .png files in terms of the type and magnitude of the effects you wish to create.
#3
Re: SDL and Color Keying
Posted 26 September 2012 - 01:34 PM
I guess there are a few things to consider here, one is that .png transparency will probably look nicer but the file sizes will be slightly bigger due to the alpha channel. Colour-keying is also a little faster due to it just completely skipping a certain colour and not even sending it to the back buffer. With that said though, the difference will be extremely negligible when developing on a modern PC unless your game is ridiculously graphics intensive with loads of different game objects flying around the place.
You don't go into any detail about what type of game you're developing or anything. What kind of experience do you have? have you developed any games before?
If you're really serious about getting the best performance then you will have to run these tests yourself. You never know, it might be a fun learning experience.
You don't go into any detail about what type of game you're developing or anything. What kind of experience do you have? have you developed any games before?
If you're really serious about getting the best performance then you will have to run these tests yourself. You never know, it might be a fun learning experience.
#4
Re: SDL and Color Keying
Posted 27 September 2012 - 08:19 AM
No, it's not an art question. It's a programming question.
Ok - so the answer is, "Color Keying is faster".
I'm just now getting into SDL. I want to be able to display as many sprites as I would ever want on screen at any given time. I just noticed that displaying transparent .png images used a different function and figured there had to be a performance difference.
I'm not working on any specific game right now, just learning to manipulate images and surfaces and pocketing things away in my own functions and classes. I thought it would be fun to start with something like a Galaxian clone and learn how to make neat looking visual effects that classic arcade techniques used.
So, this is good information. Normally, I would want to use color keying, but I can always use .png alpha transparency for cool effects like glass or other transparent effects. Meh, I dunno. If I'm replicating the same image over and over again, like lasers or whatever, it may not matter I suppose.
Ok - so the answer is, "Color Keying is faster".
I'm just now getting into SDL. I want to be able to display as many sprites as I would ever want on screen at any given time. I just noticed that displaying transparent .png images used a different function and figured there had to be a performance difference.
I'm not working on any specific game right now, just learning to manipulate images and surfaces and pocketing things away in my own functions and classes. I thought it would be fun to start with something like a Galaxian clone and learn how to make neat looking visual effects that classic arcade techniques used.
So, this is good information. Normally, I would want to use color keying, but I can always use .png alpha transparency for cool effects like glass or other transparent effects. Meh, I dunno. If I'm replicating the same image over and over again, like lasers or whatever, it may not matter I suppose.
#5
Re: SDL and Color Keying
Posted 28 September 2012 - 01:25 AM
#6
Re: SDL and Color Keying
Posted 02 October 2012 - 02:45 AM
Colour keying would generally be slightly faster, being that all it has to do is check if the pixel is (X) colour, and if so, don't bother copying it onto the viewport.
Alpha blending is a little bit slower, as it involves actually calculating the end-colour, but allows for "partial transparency" which is useful for effects etc. (like you mentioned glass and such).
Alpha cutout, however, is almost identical to colour keying, except that you don't limit yourself to not using a particular colour (which can be useful when using very small colour pallets with an ARGB format.)
Usually, though, it's common practice to just use alpha blending, unless you have a particular reason not to.
Alpha blending is a little bit slower, as it involves actually calculating the end-colour, but allows for "partial transparency" which is useful for effects etc. (like you mentioned glass and such).
Alpha cutout, however, is almost identical to colour keying, except that you don't limit yourself to not using a particular colour (which can be useful when using very small colour pallets with an ARGB format.)
Usually, though, it's common practice to just use alpha blending, unless you have a particular reason not to.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote







|