YOUR ACCOUNT

Login or Register to post new topics or replies
Zoltan Erdokovy

Posts: 204
Filters: 24
Adobe abandoned Pixel Bender so I looked around for
a better platform for distance field generation. Filter
Forge was an obvious choice. smile:)

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.
  Details E-Mail
xirja
Idididoll Forcabbage

Posts: 1698
Filters: 8
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/
_____________________________________________________
  Details E-Mail
Zoltan Erdokovy

Posts: 204
Filters: 24
Thanks although I'm not sure what that is.smile:)

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.
  Details E-Mail
xirja
Idididoll Forcabbage

Posts: 1698
Filters: 8
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/
_____________________________________________________
  Details E-Mail
Zoltan Erdokovy

Posts: 204
Filters: 24
Good finds! I'll mock up some dummy sampler to see how many raw samples I can get out of this hardware each second.
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
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).
  Details E-Mail
Tim2501
Posts: 26
Filters: 63
-snip-

Wrong thread, sorry ;D
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
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.

  Details E-Mail
Zoltan Erdokovy

Posts: 204
Filters: 24
Ah good to know... I still haven't had time to work on it. :\
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
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
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
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.
  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
Surface filter test, radius 25, 1 min 52 sec.

  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
Bevel at 256 pixels, around 24 minutes for a surface filter.

  Details E-Mail
ThreeDee
Lost in Space

Posts: 1672
Filters: 112
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.
  Details E-Mail
Zoltan Erdokovy

Posts: 204
Filters: 24
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.
  Details E-Mail
Zoltan Erdokovy

Posts: 204
Filters: 24
Sigh... is there a way to print values to the script log?

EDIT: Ahh, the eyedropper is a lifesaver.
  Details E-Mail
Zoltan Erdokovy

Posts: 204
Filters: 24
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. smile:)

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.
  Details E-Mail
xirja
Idididoll Forcabbage

Posts: 1698
Filters: 8
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...

Quote
Ahh, the eyedropper is a lifesaver.


Oh yes, but the lifesaver is also an eyedropper! smile:cry:

smile:D smile:hammer:
_____________________________________________________

http://web.archive.org/web/2021062908...rjadesign/
_____________________________________________________
  Details E-Mail
Zoltan Erdokovy

Posts: 204
Filters: 24
Yes, that's my blog. smile:) PixelBender was abandoned so it doesn't run in newer Photoshops. Plus it could kill the video driver so often you had to calculate stuff one area a time, so the workflow was rather crappy.

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.
  Details E-Mail
Zoltan Erdokovy

Posts: 204
Filters: 24
I'm trying to cache the samples but for some weird reason the
table gets nil cells beyond [97, 97]... Why would that be?
  Details E-Mail
Zoltan Erdokovy

Posts: 204
Filters: 24
Ok, here is the filter in case anyone wants to take a stab at speeding it up:

DistanceField.ffxml
  Details E-Mail
Sphinx.
Filter Optimizer

Posts: 1750
Filters: 39
  Details E-Mail
Zoltan Erdokovy

Posts: 204
Filters: 24
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.
  Details E-Mail
Zoltan Erdokovy

Posts: 204
Filters: 24
Since some windows update Pixel Bender instantly closes after start so an alternative now is not just a good idea but a necessity. smile:|
  Details E-Mail
Zoltan Erdokovy

Posts: 204
Filters: 24
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
  Details E-Mail
xirja
Idididoll Forcabbage

Posts: 1698
Filters: 8
Quote
The min and max components can be used for that sort of thing.. http://www.filterforge.com/forum/read...ssage83190


That certainly works for my erosive purposes. Thank you Sphinx!
_____________________________________________________

http://web.archive.org/web/2021062908...rjadesign/
_____________________________________________________
  Details E-Mail

Join Our Community!

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!

Create an Account

Online Users Last minute:

34 unregistered users.