How to do radial blur?
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???
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.
-Hans [home page] [e-mail]
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.
-Hans [home page] [e-mail]
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??
How do you mean when you say:
"use a circle bitmap for radial blur"?
could you explain a little more/better??
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.
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.
CruelTott, normal blur is radial blur with small radius.
The bitmap i''m talking about is
in normal blur. See the connection?
Then, for bigger blur, you could use
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.
-Hans [home page] [e-mail]
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.
-Hans [home page] [e-mail]
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...
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...
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.
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.
Hi, saw you where from Sweden, check out www.planetzeus.net. There is an article in swedish about radialblur, in REAL time, there.
/ Tooon
/ Tooon
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement