From fe7667a00c92eca2089d1b8058123eb452443e51 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Fri, 6 Mar 2020 17:37:47 +0200 Subject: [PATCH] Add drop shadows to the Monochrome LCD shader --- Shaders/MonoLCD.fsh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Shaders/MonoLCD.fsh b/Shaders/MonoLCD.fsh index 1a641af..009e1db 100644 --- a/Shaders/MonoLCD.fsh +++ b/Shaders/MonoLCD.fsh @@ -34,5 +34,17 @@ STATIC vec4 scale(sampler2D image, vec2 position, vec2 input_resolution, vec2 ou multiplier *= (1.0 - sub_pos.x) * SCANLINE_DEPTH + (1 - SCANLINE_DEPTH); } - return mix(texture(image, position) * multiplier, mix(r1, r2, s.y), BLOOM); + vec4 pre_shadow = mix(texture(image, position) * multiplier, mix(r1, r2, s.y), BLOOM); + pixel += vec2(-0.6, -0.8); + + q11 = texture(image, (floor(pixel) + 0.5) / input_resolution); + q12 = texture(image, (vec2(floor(pixel.x), ceil(pixel.y)) + 0.5) / input_resolution); + q21 = texture(image, (vec2(ceil(pixel.x), floor(pixel.y)) + 0.5) / input_resolution); + q22 = texture(image, (ceil(pixel) + 0.5) / input_resolution); + + r1 = mix(q11, q21, fract(pixel.x)); + r2 = mix(q12, q22, fract(pixel.x)); + + vec4 shadow = mix(r1, r2, fract(pixel.y)); + return mix(min(shadow, pre_shadow), pre_shadow, 0.75); }