lazza79 Posted August 22, 2017 Share Posted August 22, 2017 Hi Guys, I am trying to solve a small problem but I can't figure it out precisely. I want to use a Solver SOP in order to have a color decay effect. Let's say I decide that the color decays 15% each frame, so I put @Cd.x *= 0.85: in my wrangle The problem happens if I increase the number of substeps to 2 or 4, in that case, obviously, the decay rate of 15% will be each interaction and not each frame. Could you please help me with this? In the attached image, I use a random to decide how much to decrease the color of the point, based on @dist attribute... Cheers! Andrea Quote Link to comment Share on other sites More sharing options...
jamesr Posted August 22, 2017 Share Posted August 22, 2017 You need to multiply decal_val * @TimeInc to make sure that substeps are being taken into account, or else it will evaluate that every timestep and will decay much faster the more substeps you add. Quote Link to comment Share on other sites More sharing options...
lazza79 Posted August 22, 2017 Author Share Posted August 22, 2017 Thank you! I think I did something wrong because I tried that but I couldn't see the effect. I'll have a go again! Cheers! Andrea Quote Link to comment Share on other sites More sharing options...
jamesr Posted August 22, 2017 Share Posted August 22, 2017 (edited) should be on that last line @Cd.x *= decay_val * @TimeInc; EDIT: seems like I wasn't paying attention 4 years ago. That's definitely wrong if you're trying to decay something by multiplying (it'd be okay if you were subtracting & clamping). Instead try something like v@Cd.x = max(0, v@Cd.x - (chf("decay")* f@Timeinc)); or maybe float decay_rate = 0.2; v@Cd.x *= pow(decay_rate, f@Timeinc); decay.hiplc Edited August 23, 2021 by jamesr incorrect reply. add hip file Quote Link to comment Share on other sites More sharing options...
Pazuzu Posted August 23, 2017 Share Posted August 23, 2017 (edited) I think doing this is not correct @Cd.x *= decay_val * @TimeInc; Do the math and you will have almost no value to work with; Its better that you subtract and apply a maximum or a clamp after the decay. Edited August 23, 2017 by Pazuzu 1 Quote Link to comment Share on other sites More sharing options...
lazza79 Posted August 23, 2017 Author Share Posted August 23, 2017 Yes, that is what I experienced. I will try now to find the complement of the decay (1-0.85 = 0.15) and multiply that for the @TimeInc. But I am not sure this will work... 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.