Crapadilla
![]() |
Radial Blur by bertie
http://www.filterforge.com/filters/9442.html ![]() --- Crapadilla says: "Damn you, stupid redundant feature requests!" ;) |
|||||||
Posted: November 16, 2011 4:48 pm | ||||||||
Crapadilla
![]() |
How did I miss this?
It's nice to see that a fast-rendering scripting solution is possible for radial blur... ![]() A humble request: Could you simplify this and submit a "scrippet", with just the script map component and possibly some more detailed explanations of the script? --- Crapadilla says: "Damn you, stupid redundant feature requests!" ;) |
|||||||
Posted: November 16, 2011 4:48 pm | ||||||||
bertie |
I'll upload a scrippet. In the meantime, here is a quick overview of how it works.
The prepare part of the script isn't doing much that's special so I'll skip over that. The radial part is done by this piece of script
xd and yd are calculating how far the point being rendered by the map script is fr om the centre of the blur. This gives the flexibility to reposition the centre of blur anywhere in the image. Once these two distances are known the atan2 functions is used to calculate the angle to the point. Note the use of atan2 is very useful as it returns an angle based on positive and negative coordinates which atan doesn't. So ang contains the angle from the centre to the point being rendered. It's the angular part of the polar coordinate of the point wh ere the centre is the origin. This angle is stored in radians not in degrees which might be important if anybody wanted to manipulate the angle in some way in a modified script. Now the angle is known, it's possible to calculate the unit vector for the line that joins the sampled point to the centre of the blur. In the code this is done by: ![]() diagram by RB_UK, on Flickr
It's not quite a unit vector because it multiplies the result by pixelstep at the same time but hopefully you get the idea. If you are standing at the sample pixel and you add xs to the x coordinate and ys to the y coordinate you move an amount pixelstep towards the centre of blur. This next bit does the sampling of multiple points. The picture helps to explain things better.
You'll see the the loop runs from 1 to Length times and each time the point sampled is the location plus (s*xs). In other words, the loop samples along the line towards the centre in steps of xs (and ys for that matter). So you get a number of samples that are radially distributed. The result is the radial blur. The full filter has some extra features. There is a 'deadzone' in the middle of the blur which makes it look more like a natural zoom blur. This is done with a simple elipse and transparence between the original and blured image. If you want to see a simpler implementation of this deadzone effect, see my filter 'spot focus'. Fast mode just switches off most of the processing to enable the correct positioning of the centre and the radius of the deadzone. |
|||||||
Posted: November 17, 2011 12:08 pm | ||||||||
Crapadilla
![]() |
Thank you, this is much appreciated!
![]() Btw, do you realize you are setting a new standard for script filter documentation on this forum? ![]() ![]() --- Crapadilla says: "Damn you, stupid redundant feature requests!" ;) |
|||||||
Posted: November 17, 2011 1:05 pm | ||||||||
bertie |
I'm working on another filter using similar ideas that produces realistic bokeh. I've uploaded some samples here at the link below.
See slideshow of the bokeh effect It's not ready for publication. I've got a few things to tidy up but it works pretty well. |
|||||||
Posted: November 17, 2011 1:29 pm | ||||||||
bertie |
Snippet of the script now available here
|
|||||||
Posted: November 18, 2011 1:33 pm |
Filter Forge has a thriving, vibrant, knowledgeable user community. Feel free to join us and have fun!
33,712 Registered Users
+19 new in 30 days!
153,533 Posts
+31 new in 30 days!
15,348 Topics
+73 new in year!
31 unregistered users.