Skip to content

Instantly share code, notes, and snippets.

@yearofthewhopper
Created February 24, 2020 17:00
Show Gist options
  • Save yearofthewhopper/12f45f90382afd1b12dcabb329a1f7b8 to your computer and use it in GitHub Desktop.
Save yearofthewhopper/12f45f90382afd1b12dcabb329a1f7b8 to your computer and use it in GitHub Desktop.
void main() {
vec4 textureColor = texture2D(sTexture, vTextureCoord);
vec3 fragRGB = textureColor.rgb;
vec3 fragHSV = rgb2hsv(fragRGB);
float h = vHSV.x / 360.0;
fragHSV.x *= h;
fragHSV.yz *= vHSV.yz;
fragHSV.x = mod(fragHSV.x, 1.0);
fragHSV.y = mod(fragHSV.y, 1.0);
fragHSV.z = mod(fragHSV.z, 1.0);
fragRGB = hsv2rgb(fragHSV);
gl_FragColor = vec4(hsv2rgb(fragHSV), textureColor.w);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment