Skip to content

Instantly share code, notes, and snippets.

@keijiro
Created October 31, 2017 06:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keijiro/f4458a5dcfde5282aec646614f85936c to your computer and use it in GitHub Desktop.
Save keijiro/f4458a5dcfde5282aec646614f85936c to your computer and use it in GitHub Desktop.
half3 Hue2RGB(half h)
{
h = frac(saturate(h)) * 6 - 2;
half3 rgb = saturate(half3(abs(h - 1) - 1, 2 - abs(h), 2 - abs(h - 2)));
#ifndef UNITY_COLORSPACE_GAMMA
rgb = GammaToLinearSpace(rgb);
#endif
return rgb;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment