跳到主要内容
← Built-In functions

Built-In functions

Mix - Bilinear Interpolation

简单

实时渲染 · 2D 片段 GLSL

第 23 课:Mix - Bilinear Interpolation

我的解:简单

我的解

uniform vec2 iResolution;

void main() {
  // Normalized pixel coordinates (from 0 to 1)
  vec2 uv = gl_FragCoord.xy / iResolution.xy;

  vec3 red = vec3(1.0, 0.0, 0.0);
  vec3 black = vec3(0.0, 0.0, 0.0);
  vec3 blue = vec3(0.0, 0.0, 1.0);
  vec3 green = vec3(0.0, 1.0, 0.0);

  vec3 hMix1 = mix(blue,green,uv.x);
  vec3 hMix2 = mix(red,black,uv.x);
  vec3 vMix = mix(hMix2,hMix1,uv.y);

  gl_FragColor = vec4(vMix, 1.0);
}

复盘笔记

  • 简单