Advertisement
copyrat90

scanline_gray_white_shader

Dec 10th, 2022 (edited)
2,859
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #version 300 es
  2. precision highp float;
  3.  
  4. out vec4 fragColor;
  5.  
  6. uniform sampler2D u_postEffectRequired;
  7. uniform vec2 u_internalResolution;
  8.  
  9. void main() {
  10.     // gl_FragCoord를 0 ~ 1 범위로 정규화해 UV 좌표 계산
  11.     vec2 uv = gl_FragCoord.xy / u_internalResolution;
  12.  
  13.     // 이번 프래그먼트의 Y좌표가 짝수인가?
  14.     bool isYCoordEven = mod(gl_FragCoord.y - 0.5, 2.) < 0.01;
  15.  
  16.     // Y좌표 짝수이면 회색, 홀수이면 흰색으로 색칠
  17.     vec4 gray = vec4(0.5, 0.5, 0.5, 1);
  18.     vec4 white = vec4(1, 1, 1, 1);
  19.     fragColor = (isYCoordEven ? gray : white) * texture(u_postEffectRequired, uv);
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement