Jump to content
  • Advertisement


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


Phantom Alpha pixels

This topic is 6014 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 created a small billboard. I have a texture bmp that I use as the texture for the billboard. It is a straight uv 00 11 mapping. The bmp is a red filled circle with a black background. I have set the alpha color to black so that black is transparent. It works fine for the most part, but on the rendered screen, I have phantom black pixels here and there around the border of the circle? any ideas?

Share this post

Link to post
Share on other sites
Let''s say your transparent color is 0x000000 (24bit RGB) then only pixels that have _exactly_ that colour will be transparent. Most image editing software (like paintshop, photoshop and so on) will interpolate the colours of pixels close to the borders of shapes you draw, that''s why it''s likely that some pixels near the border of the circle will seem black to you but they won''t be completely black (let''s say 0x020000), you won''t be able to see the difference, but DirectX does...

Solutions? Either make sure there''s only one shade of black (sounds funny, I know) on your bitmaps or specify range of transparent colours (like 0x000000 to 0x050505)...

"To a computer, chaos is just another kind of order."

Share this post

Link to post
Share on other sites
you use color-keying, not (!) alpha-blending. makes big difference.
if you use (1-bit) alpha things would work fine.

the problem is:
first the texture is "filtered", producing intermediate colors.
first the texture is color-keyed, means the key-color is compared to the texture-color (which has already been filtered .

since filtering between red and black produces some intermediate values, these are NOT equal to the color-key and written to your back-buffer. im pretty sure that alpha-blending is bypassed if the surface has no aplha-channel and that NO alpha-values are generated for the normal_color<->color_key borders, hence causing the problem you described.

solution 1: switch to mag_filter and min_filter == nearest_point
(yes, this will look ugly, but the "nearly"-black pixels should be gone)
solution 2: use 1-bit alpha instead. 1:5:5:5 should be fine if you use 16 bit, otherwise the 8 X bits of 32bit color are wasted anyway and you can use 8-bit alpha nearly "for free".

i think there is no other way.
you have to do "real" alpha-blending (and take the performance-hit of the "read-modify-write" at the borders) OR switch to nearest-pixel filter.

btw: this is at least the 100st question about this very same topic. *g*

-- foobar

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!