11 lines
408 B
GLSL
11 lines
408 B
GLSL
// Values obtained from: http://en.wikipedia.org/wiki/Grayscale#Luma_coding_in_video_systems
|
|
vec3 LumaFactors = vec3(0.299, 0.587, 0.114);
|
|
|
|
void windowShader(inout vec4 color) {
|
|
// average brightness
|
|
float luma = dot(vec3(color.r, color.g, color.b), LumaFactors);
|
|
|
|
float blend = smoothstep(0.0, 1.0, color.r - color.g);
|
|
color.rgb = mix(vec3(color.r, luma, luma), vec3(luma, color.g, luma), blend);
|
|
}
|