跳到主要内容
← Image Manipulation with Shaders

Image Manipulation with Shaders

Brightness

mix 本质上是线性插值函数

实时渲染 · 纹理 GLSL

第 3 课:Brightness

我的解:mix 本质上是线性插值函数

我的解

uniform vec2 iResolution;
uniform sampler2D iChannel0;

void main() {
  // Normalized pixel coordinates (from 0 to 1)
  vec2 uv = gl_FragCoord.xy / iResolution.xy;
  vec3 texColor = texture(iChannel0, uv).rgb;

  gl_FragColor = clamp(vec4(texColor*4.0, 1.0),0.0,1.0);
}

复盘笔记

  • mix 本质上是线性插值函数
  • a * (1-t) + b * (t)
  • brightness = distance(color, vec3(0.0));