Color keying, help anyone??

Started by
3 comments, last by qwerpa 22 years, 7 months ago
Does color keying only work for back buffer formats with an alpha channel? The DX8 caps viewer says my video card only supports R5G6B5, and X8R8G8B8. When I use D3DXLoadSurfaceFromSurface for example, and use color keying, my color keyed color comes out opaque black, not transparent black! Is there a way so that perhaps I could write to a temporary surface made with A8R8G8B8 and then copy to my back buffer to get the transparency effect? Some insight would be Greatly appreciated, thanks! - Shane
Advertisement
It may seem patronising - but are you enabling alpha testing and setting the test function?
yes
I think it is possible to load the bitmap, create a A8R8G8B8-Texture of the same size, lock it and copy the pixels manually, while testing them. If they match your colorkey, make alpha 0x00, else make it 0xFF. Then you can get rid of the original texture and use the new one, which should be transparent at the pixels with alpha 0x00
Thanks for your help. Yeah my image is coming from a surface, so I guess I can get a pointer to the data and do some manual copying, though that is unfamiliar territory for me... I''ll see how it goes.

I was just wondering, I thought that setting the alpha testing state was optional, just a speed optimization because it did a pre-emptive test to see if it needed to calculate the alpha-blending per pixel.

Well, if anyone has had success with color keying (in DX8), perhaps you could reply to this post and also include what backbuffer format you were using (A8R8G8B8, etc.)

Thanks!

- Shane

This topic is closed to new replies.

Advertisement