Jump to content
  • Advertisement

Archived

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

CruelTott

How to do radial blur?

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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]

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
CruelTott, normal blur is radial blur with small radius.

The bitmap i''m talking about is

010
111
010

in normal blur. See the connection?

Then, for bigger blur, you could use

0011100
0122210
1233321
1234321
1233321
0122210
0011100

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]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites
Hi, saw you where from Sweden, check out www.planetzeus.net. There is an article in swedish about radialblur, in REAL time, there.

/ Tooon

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!