Jump to content

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

Share this post


Link to post
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).

Share this post


Link to post
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

 

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×