# Blur

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

## Recommended Posts

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

##### Share on other sites
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.

##### Share on other sites
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

##### Share on other sites
Look at a NeHe samples, there is a good one about blending (it's about transparecy! ^^)...

##### Share on other sites
I want pure blur not motion blur :P.
I think NeHe's tutorial was about motion blur .
bye

##### Share on other sites
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. ;)

##### Share on other sites
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?

##### Share on other sites
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 .

##### Share on other sites
Are you familiar with ARB programs or GLSL shaders?

Nah not yet :P.
bye

• ### What is your GameDev Story?

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

• 11
• 15
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
634151
• Total Posts
3015827
×