mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-25 00:51:29 +11:00
add Louis' shadowmask
This commit is contained in:
parent
4577d4a4d0
commit
468cb25f09
|
@ -10,7 +10,7 @@ How to use it:
|
||||||
Multiply your image by the vec3 output:
|
Multiply your image by the vec3 output:
|
||||||
FragColor.rgb *= mask_weights(gl_FragCoord.xy, 1.0, 1);
|
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.
|
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
|
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
|
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 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.
|
layout to apply. 0 is no mask/passthru.
|
||||||
|
|
||||||
Many of these mask arrays are adapted from cgwg's crt-geom-deluxe LUTs, and
|
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];
|
weights = bw4[z];
|
||||||
return weights;
|
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;
|
else return weights;
|
||||||
}
|
}
|
||||||
|
@ -684,6 +702,25 @@ vec3 mask_weights_alpha(vec2 coord, float mask_intensity, int phosphor_layout, o
|
||||||
alpha = 0.5;
|
alpha = 0.5;
|
||||||
return weights;
|
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;
|
else return weights;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue