Changing sin frequency smoothly in shader In my vertex shader I am using a sin function to offset vertices. But as I change the frequency of my sin function I notice some "flickering" or "jumps". I guess that this comes from the fact that the phase is not synchronised any more.

float s = sin(frequency * _Time);


Is there a way to avoid those flickering effect while changing the frequency ?
You could go the calculus way and have an explicit rate of change that is outside your shader

float frequency = getFrequency();
sineTime += frequency * deltaTime;


(sineTime could be a float that is scoped right outside of your render loop, so that it retains its value)

And if you pass sineTime into your shader you can just do

float s = sin(sineTime);