zinogino Posted August 18, 2020 Share Posted August 18, 2020 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 Quote Link to comment Share on other sites More sharing options...
eimk Posted August 18, 2020 Share Posted August 18, 2020 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). Quote Link to comment Share on other sites More sharing options...
zinogino Posted August 18, 2020 Author Share Posted August 18, 2020 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 Quote Link to comment Share on other sites More sharing options...
eimk Posted August 18, 2020 Share Posted August 18, 2020 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 1 Quote Link to comment Share on other sites More sharing options...
zinogino Posted August 20, 2020 Author Share Posted August 20, 2020 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.