跳到主要内容
← Built-In functions

Built-In functions

max

![[Pasted image 20250510120408.png]]

实时渲染 · 2D 片段 GLSL

第 16 课:max

我的解:![[Pasted image 20250510120408.png]]

我的解

uniform vec2 iResolution;

void main() {
  // Normalized pixel coordinates (from 0 to 1)
  vec2 uv = gl_FragCoord.xy / iResolution.xy;
  float steppedValue1 = step(0.75,uv.x);
  float steppedValue2 = 1.0-step(0.25,uv.x);
  vec3 color = vec3(1.0, 0.3, 0.3);
  gl_FragColor = vec4(color*(steppedValue2+steppedValue1), 1);
}

复盘笔记

  • ![[Pasted image 20250510120408.png]]