Jump to content
  • Advertisement

Archived

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

MrPlough

problem with color keys maybe

This topic is 5689 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

Hi, Im loading a .bmp using LoadImage and blitting it to an offscreen surface with magenta(255,0,255) set as colorkey. Im getting magenta anti-aliasing artifacts around my graphics when i blit them, but the .bmp only has one shade of magenta in it. I know this because i dropped the color depth to 8bit so i could view the pallete. so i figure either photoshop is antialiasing on "save as... .bmp" LoadImage is antialiasing on loading (??) or more likely, Ive set up the offscreen or primary surfaces/colorkeys wrong. anyone help please, Mr Plough.

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by MrPlough
so i figure either
photoshop is antialiasing on "save as... .bmp"
LoadImage is antialiasing on loading (??)



NO WAY!!! What kind of image editing program do tasks on saving without
asking you to do so?? Imagine you''re loading and saving the image often,
when you finish working on your texture/image you have an ugly blurred
image...

LoadImage antialiasing on loading? Don''t know but if that''s the problem
maybe you''re setting some flags on LoadImage() that do that otherwise
I think that''s not the problem either...

Sorry for not answering you, I''m just trying to make you don''t waste your
time thinking on these problems (Photoshop/LoadImage() ) look up
for other stuff you might be doing. I can''t help you, I''m not a DDraw
guy, so good luck


KaMiKaZe

Share this post


Link to post
Share on other sites
Take a closer look at the colour key structure - that allows you to set a **range** of colour values which act as the key.


The real issue is that most modern or even reasonably modern (e.g. nVidia TNT) graphics chips are really essentially 3D only and don''t actually support colour keying (which has always been a fairly ill defined thing "umm its a bit like chromakeying")...

...so what the drivers of those chips do is is **emulate** colour keying using textures and alpha-test. The problem with this is texture filtering is on by default in most 3D apps so if you stretch the surface at all when you blit the filtering also filters the colour key so it becomes a range of values and you see that nasty halo. The range in the colour key can help.

That''s also the reason why colour keying was depreciated from the 3D side of Direct3D.

If you have a D3D device set up you could go in and set the filtermode to point or none. The advanced settings for your graphics card driver may also allow you to change that behaviour.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Thanks for the reply,
Yeah youre right, It was the blit scaling that was causing it (which i didnt mean to do anyway, i got my maths wrong ).
So its working fine unless I scale (or rotate presumable).

I cant see that setting a range of colorkeys would help in this instance because while I might be able to get rid of some of the artifacts some would get through.

How do I disable filtering in the hardware?
Ive found some related DDCAPS but mostly alpha ones.

Is this one of those cases where it would be better to do it in D3D using alpha?

MrPlough

Share this post


Link to post
Share on other sites
quote:
Is this one of those cases where it would be better to do it in D3D using alpha?


probably...


quote:
How do I disable filtering in the hardware?


Different drivers may fix it, there may be a setting in the advanced display settings too. Assuming this is nVidia hardware, take a look at their site for details.

An untested idea that *MIGHT* work:

Since you already have a DirectDraw device, create a DX7 D3D from that interface, get the device setup etc, then call SetTextureStageState() to change the filtering mode to POINT or NONE and then don''t do anything more with the D3D device after that, continue using the DirectDraw interfaces as usual, kill the D3D device after shutdown.


--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

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!