ThreeDee
![]() |
The Script basically does a Lookup of the value from point (x,y) from source image with the intent of doing so once for every loop.
However, when the accumulated is Blended with the new loop result with Darken mode, the Blend does something funky, it outputs as if both branches inside the loop had been put through the same Tone Curve although only one of them has been. (This can be seen first at iteration 4 with this varioation setting.) If you switch the foreground and background inputs, the Blend now appears like NEITHER of the branches was put through the Tone Curve. Unless I've inadvertently used some internal reserved variable in the script, I can't figure out what might cause this. Changing variable names didn't seem to change anything. ![]() |
|||||
Posted: March 31, 2013 10:10 am | ||||||
ThreeDee
![]() |
||||||
Posted: March 31, 2013 10:10 am | ||||||
ThreeDee
![]() |
It also crashes if I try to change the Script identifier for Script Component "Y" input, on pressing OK in Input editor after changing name.
|
|||||
Posted: March 31, 2013 10:16 am | ||||||
ThreeDee
![]() |
Replacing the Script with Lookup works correctly (but awfully slowly).
Non-overlapping Circles 2.ffxml |
|||||
Posted: March 31, 2013 10:43 am | ||||||
Dave S
![]() |
ThreeDee, a question if I may... that section in the filter with the lookup, subtract and linear that feed into the curve in the ToneCurve... is that intended to make the new circles smaller if they end up close to existing circles?
Dave. |
|||||
Posted: March 31, 2013 12:59 pm | ||||||
ThreeDee
![]() |
Indeed yes, to make the circles non-overlapping. So if they are too close, the radius is decreased.
|
|||||
Posted: March 31, 2013 1:09 pm | ||||||
Dave S
![]() |
Great example. Learned some nice looping stuff from it. One of these days, I'll actually feel like I know what's up in FF. You guys, keep posting these nice examples, they are great to learn from.
|
|||||
Posted: March 31, 2013 3:30 pm | ||||||
Sphinx.
![]() |
Hmm.. I experienced some strange things similar to this myself, but its not like we're getting a crash or anything..
What happens if you use the faster alternative Min from the RGB Math category? |
|||||
Posted: April 1, 2013 3:02 am | ||||||
ThreeDee
![]() |
I get the same problem but the inputs "switched", Source A works like Background, Source B like Foreground. |
|||||
Posted: April 1, 2013 4:44 am | ||||||
Sphinx.
![]() |
It could be the same problem as I have in the Julia filter (take a look at the one I posted in the beta gallery thread) - I can't use the Iteration slave node as it seems to stick at the max iteration value during the real rendering. I'll see if I can make a simple bug example.
You can try my temporary solution from the Julia filter. I basically just use one of the channels to keep track of the iteration (initialize with the value 0 and then add 1 in each iteration) Btw, not sure it is related to what you're doing, but here is an ultra simple loop based cells Cells (Loop).ffxml |
|||||
Posted: April 1, 2013 6:04 am | ||||||
Sphinx.
![]() |
What happens if you only run FF on 1 core / single threaded?
|
|||||
Posted: April 1, 2013 6:51 am | ||||||
Vladimir Golovin
Administrator |
ThreeDee, I'm trying to understand the bug you posted in the original post. I took a screenshot of Tone Curve and Accumulated and tried to blend them via Darken in Photoshop. This is what I got -- is this what you expected from the Blend in question?
(I also tried to replicate Darken with Min, and they look identical, just as they should.) ![]() |
|||||
Posted: April 1, 2013 8:42 am | ||||||
ThreeDee
![]() |
Nothing different. The problem SEEMS very simple: I'm trying to make non-overlapping circles with a loop. I just need to sample one point of the accumulated image (the center point of the next circle to be placed) and use it to determine the radius of the next circle. But just adding this one branch of coordinate sampling (which I have to do with Lookup in order it to work) makes the filter grind to a halt after about 7 iterations. The script attempts to overcome that by sampling the same exact point when the iteration count changes. However, then I am met with this new problem which seems to relate to loop sample caching that makes the Accumulator result not work as expected. |
|||||
Posted: April 1, 2013 8:54 am | ||||||
ThreeDee
![]() |
Hi Vlad. Yes, exactly. That is what it is supposed to look like. Only ONE branch goes through the Tone Curve but the result is as if BOTH branches went through it. You get the right result if you replace the Script with Lookup with the same X and Y inputs (The "Step" input is not needed for Lookup, it just checks whether a new loop iteration has been entered). |
|||||
Posted: April 1, 2013 8:58 am | ||||||
Vladimir Golovin
Administrator |
ThreeDee, speaking of the filter you posted in the first post, could you try to remove as much stuff as possible while retaining the bug?
(This looks similar to http://www.filterforge.com/forum/read...age118756). |
|||||
Posted: April 1, 2013 9:04 am | ||||||
ThreeDee
![]() |
Yes, it appears similar -- although there is no Grouping involved here, rather a Script.
This is the simplest I can make it. If you go to Iteration 3 of the Accumulated, you can see that in the Blend the Radius of the Free Polygon (or Ellipse) is funky, it is unaffected by the Script result, although the Free Polygon itself is affected by it ... ![]() Again, if you connect the Lookup instead of the Script, all is well. Script Loop Bug.ffxml |
|||||
Posted: April 1, 2013 9:34 am | ||||||
ThreeDee
![]() |
||||||
Posted: April 1, 2013 9:34 am | ||||||
Vladimir Golovin
Administrator |
Here's my attempt at reproducing a stripped-down version of the "bug". When you adjust the Gamma slider, all ellipses change, as if they all have been processed by the gamma -- which is precisely what's going on! Every single ellipse that went through the Loop was indeed processed by the same Gamma curve, and that's why they all change when you adjust Gamma.
Is this example comparable to your case? All_As_One.ffxml |
|||||
Posted: April 1, 2013 9:39 am | ||||||
ThreeDee
![]() |
No. Let me try and make another one.
|
|||||
Posted: April 1, 2013 9:41 am | ||||||
Sphinx.
![]() |
Hmm.. I think there is a problem with the Script configuration: it should have HDR enabled on the inputs (at least on the step input). The lack of HDR support will result in the same lookup value, the same tone curve settings and hence the similar tone adjustment.
Btw I encountered a bug related to this HDR change.. |
|||||
Posted: April 1, 2013 9:43 am | ||||||
ThreeDee
![]() |
||||||
Posted: April 1, 2013 9:49 am | ||||||
ThreeDee
![]() |
||||||
Posted: April 1, 2013 9:53 am | ||||||
Vladimir Golovin
Administrator |
ThreeDee, could you try to reproduce it without the script? |
|||||
Posted: April 1, 2013 10:00 am | ||||||
Sphinx.
![]() |
Guys.. disconnect the script, enable HDR on the step input and reconnect
|
|||||
Posted: April 1, 2013 10:02 am | ||||||
Vladimir Golovin
Administrator |
||||||
Posted: April 1, 2013 10:06 am | ||||||
ThreeDee
![]() |
Well, I'll be damned. That was the problem! Never noticed that little checkbox on the inputs, only the "can output HDR" option....
![]() My only remaining question then is: Why on Earth is it still so slow? Can I make some sort of "initialize trick" for the Script for every beginning loop to speed this up? Looking up one additional sample per loop should not slow things down this much. |
|||||
Posted: April 1, 2013 10:21 am | ||||||
GMM
Moderator
Posts: 3491 |
(A sidenote: a bug point goes to ThreeDee for crashing the Input Editor)
|
|||||
Posted: April 1, 2013 10:25 am | ||||||
Sphinx.
![]() |
You're not alone .. that default setting has fooled me so many times now. I really wish the default setting was the other way around, i.e. HDR enabled by default - that would allow both HDR and non HDR pipelines.
About the speed - from what I see you're branching x2 in each iteration. The cache you implement is not really working because (I think) each iteration has its own scope, so you can't cache v across iterations.. is that right Vlad? Btw. there was a mistake in my old Julia sample cache, I fixed that and added an even smarter approach to the cache setup. There might be something for inspiration ![]() Native Julia Set (1).ffxml |
|||||
Posted: April 1, 2013 10:37 am | ||||||
Vladimir Golovin
Administrator |
If the samples hit Accumulated at different coordinates, then the cache won't help at all and you'll get an exponential recursion. If the samples hit Accumulated at the same coordinates, it's a matter of dumb luck. The cache may work for some arrangements or components, but for others it won't. We'll need to refactor all components to get that in order. |
|||||
Posted: April 1, 2013 10:48 am | ||||||
Vladimir Golovin
Administrator |
We've fixed that, to be released in the next hotfix. |
|||||
Posted: April 1, 2013 10:50 am | ||||||
ThreeDee
![]() |
Would it be possible to initialize, that is to run the Prepare function newly for each loop? As far as I can tell, it is only run once, for the first loop iteration. Otherwise it would be very simple to construct a Script that picked the value of a single point fr om an image (once for each iteration).
If I do that now, pick the value and then use the initialization trick to output the same initial value, it is retained through all iterations. My script tried to overcome that lim itation, but I've had no success in making it work any faster. Maybe I'm missing something basic, but I really don't seem to be able to make it happen. |
|||||
Posted: April 1, 2013 12:36 pm | ||||||
Vladimir Golovin
Administrator |
The Prepare() function runs once, before the rendering (i.e. the sampling process).
Shouldn't this code be placed into script's GetSample() then? |
|||||
Posted: April 1, 2013 12:46 pm | ||||||
ThreeDee
![]() |
Yes, that's what I tried. This script gives me the value of the image for point (X,Y) that is different for each step. I have to use the STEP (which gets it input from Loop Iteration) to detect a new iteration value.
Even if I sample the same exact point (.5,.5), there is no speed gain.
This is why I asked if there could be built-in a Unit component that did this sort of thing. Almost all of my loop attempts fail on this one issue, and become "exponentially recursive" (in quotes, as they really aren't). Picking one sample should not be slow. |
|||||
Posted: April 1, 2013 1:13 pm | ||||||
Sphinx.
![]() |
Ah, I recall the annoying change to the scripting engine that was introduced to "fix" multi-threading issues: Each rendering tile (the small incremental blocks we see during rendering) has its own scripting scope.
This means that even with a single lookup based on a fixed coordinate, the cache script will be initialized blockCount^2 times. That is 64 for the default resolution. This means that we essentially can think of this as a forced non cached 8x8 pixel rendering. Taking the branching at 10 iterations into consideration that ends up being (8 * (2^10))^2 or 8192x8192 samples just to cover the render tile "resolution", i.e. the initialization of render tile scripting scopes. ![]() This is just speculation of course - it would be nice if Vlad or Egret could shed some light on this. |
|||||
Posted: April 1, 2013 4:59 pm | ||||||
Vladimir Golovin
Administrator |
Yes, this is correct. |
|||||
Posted: April 12, 2013 7:13 am |
Filter Forge has a thriving, vibrant, knowledgeable user community. Feel free to join us and have fun!
33,711 Registered Users
+18 new in 30 days!
153,533 Posts
+38 new in 30 days!
15,348 Topics
+73 new in year!
33 unregistered users.