Blend Out Color

Member
Posts: 241
Joined: 2008.07
Post: #1
Is there a way to specify a certain color to alpha out?

For example, if I have a sprite sheet and the background color is pink, how do I draw a section of that sprite sheet so that the pink does not appear when it draws but other objects that may be behind that object will be visible where the pink would have been?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #2
You'll have to convert the pink color key to an alpha channel. OpenGL does not support color keying. Probably easier not to do this at load time. Most image editing programs have tools to help you do this.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 241
Joined: 2008.07
Post: #3
That's pretty much what I am gathering from my research. Basically, the best thing is to have an alpha channel as the background. If I don't have alpha as the background, I'll have to manually compare the bits in the image to the key color and set them to black alpha if they match. Am I correct?
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #4
That's one way to do it, but is there any reason you can't put a proper alpha channel in the image in the first place?
Quote this message in a reply
Member
Posts: 241
Joined: 2008.07
Post: #5
Yes, it is always possible that I can't get a proper alpha channel in the image in the first place. I'm not an artist, I'm a programmer and sometimes I may not have the luxury of an artist to make it a certain way. Knowing how to do it is what I need. Rasp
Quote this message in a reply
Moderator
Posts: 522
Joined: 2002.04
Post: #6
I'd recommend writing a small tool to convert the graphics for your game, then. Easy peazy.

Cheers,
-Jon
Quote this message in a reply
Member
Posts: 241
Joined: 2008.07
Post: #7
Yeah, I just put a for loop in the texture loading that could optionally alpha out the passed in color. Lemon squeezy.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  ? Find color value of 'pixel' in color buffer? Elphaba 1 4,498 Jul 22, 2009 01:23 PM
Last Post: Bachus