Archived

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

JoeyBlow2

Black edges around colorkey

Recommended Posts

JoeyBlow2    100
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
Guest Anonymous Poster   
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
Bill6    122
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
Lifepower    136
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
JoeyBlow2    100
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
Bill6    122
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