Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

AcidInjury

Colorkeying without alpha-channel

This topic is 5676 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''m trying to get my tiles to render using a colorkey for transparency, based off the RGB bytes. I realize I could set the alpha value as I load in the images by checking the value of the R, G, and B bytes but I don''t want to do it like this (unless I have to). Anyone know of an OGL function that allows you to set a colorkey? thanks, Will

Share this post


Link to post
Share on other sites
Advertisement
There is absolutely no way of setting a colorkey in OpenGL.The way OpenGL do this is using alpha testing or masking.I recommend the alpha testing cause when you use masks you can''t perform depth testing!!!

The PAIN is coming...this summer!!!In cinemas everywhere.

Share this post


Link to post
Share on other sites
>>I realize I could set the alpha value as I load in the images by checking the value of the R, G, and B bytes but I don''t want to do it like this (unless I have to).<<

that is the only ''easy + quick'' way

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites
Well, if you want to go total overkill, there is another way by using pixelshaders. You''ll need to setup the pipeline, so that you produce an alpha value based on the differential comparison between you RGB values and one (or more) constant reference colour(s). Then use alpha-test to mask the pixels out.

But there is no practical reason do to so, at least on static textures. Just give them an alpha channel, and you''re set. Unless you have dynamic textures, eg. a video stream, and want to mask out a certain colour range in realtime on the GPU. In that case, a pixelshader can be a good solution.

Share this post


Link to post
Share on other sites

  • 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!