• ### Popular Now

• 9
• 13
• 9
• 18
• 19

#### Archived

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

# How to do radial blur?

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

## Recommended Posts

I''ve seen radial blur being done in realtime in demos and even java applets, but I can''t find any information on how you write the effect. Not even in non-realtime. Can anyone help???

##### Share on other sites
What is radial blur? Is it like Gaussian blur?

##### Share on other sites
All blurs take an average of surrounding pixels for every pixel of the image. If you have your pic in array picture[y][x]
then for every pixel you should calculate
newpicture[y][x]=(picture[y][x]+picture[y-1][x]+picture[y+1][x]+picture[y][x+1]+picture[y][x-1])/5

That''s the basic blur. You can repeat it many times to get softer blur. Or then you can use bigger area where you take the average (use a circle bitmap for radial blur).

It''s important to draw the results in a new array, otherwise you''ll get unwanted effects.

This is slow but it works.

##### Share on other sites
I already know how to do a normal blur.

How do you mean when you say:
"use a circle bitmap for radial blur"?

could you explain a little more/better??

##### Share on other sites
you can do radial blur by taking the avarage color of a number of pixels towards the center of the screen insted of the pixels surrounding it.
ex:

X3XXXX
XX2XXX
XXX1XX
XXXXOX
XXXXXC

C = blur center
O = current pixel
1-3 pixels on a line between the current pixel and the center

It isn''t very fast, but there exists many ways to speed it up. This might not be the correct way of doing it - but maybe it will be of some help.

##### Share on other sites

The bitmap i''m talking about is
010111010

in normal blur. See the connection?

Then, for bigger blur, you could use
0011100012221012333211234321123332101222100011100

If you wrote that it would look something like
newpic[y][x]=(4*pic[y][x]+3*pic[y][x-1]+2*pic[y][x-2]+pic[y][x-3]+pic[y-2][x-1]+....)/numbertotal

Your (x,y)-coordinates are in the middle of the blur bitmap.

Of course you can draw that bitmap in Photoshop for example and then do a program that automatically calculates the blur from it so you don''t have to type lots and lots of code like I did above .

I hope you got the idea.

##### Share on other sites
Thanx Spark!

Am I right in guesing that I use a line-routine to figure out what pixels to blur with?

Well, I''ll try it with a line-routine and se if it works...

##### Share on other sites
you could do it in another way as well,
take the distance from the point you are at to the center of the radial blur, and use this as the heaviness of your blur.