• Welcome to Dark Bit Factory & Gravity.
 

Blurring

Started by psygate, November 03, 2006

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

psygate

Hi,

I havent written anything since two months or so (because I had some things to do) but I need your help once again!  ;D

Could you tell me how to do a blur? I mean, not this simple Middle-Color, in which you just add all points up and divide them by thier number, I mean something like gaussian, radial and movement blur!

Could someone help me?
He who controlles the minds commands the many.
He who commands the many, conqueres the minds.

slinks

No idea, but you're in the wrong section mate.
I love semi-colons way too much ^^;
Challenge Trophies Won:

Jim

Hi Psygate - I moved the topic to this coding forum.

All blurs by definition are just adding up neighbouring colour values (in space, or in time) and averaging them out.  The different kinds of blur you mention are made by how you define neighbouring.  What kind of effect would you like to achieve exactly?

Jim
Challenge Trophies Won:

psygate

I would be really interessted in radial blur. It's the only effect I could work out on my own... (radial blur fromt eh center and around, you know, there are towo options in photoshop how to blur with radial blur)
He who controlles the minds commands the many.
He who commands the many, conqueres the minds.

mind

optimus wrote a nice explanation on how to do a radial blur, you can find it here: http://dbfinteractive.com/index.php?topic=219.0

//Johnny
Challenge Trophies Won:

Jim

I wrote one over at the Yabasic forums, I think for Clyde, but I'm damned if I can find it.  I'd use the search there, but EzBoard is determined that I have never, in 5000+ posts, used the word 'rotation'.  I suspect they are wrong.

Jim
Challenge Trophies Won:

Clyde

Hmmm, strange I can't remember asking about this or seeing any code ( thanks if you did ). Have looked through the entire Blitz Basic topic entries and tried searching also at the Yab / Homebrew forums, came up blankety blank.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

slinks

Quote from: Jim on November 05, 2006
I wrote one over at the Yabasic forums, I think for Clyde, but I'm damned if I can find it.  I'd use the search there, but EzBoard is determined that I have never, in 5000+ posts, used the word 'rotation'.  I suspect they are wrong.

Jim


No, they might be right about that, I remember looking for a piece on rotation you wrote, can't remember what it was called, but it was a strange name. Most of the topics in that forum have bizarre names, and I had to search each topic MANUALLY for the bit I was looking for. Took ****ing ages!
I love semi-colons way too much ^^;
Challenge Trophies Won:

mind

i thought up a pretty clever and fast fake gaussian blur when i was writing my texture generator, i can post real source if you need it, but i'll try to explain it first..

normally when you blur you average the center pixel and a certain amount of it's neigbours.. say for example that you use top/left/center/right/bottom pixels..

now instead of just going

final=(source[x,y-1]+
       source[x-1,y]+
       source[x ,y ]+
       source[x+1,y]+
       source[x,y+1])/5;
destination[x,y]=final;

you use a variable to define the radius of the blur, and use that variable to decide where to grab your pixels, just like above only you use source[x,y-radius] instead of source[x,y-1];

now that alone doesnt cut it, what you need to do is to blur in several passes, decreasing radius for each pass.. so, lets say we do a 10pass gaussian blur, what we do now is something like this:

for radius =10 to 1 do
for x=0 to 255 do
for y=0 to 255 do
  begin
   final=(source[x,y-radius]+
          source[x-radius,y]+
          source[x ,y ]+
          source[x+radius,y]+
          source[x,y+radius])/5;
   destination[x,y]=final;
  end


i hope that helped you in some way.. if you wanna see the result the gaussian blur produce, try downloading my texture generator in this thread: http://dbfinteractive.com/index.php?topic=1070.0 (syntex.rar, somewhere in the thread) and play around with the blur.. to save you from wasting time implementing something that you didnt like :)
Challenge Trophies Won: