Created
July 9, 2020 15:16
-
-
Save pingpoli/0fc01f3aa38a12f148ce0e4ecbb46a21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 330 core | |
uniform float threshold; | |
uniform float strength; | |
uniform sampler2D colorTexture; | |
in vec2 uv; | |
out vec4 fragColor; | |
void main() | |
{ | |
vec4 color = texture2D( colorTexture , uv ); | |
// convert rgb to grayscale/brightness | |
float brightness = dot( color.rgb , vec3( 0.2126 , 0.7152 , 0.0722 ) ); | |
if ( brightness > threshold ) fragColor = vec4( strength * color.rgb , 1.0 ); | |
else fragColor = vec4( 0.0 , 0.0 , 0.0 , 1.0 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment