A quick write-up today because I learnt about some really short IF statements that you can write into your shader code! They can be shortened and look confusing at first but once you understand it, they are quite straight forward.

// colour = If _Value is greater than 0.5, set to 1, else set to 0
float colour = _Value > 0.5 ? 1 : 0;

We can look at it like this in English:

_Value is more than 0.5, right? Yes, make colour 1, or no, make colour 0;”

I have read that conditionals and IF/else statements in a shader can be quite performance heavy, as they need to calculate both sides of the branch and discard the unused side. This being said, I have also read about removing IF statements, by replacing them with lerps and step functions, actually increasing the time it takes to render! So who knows..? I certainly don’t at this stage!

Here I setup the _Value as a material property slider to you can see how the output changes based on its value: