Jump to content

Min/Max Point Velocity


Recommended Posts

Hi there,

So I'm trying to fit the point velocity attribute range from 0-1.
In my test scene, I have a simple RBD sphere shooting upwards and slowly slows down once landed.
I'm using the length of velocity, promote it to detail attribute with min and max v and imported the detail attributes in a second wrangler where I fit it in an attribute called @speed, the issue is instead of @speed going from 0-1, it always starts at 0.5? Or is my setup wrong?

Thanks.

*hip file attached*

min_max_v.hip

Link to comment
Share on other sites

Every point has the same velocity initially and therefore the min and max are the same, which makes every value get remapped to 0.5 (the middle of your output range).

After frame 1050, when the sphere hits the floor, each point has a different velocity and @speed is in the range 0-1.

If you instead want the minimum and maximum velocity across the whole timeline, you'll need to use a solver (there might be other methods but a solver is the most simple).

Link to comment
Share on other sites

Hey there, 

Yeah, the initial start of the sim, their min/max is the same. 

I'll try with the solver method and see how it goes. What about if I just force map the point velocity as such?

f@speed  = fit(length(@v), chf('min_speed'), chf('max_speed'), 1, 0);


Cheers

 

Link to comment
Share on other sites

That would definitely work, but it might result in @speed not being mapped correctly to a 0-1 range if you can't find the exact minimum and maximum velocities across the timeline. Plus if you update the RBD sim those values will change and you'll have to update them manually.

In case you haven't got the solver working, here's a couple of ways to find the max and min over the whole timeline:

min_max_v.hipnc

  • Like 1
Link to comment
Share on other sites

Yeah, I know the mapped range won't be accurate.

Initial approach was to calculate the @speed attribute so can use it downstream for emitting or shading purposes.

Interesting approach using the for-each-loop. Probably gonna use go with the solver approach.

Cheers mate.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...