mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-22 15:51:30 +11:00
Merge pull request #180 from Tatsuya79/patch-1
parameterize ntsc-tate as ntsc-adaptive was
This commit is contained in:
commit
123c67303c
|
@ -10,35 +10,54 @@ layout(std140, set = 0, binding = 0) uniform UBO
|
|||
vec4 OriginalSize;
|
||||
vec4 SourceSize;
|
||||
uint FrameCount;
|
||||
float quality, bw;
|
||||
float quality, ntsc_sat, cust_fringing, cust_artifacting, ntsc_bright;
|
||||
} global;
|
||||
|
||||
#pragma parameter quality "Quality (Composite = 0, Svideo = 1)" 0.0 0.0 1.0 1.0
|
||||
#pragma parameter bw "Black and White" 0.0 0.0 1.0 1.0
|
||||
#pragma parameter quality "Presets (Svideo=0 Composite=1 RF=2 Custom=-1)" 0.0 -1.0 2.0 1.0
|
||||
#pragma parameter ntsc_sat "Color Saturation" 1.0 0.0 2.0 0.01
|
||||
#pragma parameter ntsc_bright "Brightness" 1.0 0.0 1.5 0.01
|
||||
#pragma parameter cust_fringing "Custom Fringing Value" 0.0 0.0 5.0 0.1
|
||||
#pragma parameter cust_artifacting "Custom Artifacting Value" 0.0 0.0 5.0 0.1
|
||||
|
||||
#define PI 3.14159265
|
||||
|
||||
#pragma stage vertex
|
||||
layout(location = 0) in vec4 Position;
|
||||
layout(location = 1) in vec2 TexCoord;
|
||||
layout(location = 0) out vec2 vTexCoord;
|
||||
layout(location = 1) out vec2 pix_no;
|
||||
layout(location = 2) out float phase;
|
||||
layout(location = 3) out float BRIGHTNESS;
|
||||
layout(location = 4) out float SATURATION;
|
||||
layout(location = 5) out float FRINGING;
|
||||
layout(location = 6) out float ARTIFACTING;
|
||||
layout(location = 7) out float CHROMA_MOD_FREQ;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = global.MVP * Position;
|
||||
vTexCoord = TexCoord;
|
||||
pix_no = TexCoord * global.SourceSize.xy * (global.OutputSize.xy / global.SourceSize.xy);
|
||||
phase = (global.OriginalSize.x > 300.0) ? 2.0 : 3.0;
|
||||
CHROMA_MOD_FREQ = (phase < 2.5) ? (4.0 * PI / 15.0) : (PI / 3.0);
|
||||
ARTIFACTING = (global.quality > -0.5) ? global.quality : global.cust_artifacting;
|
||||
FRINGING = (global.quality > -0.5) ? global.quality : global.cust_fringing;
|
||||
SATURATION = global.ntsc_sat;
|
||||
BRIGHTNESS = global.ntsc_bright;
|
||||
}
|
||||
|
||||
#pragma stage fragment
|
||||
layout(location = 0) in vec2 vTexCoord;
|
||||
layout(location = 1) in vec2 pix_no;
|
||||
layout(location = 2) in float phase;
|
||||
layout(location = 3) in float BRIGHTNESS;
|
||||
layout(location = 4) in float SATURATION;
|
||||
layout(location = 5) in float FRINGING;
|
||||
layout(location = 6) in float ARTIFACTING;
|
||||
layout(location = 7) in float CHROMA_MOD_FREQ;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||
|
||||
#define PI 3.14159265
|
||||
float phase = (global.OriginalSize.y > 300.0) ? 2.0 : 3.0;
|
||||
|
||||
|
||||
#define mix_mat mat3(BRIGHTNESS, FRINGING, FRINGING, ARTIFACTING, 2.0 * SATURATION, 0.0, ARTIFACTING, 0.0, 2.0 * SATURATION)
|
||||
|
||||
const mat3 yiq2rgb_mat = mat3(
|
||||
|
@ -64,12 +83,6 @@ vec3 rgb2yiq(vec3 col)
|
|||
|
||||
void main()
|
||||
{
|
||||
float CHROMA_MOD_FREQ = (phase < 2.5) ? (4.0 * PI / 15.0) : (PI / 3.0);
|
||||
float ARTIFACTING = 1.0 - global.quality;
|
||||
float FRINGING = 1.0 - global.quality;
|
||||
float SATURATION = 1.0 - global.bw;
|
||||
// prevent some very slight clipping that happens at 1.0
|
||||
const float BRIGHTNESS = 0.95;
|
||||
vec3 col = texture(Source, vTexCoord).rgb;
|
||||
vec3 yiq = rgb2yiq(col);
|
||||
|
||||
|
|
Loading…
Reference in a new issue