Update crt-sines.glsl (#316)

* Update crt-sines.glsl

* Add files via upload

* Add files via upload

* Update fake-CRT-Geom-potato.glsl

* Update crt-Cyclon.glsl
This commit is contained in:
metallic77 2023-10-19 17:00:51 +03:00 committed by GitHub
parent 718f959d67
commit 7bedee22a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 171 additions and 8 deletions

View File

@ -408,7 +408,7 @@ if (PAL_NTSC != 0.0){
res *= Mask(xy, CGWG);
if (SLOT == 1.0) res *= mix(slot(xy/2.0),vec3(1.0),CGWG);
if (POTATO == 0.0) res = inv_gamma(res,pwr);
else res = sqrt(res);
else {res = sqrt(res); res *= mix(1.3,1.1,l);}
float lum = dot(vec3(0.29,0.60,0.11),res);
res = mix(vec3(lum),res,SATURATION);

View File

@ -3,8 +3,7 @@
/*
work by DariusG 2023, some ideas borrowed from Dogway's zfast_crt_geo
v1.5b fine-tune colors (real Trinitron)
v1.5 re-worked version with better colors (real Trinitron)
v1.5 re-worked version with better colors (real Trinitron), add Android preset
v1.4c added real Trinitron color profile as default, with real measured primaries
v1.4b added some system specific tweaks
v1.4 removed junk, optimized white point a bit
@ -43,7 +42,7 @@
#pragma parameter BOOST "Bright Boost" 0.5 0.0 1.0 0.01
#pragma parameter SAT "Saturation" 1.1 0.0 2.0 0.01
#pragma parameter CRT "Trinitron Colors" 1.0 0.0 1.0 1.0
#pragma parameter CRT "Trinitron Colors, 1:PC, 2:Android" 1.0 0.0 2.0 1.0
#define pi 3.1415926535897932384626433
@ -218,12 +217,18 @@ vec2 Warp(vec2 pos)
return pos;
}
mat3 hue = mat3(
mat3 huePC = mat3(
1.15, -0.05, 0.1,
-0.1, 1.3, -0.2,
0.15, 0.15, 1.0
);
mat3 hueAnd = mat3(
1.0, -0.03, -0.04,
0.03, 1.0, -0.11,
0.04, 0.11, 1.05
);
void main()
{
@ -278,7 +283,8 @@ void main()
res *= Mask();
res = sqrt(res);
if(CRT == 1.0) res *= hue;
if(CRT == 1.0) res *= huePC;
if(CRT == 2.0) res *= hueAnd;
vec3 lumweight = vec3(0.29,0.6,0.11);
float lum = dot(lumweight,res);

View File

@ -111,12 +111,12 @@ void main()
{
float y = TEX0.y*SourceSize.y;
float centr = (floor(y)+0.5)/SourceSize.y;
float ycoord = mix(centr, vTexCoord.y,0.5);
float ycoord = mix(centr, vTexCoord.y,0.2);
vec3 res = COMPAT_TEXTURE(Source, vec2(vTexCoord.x, ycoord)).rgb;
vec3 origin = res;
float lum = dot(vec3(0.2), res);
res *= 0.5*sin(scanpos)+0.5 ;
res *= 0.4*sin(scanpos)+0.6 ;
res *= 0.15*sin(fragpos)+0.85;
res = mix(res, origin, lum);
res *= mix(1.35,1.0,lum);

11
misc/convergence.glslp Normal file
View File

@ -0,0 +1,11 @@
shaders = "1"
shader0 = "shaders/convergence.glsl"
filter_linear0 = "true"
C_STR = "0.400000"
Rx = "0.400000"
Ry = "0.200000"
Gx = "-0.150000"
Gy = "0.050000"
Bx = "-0.350000"
By = "0.200000"

View File

@ -0,0 +1,146 @@
#version 110
/*
convergence pass DariusG 2023.
Run in Linear, BEFORE actual shader pass
*/
#pragma parameter C_STR "Convergence Overall Strength" 0.0 0.0 1.0 0.05
#pragma parameter Rx "Convergence Red Horiz." 0.0 -5.0 5.0 0.05
#pragma parameter Ry "Convergence Red Vert." 0.0 -5.0 5.0 0.05
#pragma parameter Gx "Convergence Green Horiz." 0.0 -5.0 5.0 0.05
#pragma parameter Gy "Convergence Green Vert." 0.0 -5.0 5.0 0.05
#pragma parameter Bx "Convergence Blue Horiz." 0.0 -5.0 5.0 0.05
#pragma parameter By "Convergence Blue Vert." 0.0 -5.0 5.0 0.05
#define pi 3.1415926535897932384626433
#if defined(VERTEX)
#if __VERSION__ >= 130
#define COMPAT_VARYING out
#define COMPAT_ATTRIBUTE in
#define COMPAT_TEXTURE texture
#else
#define COMPAT_VARYING varying
#define COMPAT_ATTRIBUTE attribute
#define COMPAT_TEXTURE texture2D
#endif
#ifdef GL_ES
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
COMPAT_ATTRIBUTE vec4 VertexCoord;
COMPAT_ATTRIBUTE vec4 COLOR;
COMPAT_ATTRIBUTE vec4 TexCoord;
COMPAT_VARYING vec4 COL0;
COMPAT_VARYING vec4 TEX0;
vec4 _oPosition1;
uniform mat4 MVPMatrix;
uniform COMPAT_PRECISION int FrameDirection;
uniform COMPAT_PRECISION int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
// compatibility #defines
#define vTexCoord TEX0.xy
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
#ifdef PARAMETER_UNIFORM
uniform COMPAT_PRECISION float SIZE;
#else
#define SIZE 1.0
#endif
void main()
{
gl_Position = MVPMatrix * VertexCoord;
TEX0.xy = TexCoord.xy;
}
#elif defined(FRAGMENT)
#if __VERSION__ >= 130
#define COMPAT_VARYING in
#define COMPAT_TEXTURE texture
out vec4 FragColor;
#else
#define COMPAT_VARYING varying
#define FragColor gl_FragColor
#define COMPAT_TEXTURE texture2D
#endif
#ifdef GL_ES
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
#define COMPAT_PRECISION mediump
#else
#define COMPAT_PRECISION
#endif
uniform COMPAT_PRECISION int FrameDirection;
uniform COMPAT_PRECISION int FrameCount;
uniform COMPAT_PRECISION vec2 OutputSize;
uniform COMPAT_PRECISION vec2 TextureSize;
uniform COMPAT_PRECISION vec2 InputSize;
uniform sampler2D Texture;
COMPAT_VARYING vec4 TEX0;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define OutSize vec4(OutputSize, 1.0 / OutputSize)
#ifdef PARAMETER_UNIFORM
uniform COMPAT_PRECISION float C_STR;
uniform COMPAT_PRECISION float Rx;
uniform COMPAT_PRECISION float Ry;
uniform COMPAT_PRECISION float Gx;
uniform COMPAT_PRECISION float Gy;
uniform COMPAT_PRECISION float Bx;
uniform COMPAT_PRECISION float By;
#else
#define C_STR 0.0
#define Rx 0.0
#define Ry 0.0
#define Gx 0.0
#define Gy 0.0
#define Bx 0.0
#define By 0.0
#endif
void main()
{
vec2 dx = vec2(SourceSize.z,0.0);
vec2 dy = vec2(0.0,SourceSize.w);
vec2 pos = vTexCoord;
vec3 res0 = COMPAT_TEXTURE(Source,pos).rgb;
float resr = COMPAT_TEXTURE(Source,pos + dx*Rx + dy*Ry).r;
float resg = COMPAT_TEXTURE(Source,pos + dx*Gx + dy*Gy).g;
float resb = COMPAT_TEXTURE(Source,pos + dx*Bx + dy*By).b;
vec3 res = vec3( res0.r*(1.0-C_STR) + resr*C_STR,
res0.g*(1.0-C_STR) + resg*C_STR,
res0.b*(1.0-C_STR) + resb*C_STR
);
FragColor.rgb = res;
}
#endif