Using @ptnum & npoints() to "softly" apply noise

   2070   4   0
User Avatar
Member
6 posts
Joined: Dec. 2015
Offline
Hi, im new to Houdini and still learning the basics,
im trying to apply a noise to points of a line, the thing is that i want to apply them "softly" as in, the further the point is from the base the stronger the noise will be.

im trying to use the "attribute noise" node and in the amplitude im writing:
fit01(@ptnum, 0, npoints("../line1")) * 0.15

but nothing is happening, the amplitude stays at 0 for all points

i've also tried
@ptnum / npoints("../line1") * 0.15
but it didnt work as well

can any one help and tell me what am i doing wrong? and how to fix this
User Avatar
Member
4731 posts
Joined: Feb. 2012
Offline
Hi,

You can't write real VEX code inside parameters. Easiest way is to do it using a Point Wrangle to blend the result between the original and noised version:

float blend = relbbox ( @P ).x;

@P = lerp ( @P, @opinput1_P, blend );

Edited by animatrix_ - Sept. 4, 2021 23:27:36
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
6 posts
Joined: Dec. 2015
Offline
thanks!

would love to know what's wrong with this line though,

fit01(@ptnum, 0, npoints("../line1")) * 0.15

so i can learn for next time
User Avatar
Member
4731 posts
Joined: Feb. 2012
Offline
I can point out the issues in that line but even if you fixed those, it still wouldn't work

Because you can't use actual VEX code in parameters like that. You can use either Python or hscript expressions.

Alternatively some nodes allow writing actual VEX code to override node parameters in which case it will have a toggle like "Use VEXpression".
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com]

youtube.com/@pragmaticvfx | patreon.com/animatrix | pragmaticvfx.gumroad.com
User Avatar
Member
6 posts
Joined: Dec. 2015
Offline
thanks so much man!!
  • Quick Links