hexagonstar |
Was wondering if somebody knows a workaround for this (if it's even possible) ...
Let's say you have a group of components in your filter that do a rather CPU-costly operation and the outcome of that filter part is controlled by a slider 0 - 100. To disable that filter part you could add an additional Switch comp with a checkbox to circumvent it but instead of adding another control to the filter wouldn't it be more elegant if the filter automatically circumvents the CPU-costly filter part if the user sets the slider to 0? |
|
Posted: November 17, 2010 10:14 pm | ||
Totte
![]() |
You could use Lua and write your own Switch or base it on my Megaswitch to do that. Just use the other input if the value is zero.
- I never expected the Spanish inquisition |
|
Posted: November 18, 2010 12:52 am | ||
Sphinx.
![]() |
Or use a threshold - you might need to hook up your slider to Assemble RGB first to get connection compatibility to the Source input (for some reason FF requires map source here.. makes no sense though)
Check out this article on optimization with thresholds: Clipping @Totte: I think using a script for this will be slower than the above, even though you can make the actual script very small and simple. This is because the script component alone is somewhat slow itself (even if the script is as simple as "return 1,1,1,1" and no more). Hopefully we will see performance optimizations for this in the future ![]() |
|
Posted: November 18, 2010 1:32 am | ||
hexagonstar |
Ok, script is the way to go then for this! I had a look at your script and adapted it to switch between two inputs depending whether the provided value is zero or non-zero.
|
|
Posted: November 18, 2010 3:29 am | ||
Sphinx.
![]() |
Alright, I just compared a script solution with a threshold solution. Even though the threshold solution theoretically involves more calculations, it is way faster. See attached filter.
I hope FF will be able to reduce the baseline overhead of using the script component. switching test.ffxml |
|
Posted: November 18, 2010 4:24 am | ||
hexagonstar |
Hey Sphinx, saw your reply a bit too late. In your test filter the non-script version renders ~0.04 - 0.05 seconds faster. I guess it makes sense to use a threshold depending on the situation. I went with a very simple script now because I'm just using it to bypass some components. When a value is at zero the filter still renders noticeably faster as when not.
Here's my script example... Zero Value Switch.ffxml |
|
Posted: November 18, 2010 5:46 am | ||
Sphinx.
![]() |
Ok, I guess my old number crusher here show a bigger difference
![]() About your script - you check the slider status for all samples rendered. That is really not necessary: function prepare() value = get_slider_input(VALUE) if (value == 0) then inp = INPUT1 else inp = INPUT2 end end; function get_sample(x, y) return get_sample_map(x, y, inp) end; (I basically just moved the check to prepare instead of get_sample, see this for more info: Where to put the script parts) |
|
Posted: November 18, 2010 5:56 am | ||
hexagonstar |
Dooh, you're completely right Sphinx! The condition shouldn't be evaluated on every sample (pixel even?). Thanks for the hint!
|
|
Posted: November 18, 2010 7:26 am | ||
SpaceRay
![]() |
![]() I do not understand anything ![]() |
|
Posted: January 28, 2012 7:51 pm | ||
Morgantao
![]() |
Have to agree with SpaceRay, 100% interesting, 0% I get...
![]() |
|
Posted: January 29, 2012 6:46 am | ||
SpaceRay
![]() |
Now I went back to this and now understand it more than before, but although this works and you can disable parts of a filter, it will not disable any control attached to the disabled part, so all the controls linked to any of the controls will appear in settings tab, even if it belongs to a disabled part.
|
|
Posted: September 17, 2013 4:29 am |
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,534 Posts
+31 new in 30 days!
15,348 Topics
+72 new in year!
9 unregistered users.