My current node setup is I'm sampling the float curve node based on the spline factor and storing it as an attribute. I wish to find the inverse as well, that is, the factor that maps to the current factor. Is this possible?
1 Answer
$\begingroup$
$\endgroup$
14
In the image below, there are three curves:
- Left: original curve, from where I'm taking the "spline factor"
- Middle: a replica of the float curve (x = original factor, y = float curve result), so, this is an
y(x)function. - Right: another replica of the float curve, but now we're sampling with the
yfactor, making it anx(y)function.
(Notice the float curve need's to be an invertible function, meaning: can't have ups AND downs... it's all up or all down)
Details explained in the nodes:
- Captured X: So, considering the original factor as X, we capture it so we can keep it independent of changes in the curve.
- Float curve y(x): here, we make a curve that has the exact shape of the float curve (x is the original factor, y is the float curve output). The offset is just for visualization.
- Straight vertical: here the magic happens. We zero the X position of this curve so it becomes a strictly vertical curve (but the Y spacings are kept) - This makes the "factor" from this curve become Y exactly (because X doesn't count to length here)
- Float curve y(x): now we redraw the float curve again (just to prove the method works), but taking the factor of the vertical curve as Y, and the original captured X as result (so you can sample the vertical curve by factor to get the original X)
Usage:
- Using any curve you like, store the float curve result (let's call it "attribute")
- Make a replica of the float curve as above
- Make the straight vertical as above
- When you want the inverse transform, "sample curve" (the vertical curve) using the "attribute" plugged into "factor" and using the captured X plugged into "value"
-
$\begingroup$ This works, brilliant solution! Thanks so much. $\endgroup$Zero G– Zero G2025-11-14 02:37:20 +00:00Commented Nov 14 at 2:37
-
$\begingroup$ Quick followup, how can I store the inverse value into a named attribute? Wouldn't connecting the "store named attribute" node after the sample curve just store based on its current factor and not the captured factor? $\endgroup$Zero G– Zero G2025-11-14 03:28:03 +00:00Commented Nov 14 at 3:28
-
$\begingroup$ @ZeroG, that wouldn't make sense, the inverse value is the original factor itself. $\endgroup$Daniel Möller– Daniel Möller2025-11-14 03:48:25 +00:00Commented Nov 14 at 3:48
-
$\begingroup$ But "Capture Attribute" and "Store Named Attribute" are nodes that do exactly the same thing (but one has a name). So maybe you want to replace the capture with a store? $\endgroup$Daniel Möller– Daniel Möller2025-11-14 03:52:11 +00:00Commented Nov 14 at 3:52
-
$\begingroup$ I'm on my phone, so I didn't test and could be missing something... Ignoring the presentation purposes, i.e. if we remove join geo, first set pos sets x which is immediately nullified in next set pos without any capturing in between. So you could just set x=0 in the 1st set pos and dissolve the 2nd. Moreover, in 3rd set pos you're using factor to read the y pos inside float curve node but you're assuming it starts with 0 and ends with 1, as that's the factor range. You'd support other curves if you used y pos instead. And while calculating factor yourself would be slightly busier... $\endgroup$Markus von Broady– Markus von Broady2025-11-14 08:50:39 +00:00Commented Nov 14 at 8:50

