• What is your GameDev Story?

Archived

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

Blur Algorithm ?

This topic is 6783 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

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 on other sites
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 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 on other sites
how would you blur a bitmap with only a 256-color set-in-stone palette?

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 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 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!"

• What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• 13
• 9
• 15
• 14
• 46
• Forum Statistics

• Total Topics
634058
• Total Posts
3015289
×