Skip to content

Commit 5752416

Browse files
author
Greger Olsson
committed
Added simple 'TFT effect' shader
1 parent f2fef0b commit 5752416

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tft.glsl

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/** Size of TFT "pixels" */
2+
float resolution = 4.0;
3+
4+
/** Strength of effect */
5+
float strength = 0.5;
6+
7+
void _scanline(inout vec3 color, vec2 uv)
8+
{
9+
float scanline = step(1.2, mod(uv.y * iResolution.y, resolution));
10+
float grille = step(1.2, mod(uv.x * iResolution.x, resolution));
11+
color *= max(1.0 - strength, scanline * grille);
12+
}
13+
14+
void mainImage(out vec4 fragColor, in vec2 fragCoord)
15+
{
16+
vec2 uv = fragCoord.xy / iResolution.xy;
17+
vec3 color = texture(iChannel0, uv).rgb;
18+
19+
_scanline(color, uv);
20+
21+
fragColor.xyz = color;
22+
fragColor.w = 1.0;
23+
}

0 commit comments

Comments
 (0)