Access Ramp Parameters in Vexpression (POP's)

   3750   2   0
User Avatar
Member
166 posts
Joined: Feb. 2014
Offline
I'd like to be able to use a ramp to control parameters in Vexpressions (mainly to control particles).

I've added a Spline Ramp to my node interface but I'm unsure of how to access it properly.

So in the screenshot/attached HIP I'm trying to get the force to push up/down/up.

Any help appreciated

Attachments:
Access Ramp.hiplc (212.0 KB)
Screen Shot 2015-06-17 at 10.08.05.jpg (89.6 KB)

http://simonfarussell.com [simonfarussell.com]
User Avatar
Member
166 posts
Joined: Feb. 2014
Offline
Someone from the Twitter helped me out:

float updown = fit01(chramp(“grad”,@nage,0), -5,5);
force = set(0, updown, 0);

or

float ramp = fit01(chramp(“grad”,@nage,0),-5,5);
force.y += ramp;

For some reason I thought you declared a float with f@xxx, no idea why…
http://simonfarussell.com [simonfarussell.com]
User Avatar
Member
5247 posts
Joined: Feb. 2012
Offline
Simon Russell
Someone from the Twitter helped me out:

float updown = fit01(chramp(“grad”,@nage,0), -5,5);
force = set(0, updown, 0);

or

float ramp = fit01(chramp(“grad”,@nage,0),-5,5);
force.y += ramp;

For some reason I thought you declared a float with f@xxx, no idea why…

IMO it's not a good practice to do that. It's better to use local variables and in the end only export/set the ones you want to export/set as an attribute with the @ syntax. Otherwise you will end up with a lot of unnecessary attributes.

One exception is if you want to declare and set the value in the same line, then using @ is acceptable IMO.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
  • Quick Links