• Advertisement

Archived

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

Blur Algorithm ?

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

Hey guys ! I''ve goy a little question. How can I make an algorithm that make the blur-effect on a bitmap ?? I need for a normal blur algorithm, but if it''s possible, a Gaussian-Blur once If you don''t know the specyfic algorithm, but you know WHERE i can find some informations about it, don''t hesitate to write ! Any sentence is appreciated ! Thankyou in advance. //------------- Making Funny Garbage Codes on http://members.xoom.it/NinjaCross

Share this post


Link to post
Share on other sites
Advertisement
I don''t know how to do a gauss blur But here''s a (too) simple explaination:

For every pixel take the value of it''s neighbours add them all up, and divide by the amount of neighbours.
In other words calc the average...

Share this post


Link to post
Share on other sites
Yah, for pixel x in the diagram (below) Take pixels 1-8 and average it with the pixels current value.

[1][2][3]
[4][x][5]
[6][7][8]

If you want the pixel x to resemble itself twice as much as as the surrounding pixels, simple add 1-8 together and divide by 16 then add x divided by 4. I think that''s right? Well play around... but averaging is the idea, different special blurs are just tweaks like this one, try searching for gaussian blur on the net...
See ya,
Ben

P.S. Blurring is almost always to slow for in game speeds... It takes like 9 - 12 times more time than a normal blit... But you could do cool menu stuff, or pre-blur something for ingame, or if you use it sparengly like software alpha blending...

Share this post


Link to post
Share on other sites
hmmm.... well is the pallete an "optimized" pallete or is it a gradule order of some sort like 8bpp? If it''s "optimized" or rearanged order specially for each image, then I''d say your hooped, but if not there may be a way, just experiment....
- Ben

Share this post


Link to post
Share on other sites
quote:
Original post by Jeremiah

how would you blur a bitmap with only a 256-color set-in-stone palette?


Convert to 24-bit internally, blur as described above, then for each blurred pixel find the entry in the palette that most closely matches the new pixel. The more evenly distributed your palette is, the better this would work. You couldn''t really do this in real-time without some serious optimization, though

Share this post


Link to post
Share on other sites
I wrote ASM code that does this kind of blurring stuff in 8-bit or 24-bit fullscreen. (The 8-bit requires a smoothly shaded palette to look any good). I also did a 15-bit version that I never got around to testing, and a 16-bit version that didn''t quite work (very strange problem).

It''s reasonably fast, but still too slow to be used on a high res. or along with any other CPU munching code. The main problem I find is that to muck around with a direct draw surface at a pixel level it ought to be in system memory, and BLTing from system memory to video memory is slow (with a capital S). I''m going to try the DMA stuff in Dx7, hopefully this will speed it up a bit.

George.

"Who says computer games affect kids, imagine if PacMan affected us as kids, we'd all sit around in a darkened room munching pills and listening to repetitive music....uh oh!"

Share this post


Link to post
Share on other sites

  • Advertisement