transparent objects
HardTranceFan

Within an isometric game, I'd like to create the effect of seeing through a wall or object that a character has moved behind. Where the character stands, the wall or object is completely transparent. The transparency reduces radially away from the character until it becomes completely opaque a given number of pixels away. Would the following way work, or is there a better/faster way around it?

At the start of the game, create a 32bit completely opaque and black (0,0,0,0) bitmap. Update the alpha channel from completely transparent at the centre of the bitmap to completely opaque at the edges. Call this the alpha_bitmap. All loaded game bitmaps are 32bit, with alpha channel set to opaque (0).

During the game, blit the wall section to a temporary bitmap. Call this temp_bitmap. Using an additive blender, draw the alpha_bitmap onto the temp_bitmap . Then using an alpha blender, draw the temp_bitmap to the buffer.

Am I correct in thinking that the step using the additive blender will add only the alpha channel as the rest of the image is black and not affect the visible image?

ImLeftFooted

Alternatively you could set the wall as pattern and draw a bunch of expanding circles. Not sure if the CPU effort of circle drawing would outweigh the bunch of blits your method entails.

Thread #591381. Printed from Allegro.cc