Wednesday 26 July 2017

Houdini function: fit

I've recently started familiarizing with Houdini and came across the fit function.
To be more accurate I met it in the VOP context, so we'll look at it with its VOP node costume on but under the hood it's all the same the VEX function.

Here's how the fit parameters look inside the VOP:


Note that if you promote the parameters (= expose them so they can be editable outside the VOP network), the parameters are named differently:




I started fiddling with the sliders but wasn't entirely sure what the values were doing. Sure my density looked more or less dense but that's not mathematical enough to be entirely sure how it works.

Of course I looked up the node's documentation but
This operator takes the value in the source range (srcmin, srcmax) and shifts it to the corresponding value in the destination range (destmin, destmax).
was not quite enough for my non-mathematical brain to truly get it. I need a visual representation of maths to understand them.


So I started fresh with a uniform volume, tested different inputs in the Fit range node with different density values in my volume and represented the results in a way that was fathomable for me: sketches.

This is what my base input looks like:

I'm using a 0 to 1 range to make it clear and simple but of course your range could be completely different.
We'll assume our current value is 0.5 and we'll see what that value becomes after modifying the different inputs the fit range offers.
Note that we're using the clamped fit range, there's also an unclamped version.




Source min (Minimum value in source range)
The value you enter becomes your new 0, therefore all the info between 0 and your input is discarded.


Source max (Maximum value in source range)
The value you enter becomes your new 1, therefore all the info between your input and 1 is discarded.


Destination min (Minimum value in destination range)
0 becomes your new value.
The original range is not affected, no data is lost.



Destination max (Maximum value in destination range)
1 becomes your new value.
The original range is not affected, no data is lost.



If you're familiar with this blog (as if…) this setup might ring a bell. Yup, just the same as what I described here: http://mklvfx.blogspot.fr/2014/02/fade-close-to-camera.html
Same tricks everywhere.




2 comments:

  1. I need to start paying more attention to Houdini.. :)

    ReplyDelete
  2. What a well written and compassionate article. I found your ideas and wisdom encouraging and helpful. https://www.magicare.com/collections/masks

    ReplyDelete