Zoltan Erdokovy
![]() |
Adobe abandoned Pixel Bender so I looked around for
a better platform for distance field generation. Filter Forge was an obvious choice. ![]() Has anyone attempted to implement it here? The Pixel Bender version ran on the GPU so having each pixel check neighbors in circles of ever increasing radius was a workable solution. However FF is a very different beast so I'm not sure if there are some theoretical limits preventing a proper algo from finishing in a reasonable time. |
|||
Posted: June 11, 2014 5:00 am | ||||
xirja
![]() |
Didn't have time at the moment to finish, but this might be a good start.
Pixel Numbers.ffxml _____________________________________________________
http://web.archive.org/web/2021062908...rjadesign/ _____________________________________________________ |
|||
Posted: June 11, 2014 9:43 am | ||||
Zoltan Erdokovy
![]() |
Thanks although I'm not sure what that is.
![]() Here are a few calculations: Let's assume a 512x512 image with max distance of 256 and wrapping around at the edges. We have 262144 pixels, each pixel will check less than 256*256 = 65536 neighboring pixels. That would be checking a square but we only need a circle around the target pixel. The area of a circle of 0.5 radius is 0.78 so that's gives us 65536*0.78 = 51000 pixels with a radial search. So the worst case scenario is that logic runs 262144*51000 = 13369344000 times and we want it to finish reasonably quickly, let's say in 5 minutes or 300 seconds. That would be 44564480 sample evaluations a second. 44.5 million... that sounds a lot... even if it will almost always be less than that. |
|||
Posted: June 11, 2014 10:25 am | ||||
xirja
![]() |
Was too early, not sure I did either. Anyhow, after a little recalling and checking around, look 1/4 the way down on the page:
http://www.filterforge.com/forum/read...8&TID=9724 for: Sine-O-Graph One - Sphinxmorphed.ffxml it has a filling method that reminded me of what I saw here: http://jojendersie.de/?p=106 but aside from that aaaa... a non gaussian blur with aaa...we need bitmap based components, so probably this is for the scripting section? _____________________________________________________
http://web.archive.org/web/2021062908...rjadesign/ _____________________________________________________ |
|||
Posted: June 11, 2014 10:14 pm | ||||
Zoltan Erdokovy
![]() |
Good finds! I'll mock up some dummy sampler to see how many raw samples I can get out of this hardware each second.
|
|||
Posted: June 12, 2014 12:33 am | ||||
ThreeDee
![]() |
A thought:
Script a two-directional ramp (horizontal, for instance), then run it through a bitmap-based component (such as directional blur with minimum radius) then another script for two-directional ramp in the other direction (vertical). Theoretically this would decrease the number of samples greatly. Still, without trying it out, don't know if it would actually be faster. Or: Use Sphinx's custom bitmap cache script instead of the bit-map based component (if it works for this purpose). |
|||
Posted: June 14, 2014 3:18 pm | ||||
Tim2501 |
-snip-
Wrong thread, sorry ;D |
|||
Posted: June 20, 2014 8:50 am | ||||
ThreeDee
![]() |
Did a comparison test with two versions:
I made a script that creates a horizontal two-directional ramp and fed the original image through it then rotated and ran through another copy of same script. Doing those two scripts without a bitmap-component in between, the render times for 10 and 25-pixel distance fields were 1 min 35 sec and 9 min 1 sec respectively. Adding a bitmap component (directional blur with minimal radius) between the two scripts resulted in massive increase the render times for the same were 14 sec and 30 sec. A 256-pixel field rendered in 6 minutes and 3 seconds with the bitmap component-approach. Probably no sense trying it without. ![]() |
|||
Posted: June 21, 2014 5:00 am | ||||
Zoltan Erdokovy
![]() |
Ah good to know... I still haven't had time to work on it. :\
|
|||
Posted: June 21, 2014 5:16 am | ||||
ThreeDee
![]() |
Yeah, I tried rendering 256 radius without the bitmapped component in between, would have taken approximately 17 hours.
Here's the faster method. Hopefully someone can come up with other speed improvements, for it would be a very useful component if it was faster. (Obviously, the filter gives a rectangular result, not gaussian.) Distance Field Bitmapped.ffxml |
|||
Posted: June 21, 2014 6:32 am | ||||
ThreeDee
![]() |
Also, I don't know if the tiny blur deteriorates the output critically. I guess that depends on the application. Since the blur is in the same direction as the ramp, I doubt it makes any real difference in most cases.
|
|||
Posted: June 21, 2014 6:39 am | ||||
ThreeDee
![]() |
||||
Posted: June 21, 2014 10:41 am | ||||
ThreeDee
![]() |
||||
Posted: June 21, 2014 11:56 am | ||||
ThreeDee
![]() |
I have another theory under development. I just successfully scripted a "Bitmap Component" that doesn't make my computer explode. It works almost as fast as running something through a tiny blur. If I can manage to merge all three separate steps (done now with three separate Script Components) into a single Script Component, it might be even faster.
|
|||
Posted: June 21, 2014 4:54 pm | ||||
Zoltan Erdokovy
![]() |
I took a stab at it yesterday:
![]() Now I'm trying to debug why the far away pixels suddenly become white... The sampling is done on a square area at this point. |
|||
Posted: June 22, 2014 4:24 am | ||||
Zoltan Erdokovy
![]() |
Sigh... is there a way to print values to the script log?
EDIT: Ahh, the eyedropper is a lifesaver. |
|||
Posted: June 22, 2014 6:55 am | ||||
Zoltan Erdokovy
![]() |
Alright, I got this working. It's a 600-800 times slower than the PixelBender version but it doesn't crash the video driver at high iterations which is good.
![]() On a 1K image 256 pixel search radius takes hours to render but 64 is just a few minutes. (The radial search algo still has issues with standalone single pixels but I'll fix that later. ![]() Using a bitmap component before the script node (blur with (near) 0 radius) made the letters grow some really weird appendages... not sure what's going on there. I'll do a quick optimization pass then submit it. |
|||
Posted: June 23, 2014 6:53 am | ||||
xirja
![]() |
Took some time yesterday to check out: http://www.zspline.net/blog/distance-field-generator/ Very useful for text resizing and erosion! Looking forward to this one!
Im thinking there must be a way to use minimum and maximum components to do this. Still tinkering...
Oh yes, but the lifesaver is also an eyedropper! ![]() ![]() ![]() _____________________________________________________
http://web.archive.org/web/2021062908...rjadesign/ _____________________________________________________ |
|||
Posted: June 23, 2014 9:46 am | ||||
Zoltan Erdokovy
![]() |
Yes, that's my blog.
![]() I did try minimum/maximum some time ago but it didn't produce a usable result (ugly distortions as I got further away from the original contours) and it was still extremely slow. |
|||
Posted: June 23, 2014 9:58 am | ||||
Zoltan Erdokovy
![]() |
I'm trying to cache the samples but for some weird reason the
table gets nil cells beyond [97, 97]... Why would that be? |
|||
Posted: June 23, 2014 12:44 pm | ||||
Zoltan Erdokovy
![]() |
||||
Posted: June 24, 2014 1:50 am | ||||
Sphinx.
![]() |
The min and max components can be used for that sort of thing.. http://www.filterforge.com/forum/read...ssage83190
|
|||
Posted: June 24, 2014 9:09 am | ||||
Zoltan Erdokovy
![]() |
Might work in certain cases but the distortions introduced mess up text related effects for example.
It seems that the algo is inherently unfit for FForge... I'll try Processing next. |
|||
Posted: June 24, 2014 10:32 am | ||||
Zoltan Erdokovy
![]() |
Since some windows update Pixel Bender instantly closes after start so an alternative now is not just a good idea but a necessity.
![]() |
|||
Posted: June 24, 2014 1:55 pm | ||||
Zoltan Erdokovy
![]() |
New version with calculation restricted to a 256x256 cell. Cell position can be adjusted so one can process an image in several passes.
DistanceField.ffxml |
|||
Posted: June 25, 2014 3:37 am | ||||
xirja
![]() |
That certainly works for my erosive purposes. Thank you Sphinx! _____________________________________________________
http://web.archive.org/web/2021062908...rjadesign/ _____________________________________________________ |
|||
Posted: June 26, 2014 7:11 am |
Filter Forge has a thriving, vibrant, knowledgeable user community. Feel free to join us and have fun!
33,718 Registered Users
+8 new in 7 days!
153,540 Posts
+9 new in 7 days!
15,348 Topics
+71 new in year!
34 unregistered users.