PDA

View Full Version : Anti Aliased Images & Background / Transparent Colour



Gadget
17-03-2005, 11:28 AM
OK, I gave a couple of problems that I have brushed under the carpet until now, but I guess it's about time I targeted them ;)

Has anyone had experience of using DirectDraw when it comes to anti aliased images? The edges obviously blend with the background colour, effectively meaning that we can't use AA images =/

Does anyone know of a way around this? The other thing is the background colour of rendered output. The floor is specified as a specific colour, but due to lighting the actual pixel colour is not contant for the whole image, meaning that we can't just load the image into the client without some pre processing first. I had played with the option of a tolerance level which I may end up implementing to save time, but has anyone else come across this and if so how did you avoid it?

The transparent colour can have a LOW value and HIGH value can't it? How would you use this with 16 bit bitmaps (BGR) to avoid having to pre process each bitmap?

Sly
17-03-2005, 11:53 AM
If you want anti-aliased drawing in DirectDraw, you have to read pixels from the destination buffer. This means locking the destination buffer and reading the pixels which can be slow.

Gadget
17-03-2005, 11:59 AM
If you want anti-aliased drawing in DirectDraw, you have to read pixels from the destination buffer. This means locking the destination buffer and reading the pixels which can be slow.

That's not quite what I meant. What I mean is that the images are bitmaps that are already anti aliased in LightWave 3D. This means that you get a fuzzy edge when you try and blit it onto a DirectDraw surface, due to the edge of the image 'bleeding' into its background. The images look great until you blit them onto an existing image =/

Sly
17-03-2005, 10:09 PM
Ok. So you have two options.
1. Re-render using Lightwave but with anti-aliasing turned off. This will give you images with sharp edges.
2. As you hinted in your original post, pre-process the images in a paint program to give them a sharp edge and a fixed background colour.

Traveler
17-03-2005, 10:56 PM
Try rendering to tga output. If you open it in photoshop, you'll see your image without a background. (strangely enough also without an alpha channel, but you don't need it anyway). Then the next step is to create a png from the tga and import that into your game.

I was able to use this approach in my PGD entry and it worked perfectly.

Clootie
18-03-2005, 08:37 PM
DirectDraw by itself doesn't support alpha-blending