# Solver SOP and substeps

## Recommended Posts

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.
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

##### Share on other sites

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.

##### Share on other sites

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

##### Share on other sites

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 by jamesr
##### Share on other sites

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 by Pazuzu
##### Share on other sites

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...

## 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.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×