跳到主要内容
← Image Manipulation with Shaders

Image Manipulation with Shaders

Tone

图像的整体颜色氛围

实时渲染 · 纹理 GLSL

第 5 课:Tone

实现:图像的整体颜色氛围

实现

uniform vec2 iResolution;
uniform sampler2D iChannel0;

const vec3 refColor = vec3(1.0, 0.84, 0.0) * 1.5;

vec3 RelativeLuminance(vec4 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)*refColor,1.0);
}

复盘笔记

  • 图像的整体颜色氛围
  • 它这里玩法是luminance * tint