Blur

Started by
16 comments, last by ff8 18 years, 10 months ago
hello everyone i want to make simple blur ,how can i do it ? i googled for this but i didn't find any good one :P bye
Advertisement
Well, if I were to explain all your choices here I would finish writing yet another book on the subject.

Blur operations are a kind of image filtering operation.

The usual (but not unique) way of doing these filtering operations is as a weighed average.

For each pixel at position (x,y) in your destination image, you take the pixels at and around that position in your source image, multiply the numbers that specify their colour by a factor (not necesarily the same for all these pixels), and add all these values to produce the output pixel.

Of course, the trick is in knowing how much pixels around the destination to take, and what the factors should be.

For example, To make it simple, you could take the pixels at (x-1,y), (x+1, y), (x,y), (x,y-1), (x,y+1) and multiply all of them by (1/5). This way, you are producing an image that's the average of all those pixels, and that will create a blur effect. Not necesarily the kind of blur you may want and certainly not the "best".

How to choose these factors (how many pixels around, and which factors to use) will create a whole lot of possibilities.

Probably, searching for "gaussian blur" will give you a more complex, higher quality blur to think about.
i am sorry but i still don't understand it :( i search for it but i can't get it :'(
can anyone give me simple code for this effect ?
bye
Look at a NeHe samples, there is a good one about blending (it's about transparecy! ^^)...
I want pure blur not motion blur :P.
I think NeHe's tutorial was about motion blur .
bye
An easy way to do it: render the scene, copy it to a texture, clear the colour buffer, then render the texture using trilinear filtering.

A harder and *much* slower way: render the scene, copy it to a texture, copy the texture data to a buffer, create a buffer with an equal size, iterate over the entire image adding up the values for the new pixels using some number of pixels around the current one, as well as the current one, and dividing the total by the number of pixels in the sum, then use glDrawPixels to draw the blurred result.

The first way is easy, and a lot faster, but the second lets you choose exactly how blurred the final result is, but you shouldn't use it if you need your app running in realtime. ;)
There are several ways to perform blur as some of the gentlemen above have pointed out. Before I provide any source code, tell me something; what is your target graphic hardware?
Thank you all for your replies,
Quote:
There are several ways to perform blur as some of the gentlemen above have pointed out. Before I provide any source code, tell me something; what is your target graphic hardware?

My grapic card is ATI X600 XT.
I hope to see your code :D.

Quote:
A harder and *much* slower way: render the scene, copy it to a texture, copy the texture data to a buffer, create a buffer with an equal size, iterate over the entire image adding up the values for the new pixels using some number of pixels around the current one, as well as the current one, and dividing the total by the number of pixels in the sum, then use glDrawPixels to draw the blurred result.

Can you explain it more ?if you don't mind .
Are you familiar with ARB programs or GLSL shaders?
Nah not yet :P.
bye

This topic is closed to new replies.

Advertisement