Black edges around colorkey

Started by
6 comments, last by JoeyBlow2 22 years, 3 months ago
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?
Advertisement
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.
That happened to me before. To fix it I set the mag and min filter to to point filtering instead of linear filtering.
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
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?

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)
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.
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
Stay Casual,KenDrunken Hyena

This topic is closed to new replies.

Advertisement