Lag in Solver with Vex

   1981   5   0
User Avatar
Member
5 posts
Joined: June 2017
Offline
Anyone know if its possible to do something like what the Lag chop does, but to do it in a solver using VEX Wrangle. I'm looking to Lag millions and millions of point positions and I think it might break chops to do that many channels per point.
User Avatar
Member
5 posts
Joined: June 2017
Offline
float dist;
vector newPos = point(1,“P”,@ptnum);
vector direction = newPos - @P;
float mag = abs(distance(@P,newPos));

something like this:
query the previous and the current frame. Now that we have the “mag” distance the point has moved between the previous frame and the current frame we should be able to do something with it to determine if the point has moved too far. If the point has moved too far, move the newPos by factor X along the direction. This should move the point closer back to the original position, maybe in a similar way that lag works.

I'm like 90% there, I just need help getting over that last hump bump. How to use the distance to do that last part?
User Avatar
Member
280 posts
Joined:
Offline
why not use pop speed limit?or pop drag?
Edited by patar - Aug. 19, 2017 01:45:35
User Avatar
Member
1750 posts
Joined: May 2006
Online
I dig Patar's method, pops gives you a whole toolkit to play with, and should scale pretty well. Worked up a little test with a pop steerseek and pop drag, with added bonus of some noise to make different parts of the mesh lag at different rates.

Attachments:
lag_via_pops.hip (386.0 KB)

http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
5 posts
Joined: June 2017
Offline
Thanks! Great example I learned a lot.

If I wanted the points to 100% follow their goal, it seems like just disabling the popdrag would do it, but its creating some odd results. I think because the steerseek is using “force” not “velocity” after the point position is updated for the frame in the solver, there is residual force from the current frame to the next frame?

Maybe some kind of wrangle to kill the force or velocity after the point has been updated?
User Avatar
Member
5 posts
Joined: June 2017
Offline
One way to make the points follow 100% is to just set it with a pop wrangle

@P = point(0,“P”,@ptnum);

and a more manual way to do something similar to the steerseek in the pop wrangle;

@force = (point(0,“P”,@ptnum)- @P );
or
@v = (point(0,“P”,@ptnum)- @P );

More or less subtracting the current position from the new position to get the vector between them and then apply the force/velocity to the particle to move in that direction. Although in the steer seek force it looks like there is a nice breaking force so as you get closer it can scale the force down so not to overshoot the target.

Its a pretty complex problem to think about how the pop solver is going to deal with @v and @force and all the other factors of physics, mostly exuding mass at the moment.

Cool stuff!
Edited by bradonwebb - Aug. 19, 2017 12:29:00
  • Quick Links