• Advertisement

Archived

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

Black edges around colorkey

This topic is 5881 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 have a texture with a cloud shape on it that is light grey in color. The surrounding color is white. I am colorkeying that so the white it transparent while rendering to show the sky behind the cloud. It''s working great, but there is a blackline where the lightgrey and white (transparent) is mixing. It''s like the bilinear filtering is mixing with the colorkey, but instead of mixing white/lightgrey (white being colorkeyed) DX8 internals are mixing black/lightgrey... Anybody know a way to fix this?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
if you want sharp terminated borders, don''t know how to solve this.
if you want soft terminated borders (means linear fade from opaque to transparent) use 1 bit alpha instead.
or use dest-blending.
you could use add-signed or multiply or add-saturated - dunno how your clouds should look.

Share this post


Link to post
Share on other sites
That happened to me before. To fix it I set the mag and min filter to to point filtering instead of linear filtering.

Share this post


Link to post
Share on other sites
I believe this is because internally DX treats the transparent (color keyed) portion of the texture as black with no alpha. There are only two ways to fix this: change to point filtering like cybrgeek said, or use textures that have dedicated alpha bits (not the cereal). Depending on what graphics utility you use the border may still be visible, but should be far less noticable if at all. I use PaintShopPro, which treats pixels with no alpha as white, so unless I set the color key to white I get a slightly lighter border (color key of white leaves me with a darker border since the white becomes black).

Bill6

Share this post


Link to post
Share on other sites
In addition to what was said, try altering D3DTSS_MAGFILTER and D3DTSS_MINFILTER to D3DTEXF_POINT with SetTextureStageState. And finally if nothing else works, why not using like 4-bit channel alpha with smooth-fading opacity?

Share this post


Link to post
Share on other sites
Call me dumb, but how to you make a .BMP with an alpha channel? Or do you make a 24 bit .BMP then attach (programatically - in your code) an 8 bit alpha .BMP?

(of course bit depths can be changed)

Share this post


Link to post
Share on other sites
You can''t, at least I don''t think BMP supports alpha channels. You''d have to use a targa file instead, not sure which other file formats support alpha channels.

Share this post


Link to post
Share on other sites
G''day!

PNG supports an alpha channel and is much smaller than a targa file. Photoshop, Paintshop Pro, and The Gimp are 3 packages (from very expensive to free) that will handle alpha channels.


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites

  • Advertisement