Any efficient way to lerp between two hues?

behealed 7 years ago 0

Is there a way to lerp between hues (or any other "looping" type of number), where it will roll over correctly when the number reaches it's highest or lowest allowed value?

I see a function in shader forge to rotate a UV, and I suppose I'm looking for something similar, but which works on a regular float instead of a float2, to rotate the number in a loop between 0 and 1, or from 0 to 360, etc.

In my particular case, I'm simply trying to get the half way point between two hues. I'm converting two colors using the "RGB to HSV" nodes. Then, I want to create a new color that has a hue that's half way between. So I need to lerp 50% between those two hues, but obviously it has to handle the fact that those hues are circular like a circle.

Any easy way to do this in shader forge without a boat load of conditional statements?