Need an attribute wrangle vex

   735   5   1
User Avatar
Member
3 posts
Joined: 11月 2023
Offline
Hi everyone hope your doing great.

I have a group which has an expresion that over time some of them randomly being selected.

after that i need to scale down each point in group that are selected to be zero. but not rightaway

i want to scale them down over some frames mybe 10 or 20 or...


so this piece of wrangle works:

if (inpointgroup(0, "mygroup", @ptnum))
{
@pscale *= 0;
}

but it's not what i want. i want to have control over the frame range i need the selected points be scale down

please let me know what is the best way to do it
thank you
User Avatar
Member
4515 posts
Joined: 2月 2012
Offline
Hi,

You can write something like this:

float s = fit ( @Frame, 10, 20, 1, 0 );
@pscale = s;
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 | animatrix2k7.gumroad.com
User Avatar
Member
3 posts
Joined: 11月 2023
Offline
animatrix_
Hi,

You can write something like this:

float s = fit ( @Frame, 10, 20, 1, 0 );
@pscale = s;


Hi Man Thanks a lot
It kinda works


you see the points will scale down by that frame range alright, but after that all the points scale down to zero.

I guess I need to store the points, when they are selected and when a point in frame 39 for example gets select, then from that frame that point should start to scale down to zero

how to achive that?
User Avatar
Member
393 posts
Joined: 11月 2016
Offline
Either you rewrite your expression to somehow be able to access the first frame your points enter the group. Then you can subtract that value from the current frame and use the result in a fit function as suggested.

Or you use a solver [www.sidefx.com].
Edited by Tanto - 2024年1月10日 13:34:32
User Avatar
Member
4515 posts
Joined: 2月 2012
Offline
rain.man2294
animatrix_
Hi,

You can write something like this:

float s = fit ( @Frame, 10, 20, 1, 0 );
@pscale = s;


Hi Man Thanks a lot
It kinda works


you see the points will scale down by that frame range alright, but after that all the points scale down to zero.

I guess I need to store the points, when they are selected and when a point in frame 39 for example gets select, then from that frame that point should start to scale down to zero

how to achive that?

It depends on your selection logic. If you can determine it ahead of time, you can check for that in code. Otherwise the easiest way is to use the Solver SOP as Tanto said.
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 | animatrix2k7.gumroad.com
User Avatar
Member
3 posts
Joined: 11月 2023
Offline
Thank you guys,

I couldn't figur it out with solver but I manage to do it with this peace of code:


float start_frame = fit01(rand(@ptnum), $FSTART, $END);
float duration = 2.0;

float pscale = fit(@Frame, start_frame, start_frame + duration, 1, 0);
@pscale *= pscale;

works pretty good.

but the group random selection had to be removed which was ok for me
  • Quick Links