Advertisement

alpha map

Started by September 14, 2004 03:39 PM
1 comment, last by Marty666 20 years, 2 months ago
Hi all! I'm still working on the artillery game. Can anyone tell me how to manipulate a texture realtime? This is my problem: all the a's and b's are landscape. It's one big texture. The white space is aplha=0 (for collision detection). As you can see there is a hole in my landscape and all the b's should fall down. I'd like to animate this, so one pixel at the time.

                 aab
               aaaabbb
aaaa       aaaaaaaa
aaaaaaa  aaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
My plan is to go up every column and check if a pixel in the column was set to alpha = 0 and move all the pixels above this pixel one down. If I do this a couple of times with time intervals the b's would seem to move down. Ofcourse i'll stop when there are no more holes. Since the pixels i'm talking about correspond to the texels in my landscape texture I need to be able to do the thing I described above with a texture. My problem is now: HOW?! I can save the aux_rgbimagerec i used to create the texture, modify that and make a new texture (can be a little slow, cause i need the time intervals for the animation anyways)... Has anyone got a better idea? My second question. I've got little bitmaps for the tanks with a blue background. Is there an easy way to make alpha maps to cut away the blue? Thanks, Marty
_____ /____ /|| | || MtY | ||_____|/Marty
Hi,

I don't think that thats be best idear.
There was a game named clonk (im not shure). I think they use some particle system.
That would be my way too. I think you would have to partition the space and do check for the radius of the impact and update the particles there ( you could simply bind the particles to a grid, and do searchs with that ).

Just an idear. I think with alpha maps you would never get good result at resonable speeds.

Advertisement
Hi!

Thanks for the idear. I guess it's allready what i'm trying to do here. It would become a shitload of particles (at 800x600 half the screen is landscape) so that means 240000 particles. I would prefer pixels over particles, because it's essentially the same thing, only a pixel can't do anything. The alghorithm to sort out what the pixels are doing can be faster than an alghorithm that has to work for every particle... Well thanks a lot anyways, i might look at the particle thing aswell, cause a lot of stuff that can be shot might aswell be particles, so why not the ground itself.

Marty
_____ /____ /|| | || MtY | ||_____|/Marty

This topic is closed to new replies.

Advertisement