Jump to content
  • Advertisement
Sign in to follow this  
Sentralia

Mist around sprites!

This topic is 4490 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
I thought colorkeying was the only way for transparency, I did'nt know I could use the built in transparency on paint programs. So colorkeying is outdated I guess...It's one less thing for me to worry about now!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!