Optimizing the shader: when to replace If statements by a Lerp?

If you are changing the value of that float at runtime, then it needs to be how it is (or an IF)… but if you are pre-setting the value in a material instance and then never changing it at runtime, it is a perfect candidate to replace with a Static Switch. In that case you either use a “Static Switch Parameter”. and that node IS the bool that shows up in material instances… then you just hook up true/false… or you can use a “Static Switch” and use a “staticboolparameter”. They both do the same thing but the latter allows the switches to be inside material functions and the bools to be parameters in your material.