Visualization Behind "Fit Range" VOP Node !!!
5293 6 1- papon
- Member
- 34 posts
- Joined: Dec. 2018
- Offline
- CYTE
- Member
- 679 posts
- Joined: Feb. 2017
- Offline
- papon
- Member
- 34 posts
- Joined: Dec. 2018
- Offline
- tamte
- Member
- 8539 posts
- Joined: July 2007
- Offline
paponit's just math so while I'm not sure what exact math is behind houdini fit function it will be along these lines
can you elaborate the mechanics behind it ? then it might be helpful .
https://rosettacode.org/wiki/Map_range [rosettacode.org]
just note that fit() function (Fit Range VOP) returns clamped results while efit() function (Fit Range Unclamped VOP) will not clamp the results
Edited by tamte - July 22, 2019 11:09:21
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- Renji_kan
- Member
- 23 posts
- Joined: June 2021
- Offline
CYTE
Hey papon,
"fit range" takes values from one range for example from -1 to +10 and "fits" them into a new range for example 0 to 1.
So a value that used to be -1 is 0 after the operation.
Please tell me, where and how to look at the description of the FitRange nodes?
Here is a description on the site: https://www.sidefx.com/docs/houdini/nodes/vop/fit.html [www.sidefx.com]
But, I do not see a description of the Input parameters, what types they are and what the fit range node returns.
Is there such a description? or should I guess myself what the houdini developers did there?
Sidefx
- vusta
- Member
- 555 posts
- Joined: Feb. 2017
- Offline
here's a visualisation, I used VEX fit in a wrangle but it should be the same as a VOP (if you view the code in the VOP you'd see it calls vop_fit(), how you drill down further I don't know, you'd probably reach unreadable machine code)
Anyway, visually it remaps your min/max to newmin/newmax...
Adjust MinX, MaxX, NewMinX, NewMaxX and observe...try NewMinX = 4 and NewMaxX = -1 and you'll see it crosses over itself.
So here's my reverse engineering
mathematically: (it's just ratio)
x / (MaxX - MinX) = new x /(NewMaxX - NewMinX)
therefore, the fit is getting the new x value by:
new x = x * (NewMaxX - NewMinX) / (MaxX - MinX)
just my guess...don't sue me if your computer explodes.
ps: I'm quite confident on my logic as I had to write my own remap in MCG (hush....3dsMax!) and that's what I used..it worked fine I think.
Anyway, visually it remaps your min/max to newmin/newmax...
Adjust MinX, MaxX, NewMinX, NewMaxX and observe...try NewMinX = 4 and NewMaxX = -1 and you'll see it crosses over itself.
So here's my reverse engineering
mathematically: (it's just ratio)
x / (MaxX - MinX) = new x /(NewMaxX - NewMinX)
therefore, the fit is getting the new x value by:
new x = x * (NewMaxX - NewMinX) / (MaxX - MinX)
just my guess...don't sue me if your computer explodes.
ps: I'm quite confident on my logic as I had to write my own remap in MCG (hush....3dsMax!) and that's what I used..it worked fine I think.
Edited by vusta - June 13, 2021 18:13:55
- vusta
- Member
- 555 posts
- Joined: Feb. 2017
- Offline
-
- Quick Links