第 4 课:Relative Luminance
我的解:Relative Luminance 是根据人类视觉能感受的光谱总结出来的formula
我的解
uniform vec2 iResolution;
uniform sampler2D iChannel0;
vec3 RelativeLuminance(vec3 tex){
return vec3(tex.r * 0.2126 + tex.g * 0.7152 + tex.b * 0.0722);
}
void main() {
// Normalized pixel coordinates (from 0 to 1)
vec2 uv = gl_FragCoord.xy / iResolution.xy;
vec4 tex = texture(iChannel0, uv);
gl_FragColor = vec4(RelativeLuminance(tex.rgb), 1.0);
}
复盘笔记
- Relative Luminance 是根据人类视觉能感受的光谱总结出来的formula
- L = R * 0.2126 + G * 0.7152 + B * 0.0722;