From 468cb25f09842d60c53e3d055886e70453f253b7 Mon Sep 17 00:00:00 2001 From: hizzlekizzle Date: Sat, 16 Jul 2022 16:32:12 -0500 Subject: [PATCH] add Louis' shadowmask --- include/subpixel_masks.h | 41 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/include/subpixel_masks.h b/include/subpixel_masks.h index 3f509eb..d757510 100644 --- a/include/subpixel_masks.h +++ b/include/subpixel_masks.h @@ -10,7 +10,7 @@ How to use it: Multiply your image by the vec3 output: FragColor.rgb *= mask_weights(gl_FragCoord.xy, 1.0, 1); -In the vec3 version, the alpha channel stores the number of lit subpixels per pixel for use in brightness-loss compensation efforts. +In the "alpha" version, the alpha channel stores the number of lit subpixels per pixel for use in brightness-loss compensation efforts. The function needs to be tiled across the screen using the physical pixels, e.g. gl_FragCoord (the "vec2 coord" input). In the case of slang shaders, we use @@ -21,7 +21,7 @@ effect should be. Full-strength red, green and blue subpixels on a white pixel are the ideal, and are achieved with an intensity of 1.0, though this darkens the image significantly and may not always be desirable. -The "phosphor_layout" (int value between 0 and 19) determines which phophor +The "phosphor_layout" (int value between 0 and 24) determines which phophor layout to apply. 0 is no mask/passthru. Many of these mask arrays are adapted from cgwg's crt-geom-deluxe LUTs, and @@ -342,6 +342,24 @@ vec3 mask_weights(vec2 coord, float mask_intensity, int phosphor_layout){ weights = bw4[z]; return weights; } + + else if(phosphor_layout == 24){ + // shadowmask courtesy of Louis. Suitable for lower TVL on high-res 4K+ screens + vec3 shadow[6][10] = { + {green, cyan, blue, blue, blue, red, red, red, yellow, green}, + {green, cyan, blue, blue, blue, red, red, red, yellow, green}, + {green, cyan, blue, blue, blue, red, red, red, yellow, green}, + {red, red, red, yellow, green, green, cyan, blue, blue, blue}, + {red, red, red, yellow, green, green, cyan, blue, blue, blue}, + {red, red, red, yellow, green, green, cyan, blue, blue, blue}, + }; + + w = int(floor(mod(coord.y, 6.0))); + z = int(floor(mod(coord.x, 10.0))); + + weights = shadow[w][z]; + return weights; + } else return weights; } @@ -684,6 +702,25 @@ vec3 mask_weights_alpha(vec2 coord, float mask_intensity, int phosphor_layout, o alpha = 0.5; return weights; } + + else if(phosphor_layout == 24){ + // shadowmask courtesy of Louis. Suitable for lower TVL on high-res 4K+ screens + vec3 shadow[6][10] = { + {green, cyan, blue, blue, blue, red, red, red, yellow, green}, + {green, cyan, blue, blue, blue, red, red, red, yellow, green}, + {green, cyan, blue, blue, blue, red, red, red, yellow, green}, + {red, red, red, yellow, green, green, cyan, blue, blue, blue}, + {red, red, red, yellow, green, green, cyan, blue, blue, blue}, + {red, red, red, yellow, green, green, cyan, blue, blue, blue}, + }; + + w = int(floor(mod(coord.y, 6.0))); + z = int(floor(mod(coord.x, 10.0))); + + weights = shadow[w][z]; + alpha = 72./180.; + return weights; + } else return weights; }