David Roberson |
A project I was working on recently could have benefitted from this kind of Curve Ops component. It seems like a practical thing to have, and there are lots of times I found myself wanting some way to do a linear interpolation between two curves. I suspect you could even have the interpolation controlled by a map input. I swear, there's something in the back of my mind saying I've seen someone do something like this with existing components, but I can't remember what it was. If I had a clue about curve scripting, I'd try to do this one myself. If someone thinks of a way to do it, I'd love to hear about it!
|
|||||
Posted: May 14, 2021 10:32 pm | ||||||
emme |
The Blend curve op does a linear interpolation. In a curve script, you can use this:
(1 - factor) * curve1 + factor * curve2 You can use a map input for the factor if needed. The Blend op already has a map input. curve_lerp_v001.ffxml |
|||||
Posted: May 15, 2021 6:19 am | ||||||
David Roberson |
Oh. Don't know how I missed it! Thanks, emme!
I had the idea that the Blend Curve Ops was locked in a left-to-right sort of transition. I guess you never stop learning the basics with FF. Thanks for the examples, and someday I'll bug you with my other curve scripting questions. I have not had any luck finding examples to study, and there isn't anything in the scripting APIs for curve scripts. I'd be happy just knowing how to create a Curve Ops style script that controls Start, End, Minimum and Maximum. It'd be handy to pair up with Bezier curves. |
|||||
Posted: May 15, 2021 6:48 pm | ||||||
emme |
For me, the x,y and t coordinates made curve scripts confusing at first. Unless you need map inputs for the script, you can ignore the x/y coordinates and simply think of t as the x coordinate. For each position of t you want to return the value (or the height) of the curve. That's pretty much it.
Here's my attempt at the start/end/min/max curve op script. curve_control_v001.ffxml |
|||||
Posted: May 16, 2021 3:41 pm | ||||||
David Roberson |
Nice!
So, the variable c that's being returned at the end is the modification of the sample curve variable t? Is that the only value you can return for, or is there also the option of returning values for x and y? |
|||||
Posted: May 17, 2021 9:54 pm | ||||||
David Roberson |
I like the way you corrected for the inversion of the Start and End, but it did make me wonder if you also had the option of reversing the curve. There's a Curve Ops for that, so it's really just curiosity that has me wondering how I'd handle that. My mind doesn't want to wrap itself around it at the moment, sadly.
![]() |
|||||
Posted: May 17, 2021 10:02 pm | ||||||
emme |
A curve is one-dimensional - in the sense that it is described by only one parameter - so there's only one value to return. That being said, the x/y sample coordinates can be used to return different curve values at different points on the image plane. So basically the x/y refer to the image coordinates, while t refers to the curve coordinate.
Sure, to reverse the curve, using 1-t (inverting the curve x-axis) will do the trick. |
|||||
Posted: May 18, 2021 10:35 am | ||||||
David Roberson |
Okay. That makes sense. What the sample coordinates do, in the get_sample_grayscale() is add to the curve complexity, but it's just a single value as far as the execution of the script is concerned. On reversing the curve, I can think of a dozen places, now, where I've seen that reversal in use, yet it did not occur to me yesterday. I swear, it's often the simplest things that escape me! Thanks! |
|||||
Posted: May 18, 2021 3:32 pm | ||||||
James |
Here is a basic blend/lerp as a curve script:
|
|||||
Posted: June 20, 2021 9:41 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,531 Posts
+36 new in 30 days!
15,347 Topics
+72 new in year!
15 unregistered users.