Hi,
This image basically describes my issue: https://imgur.com/nGpEOdh [imgur.com]
I'm trying to do what I thought was a very simple thing: remapping the stiffness of a vellum constraint based on the Y of the bounding box of the object (using the attribadjustfloat); in this case this spring needs to be stiffer at the bottom and less stiff at the top. I need the stiffness range to be in the realm of/between 0.000001 and 1000000, as vellum usually goes...
I tried putting those values in, both through attributeadjustfloat directly, and through an additional remap node (as seen in the image above), but Houdini sets the minimum value on only the first 2 prims, and then skips over to a random value that is x10000 larger than the first two, and continues remapping properly.
Feels like I'm missing sort of resolution or something for the remapping to work, but I am stuck here, any help is appreciated.
Struggling with remapping attribs with large ranges?
421 4 0- chilby
- Member
- 11 posts
- Joined: Oct. 2021
- Offline
- tamte
- Member
- 8554 posts
- Joined: July 2007
- Offline
chilbyIts just a matter of how you think about those values
I need the stiffness range to be in the realm of/between 0.000001 and 1000000, as vellum usually goes...
You may ask yourself, which number is half way between those 2 numbers?
Is it 500000? Or is it 1?
What you'd get using attribremap is 500000 as that's linearly half way between those numbers
As well as in your picture your individual steps are roughly 787, so nothing wrong with the values you are getting
However you are expecting 1 to be in the middle since you are thinking about that range logarithmically as thats what they represent for stiffness, so in that case you need to also interpolate it logarithmically
So interpolate your exponent rather than the value itself
This is purely based on your screenshot values, which are a bit different from what you described, but you can adjust the exponents or source attrib or range as needed:
float exp = fit( @stiffness, 1.0078, 1.99906, -4, 5); f@stiffness = pow(10, exp);
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- Soothsayer
- Member
- 859 posts
- Joined: Oct. 2008
- Offline
- chilby
- Member
- 11 posts
- Joined: Oct. 2021
- Offline
- tamte
- Member
- 8554 posts
- Joined: July 2007
- Offline
Soothsayer
In those cases I like to remap like so:with f being a log parm and the scaling constant being for convenience.@att = exp(-@att*a_scaling_constant*ch('f'));
if you just want to scale, you may want to use the official function that Vellum uses:
#include <pbd_constraints.h> f@stiffness = logscaleStiffness( chf("scale"), f@stiffness );
Edited by tamte - Feb. 29, 2024 02:41:58
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
-
- Quick Links