Mist around sprites!
I am making a Breakout clone in SDL with C++, in Windows. I made some sprites for the game (paddle, ball, background). I put the paddle and ball on a magenta background (R255,G0,B255), for transparency when it is loaded into the game. When I went to test the game there was a magenta "mist" around my sprites. I assumed it was the anti-aliasing in Photoshop, so I re-detailed the sprite by zooming in and using the magenta color to erase the blurry pixels. This worked, and there was no "mist" around the sprites. However, the sprites looked crappy due to the lack of AA. So how can my sprites become AA in SDL?
What you're running into here is a problem that results from only having a boolean "alpha channel". Since you only have one color that is transparent, you can't have partially-transparent pixels, which means that you can't fade out your sprites. If you have a consistently-colored background, you can fade out to that color instead of to magenta, but otherwise I suspect your only feasible option is to switch to an image format (e.g. PNG) that has a range of transparency levels and to use "real" transparency in the image instead of telling SDL to treat a single color as trasparent.
Aye, SIR! That was quite simple. All I did was set the background to transparent in Photoshop, and now it works perfectly! But is there a way to get my colorkeys to work, without having that "mist" around the sprite?
You can create a sprite with variable levels of alpha if you use a format like PNG and load it via SDL_image.
Colourkeys don't support multiple levels of alpha.
Colourkeys don't support multiple levels of alpha.
Quote:But is there a way to get my colorkeys to work, without having that "mist" around the sprite?
Nope. The way colorkeys work there is no (logical) way to make them work.
Here is the mist I was talking about:http://img474.imageshack.us/img474/8297/test8eb.png
I don't have any pictures of the project, since I was just testing some stuff for now. So...What your saying is that colorkeying is not worth my time? I'll have to stick with using the transparent background in Photoshop, correct?
I don't have any pictures of the project, since I was just testing some stuff for now. So...What your saying is that colorkeying is not worth my time? I'll have to stick with using the transparent background in Photoshop, correct?
Colorkeying is strictly less capable than true transparency, as you can only have "on" and "off" transparency. In contrast, real transparency can allow light to filter through an image, showing what is behind the image with some of the image's color. Plus, true transparency is easier to make, since PNG files are simple beasts.
Why do you want to use color keys, anyway?
Why do you want to use color keys, anyway?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement