Skip to content

Instantly share code, notes, and snippets.

@pingpoli
Created July 13, 2020 20:46
Show Gist options
  • Save pingpoli/2c965d29713d110de5f2a7fdbeaf3e2f to your computer and use it in GitHub Desktop.
Save pingpoli/2c965d29713d110de5f2a7fdbeaf3e2f to your computer and use it in GitHub Desktop.
#version 330 core
in vec2 uv;
uniform sampler2D sampler;
uniform float desaturationFactor;
out vec4 fragColor;
void main()
{
vec3 color = texture2D( sampler , uv ).rgb;
vec3 gray = vec3( dot( color , vec3( 0.2126 , 0.7152 , 0.0722 ) ) );
fragColor = vec4( mix( color , gray , desaturationFactor ) , 1.0 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment