mirror of
https://github.com/libretro/slang-shaders.git
synced 2024-11-23 00:10:03 +00:00
glsl to slang update (#517)
* glsl to slang update * Update crt-gdv-mini.slang * Update fake-crt-geom-potato.slang * Update fakelottes.slang * Update fakelottes.slang * Update zfast_crt_impl.inc finemask wasn't working properly * Delete crt/shaders/crt-consumer/bezel2.png * Update crt-Cyclon.slang * Update crt-Cyclon.slangp * Delete crt/shaders/crt-consumer/bezel.png * Add files via upload * Delete crt/shaders/crt-consumer/bezel3.png * Update crt-consumer.slang
This commit is contained in:
parent
58ea67a83b
commit
61b00e773a
@ -4,12 +4,8 @@ shader0 = shaders/crt-Cyclon.slang
|
||||
filter_linear0 = true
|
||||
scale_type0 = viewport
|
||||
|
||||
textures = "bezel;bezel2;bezel3"
|
||||
textures = "bezel"
|
||||
|
||||
bezel = "shaders/crt-consumer/bezel.png"
|
||||
bezel_linear = true
|
||||
bezel_wrap_mode = "clamp_to_border"
|
||||
|
||||
bezel2 = "shaders/crt-consumer/bezel2.png"
|
||||
bezel2_linear = true
|
||||
bezel2_wrap_mode = "clamp_to_border"
|
||||
|
@ -42,12 +42,12 @@ layout(push_constant) uniform Push
|
||||
#pragma parameter Maskl "Mask Brightness Dark" 0.3 0.0 1.0 0.05
|
||||
#pragma parameter Maskh "Mask Brightness Bright" 0.75 0.0 1.0 0.05
|
||||
#pragma parameter bogus_geom " [ GEOMETRY SETTINGS ] " 0.0 0.0 0.0 0.0
|
||||
#pragma parameter bzl "Bezel Type" 1.0 0.0 2.0 1.0
|
||||
#pragma parameter bzl "Bezel On/Off" 1.0 0.0 1.0 1.0
|
||||
#pragma parameter ambient "Ambient Light" 0.25 0.0 1.0 0.05
|
||||
#pragma parameter zoomx "Zoom Image X" 0.0 -1.0 1.0 0.005
|
||||
#pragma parameter zoomy "Zoom Image Y" -0.02 -1.0 1.0 0.005
|
||||
#pragma parameter centerx "Image Center X" 2.0 -5.0 5.0 0.05
|
||||
#pragma parameter centery "Image Center Y" 3.0 -5.0 5.0 0.05
|
||||
#pragma parameter zoomy "Zoom Image Y" 0.0 -1.0 1.0 0.005
|
||||
#pragma parameter centerx "Image Center X" 0.0 -5.0 5.0 0.05
|
||||
#pragma parameter centery "Image Center Y" 0.0 -5.0 5.0 0.05
|
||||
#pragma parameter WARPX "Curvature Horizontal" 0.02 0.00 0.25 0.01
|
||||
#pragma parameter WARPY "Curvature Vertical" 0.01 0.00 0.25 0.01
|
||||
#pragma parameter vig "Vignette On/Off" 1.0 0.0 1.0 1.0
|
||||
@ -142,7 +142,6 @@ layout(location = 1) in vec2 scale;
|
||||
|
||||
layout(set = 0, binding = 1) uniform sampler2D Source;
|
||||
layout(set = 0, binding = 2) uniform sampler2D bezel;
|
||||
layout(set = 0, binding = 3) uniform sampler2D bezel2;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -264,7 +263,6 @@ mat3 hue = mat3(
|
||||
vec2 pos = Warp((vTexCoord*vec2(1.0-zoomx,1.0-zoomy)-vec2(centerx,centery)/100.0));
|
||||
vec4 bez = vec4(0.0);
|
||||
if (bzl == 1.0) bez = texture(bezel,vTexCoord*SourceSize.xy/OriginalSize.xy*0.97+vec2(0.015,0.015));
|
||||
if (bzl == 2.0) bez = texture(bezel2,vTexCoord*SourceSize.xy/OriginalSize.xy*0.93+vec2(0.035,0.025));
|
||||
|
||||
bez.rgb = mix(bez.rgb, vec3(ambient),0.5);
|
||||
|
||||
|
@ -19,23 +19,23 @@ layout(push_constant) uniform Push
|
||||
// Parameter lines go here:
|
||||
#pragma parameter PRE_SCALE "Pre-Scale Sharpening" 1.5 1.0 4.0 0.1
|
||||
#pragma parameter blurx "Convergence X" 0.25 -4.0 4.0 0.05
|
||||
#pragma parameter blury "Convergence Y" 0.1 -4.0 4.0 0.05
|
||||
#pragma parameter warpx " Curvature X" 0.02 0.0 0.12 0.01
|
||||
#pragma parameter blury "Convergence Y" -0.1 -4.0 4.0 0.05
|
||||
#pragma parameter warpx " Curvature X" 0.03 0.0 0.12 0.01
|
||||
#pragma parameter warpy " Curvature Y" 0.04 0.0 0.12 0.01
|
||||
#pragma parameter corner " Corner size" 0.01 0.0 0.10 0.01
|
||||
#pragma parameter corner " Corner size" 0.03 0.0 0.10 0.01
|
||||
#pragma parameter smoothness " Border Smoothness" 400.0 100.0 600.0 5.0
|
||||
#pragma parameter inter "Interlacing Toggle" 1.0 0.0 1.0 1.0
|
||||
#pragma parameter Downscale "Interlacing Downscale Scanlines" 2.0 1.0 8.0 1.0
|
||||
#pragma parameter scanlow "Beam low" 6.0 1.0 15.0 1.0
|
||||
#pragma parameter scanhigh "Beam high" 8.0 1.0 15.0 1.0
|
||||
#pragma parameter beamlow "Scanlines dark" 1.45.5 2.5 0.05
|
||||
#pragma parameter beamlow "Scanlines dark" 1.45 0.5 2.5 0.05
|
||||
#pragma parameter beamhigh "Scanlines bright" 1.05 0.5 2.5 0.05
|
||||
#pragma parameter preserve " Protect White On Masks" 0.98 0.0 1.0 0.01
|
||||
#pragma parameter brightboost1 " Bright boost dark pixels" 1.2 0.0 3.0 0.05
|
||||
#pragma parameter brightboost1 " Bright boost dark pixels" 1.25 0.0 3.0 0.05
|
||||
#pragma parameter brightboost2 " Bright boost bright pixels" 1.0 0.0 3.0 0.05
|
||||
#pragma parameter glow " Glow pixels per axis" 4.0 1.0 4.0 1.0
|
||||
#pragma parameter quality " Glow quality" 1.0 0.5 4.0 0.1
|
||||
#pragma parameter glow_str " Glow intensity" 0.0 0.0001 1.0 0.05
|
||||
#pragma parameter glow " Glow pixels per axis" 3.0 1.0 6.0 1.0
|
||||
#pragma parameter quality " Glow quality" 1.0 0.25 4.0 0.05
|
||||
#pragma parameter glow_str " Glow intensity" 0.3 0.0001 2.0 0.05
|
||||
#pragma parameter nois " Add Noise" 0.0 0.0 32.0 1.0
|
||||
#pragma parameter postbr " Post Brightness" 1.0 0.0 2.5 0.02
|
||||
#pragma parameter palette_fix "Palette Fixes. Sega, PUAE Atari ST dark colors " 0.0 0.0 2.0 1.0
|
||||
@ -47,7 +47,7 @@ layout(push_constant) uniform Push
|
||||
#pragma parameter slotwidth "Slot Mask Width" 2.0 1.0 6.0 0.5
|
||||
#pragma parameter double_slot "Slot Mask Height: 2x1 or 4x1" 1.0 1.0 2.0 1.0
|
||||
#pragma parameter slotms "Slot Mask Size" 1.0 1.0 2.0 1.0
|
||||
#pragma parameter GAMMA_OUT " Gamma Out" 2.2 0.0 4.0 0.1
|
||||
#pragma parameter GAMMA_OUT " Gamma Out" 2.25 0.0 4.0 0.05
|
||||
#pragma parameter sat " Saturation" 1.0 0.0 2.0 0.05
|
||||
#pragma parameter contrast " Contrast, 1.0:Off" 1.0 0.00 2.00 0.05
|
||||
#pragma parameter WP " Color Temperature %" 0.0 -100.0 100.0 5.0
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 35 KiB |
Binary file not shown.
Before Width: | Height: | Size: 35 KiB |
@ -48,57 +48,41 @@ layout(push_constant) uniform Push
|
||||
|
||||
// Parameter lines go here:
|
||||
#pragma parameter gdv_mini_title "[ GDV MINI - DariusG ]:" 0.0 0.0 1.0 1.0
|
||||
|
||||
#pragma parameter gamma_out "Gamma out" 0.5 0.2 0.6 0.01
|
||||
#define gamma_out params.gamma_out
|
||||
|
||||
#pragma parameter brightboost "Bright boost" 1.0 0.5 2.0 0.05
|
||||
#define brightboost params.brightboost
|
||||
|
||||
#pragma parameter sat "Saturation adjustment" 1.0 0.0 2.0 0.05
|
||||
#define sat params.sat
|
||||
|
||||
#pragma parameter scanline "Scanline Adjust" 8.0 1.0 12.0 1.0
|
||||
#define scanline params.scanline
|
||||
|
||||
#pragma parameter beam_min "Scanline Dark" 1.35 0.5 3.0 0.05
|
||||
#define beam_min params.beam_min
|
||||
|
||||
#pragma parameter beam_max "Scanline Bright" 1.05 0.5 3.0 0.05
|
||||
#define beam_max params.beam_max
|
||||
|
||||
#pragma parameter h_sharp "Horizontal Sharpness" 2.0 1.0 5.0 0.05
|
||||
#define h_sharp params.h_sharp
|
||||
|
||||
#pragma parameter gamma_out "Gamma out" 0.5 0.2 0.6 0.01
|
||||
#pragma parameter shadowMask "CRT Mask: 0:CGWG, 1-4:Lottes, 5-6:Trinitron" 0.0 -1.0 10.0 1.0
|
||||
#define shadowMask params.shadowMask
|
||||
|
||||
#pragma parameter masksize "CRT Mask Size (2.0 is nice in 4k)" 1.0 1.0 2.0 1.0
|
||||
#define masksize params.masksize
|
||||
|
||||
#pragma parameter mcut "Mask 5-7-10 cutoff" 0.2 0.0 0.5 0.05
|
||||
#define mcut params.mcut
|
||||
|
||||
#pragma parameter maskDark "Lottes maskDark" 0.5 0.0 2.0 0.1
|
||||
#define maskDark params.maskDark
|
||||
|
||||
#pragma parameter maskLight "Lottes maskLight" 1.5 0.0 2.0 0.1
|
||||
#define maskLight params.maskLight
|
||||
|
||||
#pragma parameter CGWG "CGWG Mask Str." 0.4 0.0 1.0 0.1
|
||||
#define CGWG params.CGWG
|
||||
|
||||
#pragma parameter CGWG "CGWG Mask Str." 0.3 0.0 1.0 0.1
|
||||
#pragma parameter warpX "CurvatureX (default 0.03)" 0.0 0.0 0.25 0.01
|
||||
#define warpX params.warpX
|
||||
|
||||
#pragma parameter warpY "CurvatureY (default 0.04)" 0.0 0.0 0.25 0.01
|
||||
#define warpY params.warpY
|
||||
|
||||
#pragma parameter vignette "Vignette On/Off" 0.0 0.0 1.0 1.0
|
||||
|
||||
#define gamma_out params.gamma_out
|
||||
#define brightboost params.brightboost
|
||||
#define sat params.sat
|
||||
#define scanline params.scanline
|
||||
#define beam_min params.beam_min
|
||||
#define beam_max params.beam_max
|
||||
#define h_sharp params.h_sharp
|
||||
#define shadowMask params.shadowMask
|
||||
#define masksize params.masksize
|
||||
#define mcut params.mcut
|
||||
#define maskDark params.maskDark
|
||||
#define maskLight params.maskLight
|
||||
#define CGWG params.CGWG
|
||||
#define warpX params.warpX
|
||||
#define warpY params.warpY
|
||||
#define vignette params.vignette
|
||||
|
||||
#define lumweight vec3(0.22,0.7,0.08)
|
||||
|
||||
#define lumweight vec3(0.3,0.6,0.1)
|
||||
|
||||
|
||||
layout(std140, set = 0, binding = 0) uniform UBO
|
||||
@ -125,10 +109,10 @@ layout(location = 1) in float maskFade;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
layout(set = 0, binding = 1) uniform sampler2D Source;
|
||||
|
||||
float sw (float y, float l)
|
||||
float sw (float y, float l,float v)
|
||||
{
|
||||
float scan = mix(scanline-2.0, scanline, y);
|
||||
float tmp = mix(beam_min, beam_max, l);
|
||||
float tmp = mix(beam_min+v, beam_max+v, l);
|
||||
float ex = y*tmp;
|
||||
return exp2(-scan*ex*ex);
|
||||
}
|
||||
@ -331,63 +315,52 @@ vec2 Warp(vec2 pos)
|
||||
return pos*0.5 + 0.5;
|
||||
}
|
||||
|
||||
vec3 saturation (vec3 textureColor)
|
||||
{
|
||||
float lum=length(textureColor.rgb)*0.5775;
|
||||
|
||||
vec3 luminanceWeighting = vec3(0.3,0.6,0.1);
|
||||
if (lum<0.5) luminanceWeighting.rgb=(luminanceWeighting.rgb*luminanceWeighting.rgb)+(luminanceWeighting.rgb*luminanceWeighting.rgb);
|
||||
|
||||
float luminance = dot(textureColor.rgb, luminanceWeighting);
|
||||
vec3 greyScaleColor = vec3(luminance);
|
||||
|
||||
vec3 res = vec3(mix(greyScaleColor, textureColor.rgb, sat));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 pos = Warp(vTexCoord);
|
||||
vec2 pos = Warp(vTexCoord);
|
||||
|
||||
// HSM Added
|
||||
vec4 SourceSize = params.SourceSize;
|
||||
|
||||
vec2 ps = SourceSize.zw;
|
||||
vec2 OGL2Pos = pos * SourceSize.xy;
|
||||
vec2 OGL2Pos = pos * params.SourceSize.xy;
|
||||
vec2 fp = fract(OGL2Pos);
|
||||
vec2 ps = params.SourceSize.zw;
|
||||
vec2 dx = vec2(ps.x,0.0);
|
||||
vec2 dy = vec2(0.0, ps.y);
|
||||
|
||||
vec2 pC4 = floor(OGL2Pos) * ps + 0.5*ps;
|
||||
|
||||
vec2 pC4 = floor(OGL2Pos) * ps + 0.5*ps;
|
||||
float f = fp.y; if (params.OriginalSize.y > 400.0) f=1.0;
|
||||
vec3 color;
|
||||
|
||||
// Reading the texels
|
||||
vec3 ul = texture(Source, pC4 ).xyz;
|
||||
vec3 ur = texture(Source, pC4 + dx).xyz;
|
||||
vec3 ur = texture(Source, pC4 - dx).xyz;
|
||||
vec3 dl = texture(Source, pC4 + dy).xyz;
|
||||
vec3 dr = texture(Source, pC4 + ps).xyz;
|
||||
vec3 dr = texture(Source, pC4 + vec2(-ps.x,ps.y)).xyz;
|
||||
|
||||
float lx = fp.x; lx = pow(lx, h_sharp);
|
||||
float rx = 1.0 - fp.x; rx = pow(rx, h_sharp);
|
||||
|
||||
vec3 color1 = (ur*lx + ul*rx)/(lx+rx);
|
||||
vec3 color2 = (dr*lx + dl*rx)/(lx+rx);
|
||||
vec3 color1 = (ur*rx + ul*lx)/(lx+rx);
|
||||
vec3 color2 = (dr*rx + dl*lx)/(lx+rx);
|
||||
color1 *=color1; color2 *=color2;
|
||||
|
||||
// calculating scanlines
|
||||
|
||||
float f = fp.y; if (params.OriginalSize.y > 400.0) f=1.0;
|
||||
float luma1 = dot(color1,lumweight);
|
||||
float luma2 = dot(color2,lumweight);
|
||||
|
||||
vec3 color = color1*sw(f,luma1) + color2*sw(1.0-f,luma2);
|
||||
color = color * Mask(vTexCoord * global.OutputSize.xy, color);
|
||||
float lum = dot(color,lumweight);
|
||||
float lum = dot (color1, lumweight);
|
||||
float lum2 = dot (color2, lumweight);
|
||||
|
||||
|
||||
float v = 0.0;
|
||||
// vignette
|
||||
if (vignette > 0.0){
|
||||
v = (vTexCoord.x-0.5); // range -0.5 to 0.5, 0.0 being center of screen
|
||||
v = v*v; // curved response: higher values (more far from center) get higher results.
|
||||
}
|
||||
color = color1*sw(f, lum,v) + color2*sw(1.0-f, lum2,v);
|
||||
color = color*Mask(vTexCoord*params.OutputSize.xy, color);
|
||||
|
||||
color = pow(color, vec3(gamma_out));
|
||||
float s = dot(lumweight,color);
|
||||
color*= mix(1.0,brightboost,lum);
|
||||
color = mix(vec3(s),color,sat);
|
||||
|
||||
color = saturation(color);
|
||||
color*= vign(lum);
|
||||
FragColor = vec4(color, 1.0);
|
||||
}
|
||||
FragColor.rgb = color;
|
||||
}
|
||||
|
@ -30,34 +30,27 @@ layout(std140, set = 0, binding = 0) uniform UBO
|
||||
layout(location = 0) in vec4 Position;
|
||||
layout(location = 1) in vec2 TexCoord;
|
||||
layout(location = 0) out vec2 vTexCoord;
|
||||
layout(location = 1) out vec2 scale;
|
||||
layout(location = 2) out float fragpos;
|
||||
layout(location = 3) out vec2 warpp;
|
||||
layout(location = 4) out vec2 dbwarp;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = global.MVP * Position;
|
||||
vTexCoord = TexCoord * 1.0001;
|
||||
scale = SourceSize.xy/OriginalSize.xy;
|
||||
warpp = vTexCoord.xy*scale;
|
||||
dbwarp = warpp*2.0-1.0;
|
||||
fragpos = warpp.x*OutputSize.x*pi*2.0/SIZE;
|
||||
fragpos = vTexCoord.x*OutputSize.x*pi*2.0/SIZE;
|
||||
}
|
||||
|
||||
#pragma stage fragment
|
||||
layout(location = 0) in vec2 vTexCoord;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
layout(location = 1) in vec2 scale;
|
||||
layout(location = 2) in float fragpos;
|
||||
layout(location = 3) in vec2 warpp;
|
||||
layout(location = 4) in vec2 dbwarp;
|
||||
|
||||
|
||||
layout(set = 0, binding = 1) uniform sampler2D Source;
|
||||
|
||||
vec2 Warp(vec2 pos)
|
||||
{
|
||||
pos = dbwarp;
|
||||
pos = pos*2.0-1.0;
|
||||
pos *= vec2(1.0+pos.y*pos.y*0.03, 1.0+pos.x*pos.x*0.04);
|
||||
pos = pos*0.5+0.5;
|
||||
return pos;
|
||||
@ -65,10 +58,9 @@ vec2 Warp(vec2 pos)
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 pos = Warp(warpp);
|
||||
vec2 pos = Warp(vTexCoord);
|
||||
vec2 corn = min(pos, 1.0-pos); // This is used to mask the rounded
|
||||
corn.x = 0.0002/corn.x; // corners later on
|
||||
pos /= scale;
|
||||
|
||||
float y = pos.y*SourceSize.y;
|
||||
float gl2pos = floor(y) + 0.5;
|
||||
@ -84,14 +76,14 @@ vec3 clean = res;
|
||||
float w = dot(vec3(0.15),res);
|
||||
|
||||
// vignette
|
||||
float x = (warpp.x-0.5); // range -0.5 to 0.5, 0.0 being center of screen
|
||||
float x = (vTexCoord.x-0.5); // range -0.5 to 0.5, 0.0 being center of screen
|
||||
x = x*x;
|
||||
res *= (0.25+x)*sin((y-0.25)*pi*2.0)+(0.75-x);
|
||||
res *= 0.15*sin(fragpos)+0.85;
|
||||
|
||||
res = mix(res,clean, w);
|
||||
|
||||
res *= vec3(1.0,0.85,1.2);
|
||||
res *= vec3(1.0,0.9,1.15);
|
||||
|
||||
|
||||
float lum = dot(vec3(0.29,0.6,0.11),res);
|
||||
|
@ -35,8 +35,8 @@ layout(push_constant) uniform Push
|
||||
float warpY;
|
||||
float maskDark;
|
||||
float maskLight;
|
||||
float crt_gamma;
|
||||
float monitor_gamma;
|
||||
float crt_gamma;
|
||||
float SCANLINE_SINE_COMP_A;
|
||||
float SCANLINE_BASE_BRIGHTNESS;
|
||||
} params;
|
||||
@ -178,8 +178,8 @@ void main()
|
||||
|
||||
#if defined MASK && !defined ROTATE_SCANLINES
|
||||
// mask effects look bad unless applied in linear gamma space
|
||||
vec4 in_gamma = vec4(params.monitor_gamma, params.monitor_gamma, params.monitor_gamma, 1.0);
|
||||
vec4 out_gamma = vec4(1.0 / params.crt_gamma, 1.0 / params.crt_gamma, 1.0 / params.crt_gamma, 1.0);
|
||||
vec4 in_gamma = vec4(params.crt_gamma, params.crt_gamma, params.crt_gamma, 1.0);
|
||||
vec4 out_gamma = vec4(1.0 / params.monitor_gamma, 1.0 / params.monitor_gamma, 1.0 / params.monitor_gamma, 1.0);
|
||||
vec4 res = pow(texture(Source, pos), in_gamma);
|
||||
#else
|
||||
vec4 res = texture(Source, pos);
|
||||
@ -192,8 +192,8 @@ void main()
|
||||
|
||||
#if defined MASK && !defined ROTATE_SCANLINES
|
||||
// re-apply the gamma curve for the mask path
|
||||
FragColor = pow(scanline(pos, res), out_gamma);
|
||||
FragColor = pow(scanline(pos-vec2(0.0,0.25*params.SourceSize.w), res), out_gamma);
|
||||
#else
|
||||
FragColor = scanline(pos, res);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ void main()
|
||||
float YY = Y*Y;
|
||||
|
||||
#if defined(FINEMASK)
|
||||
float whichmask = fract(floor(vTexCoord.x*params.OutputSize.x*-0.4999));
|
||||
float whichmask = fract(floor(vTexCoord.x*params.OutputSize.x)*-0.4999);
|
||||
float mask = 1.0 + float(whichmask < 0.5) * -MASK_DARK;
|
||||
#else
|
||||
float whichmask = fract(floor(vTexCoord.x*params.OutputSize.x)*-0.3333);
|
||||
|
@ -23,7 +23,7 @@ layout(push_constant) uniform Push
|
||||
#pragma parameter contrast "Contrast" 1.0 0.00 2.00 0.01
|
||||
#pragma parameter SAT "Saturation" 1.0 0.0 2.0 0.01
|
||||
#pragma parameter BLACK "Black Level" 0.0 -0.20 0.20 0.01
|
||||
#pragma parameter SEGA "SEGA Lum Fix" 0.0 0.0 1.0 1.0
|
||||
#pragma parameter SEGA "Lum Fix: ST/GEN-CPC-AMIGA" 0.0 0.0 3.0 1.0
|
||||
#pragma parameter postbr "Bright Boost" 1.0 1.0 2.0 0.05
|
||||
#pragma parameter postdk "Dark Boost" 1.0 1.0 2.0 0.05
|
||||
#pragma parameter gamma_out "Gamma out" 2.2 1.0 4.0 0.05
|
||||
@ -87,6 +87,24 @@ layout(location = 0) in vec2 vTexCoord;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||
|
||||
#if defined GL_ES
|
||||
|
||||
mat3 PAL = mat3(
|
||||
0.7954 , 0.1881 , 0.0053 ,
|
||||
-0.0310 , 1.0343 , -0.0044 ,
|
||||
-0.0236 , 0.1383 , 0.8927 );
|
||||
|
||||
mat3 NTSC = mat3(
|
||||
0.6837 , 0.2635 , 0.0336 ,
|
||||
-0.0499 , 1.0323 , 0.0139 ,
|
||||
-0.0119 , 0.1071 , 0.9111 );
|
||||
|
||||
mat3 NTSC_J = mat3(
|
||||
0.8642 , 0.1253 , 0.0030 ,
|
||||
0.0545 , 0.9513 , -0.0029 ,
|
||||
-0.0214 , 0.1554 , 0.8750 );
|
||||
|
||||
#else
|
||||
// standard 6500k
|
||||
mat3 PAL = mat3(
|
||||
1.0740 , -0.0574 , -0.0119 ,
|
||||
@ -104,6 +122,7 @@ mat3 NTSC_J = mat3(
|
||||
1.0185 , -0.0144 , -0.0029 ,
|
||||
0.0732 , 0.9369 , -0.0059 ,
|
||||
-0.0318 , -0.0080 , 1.0353 );
|
||||
#endif
|
||||
|
||||
|
||||
float saturate(float v)
|
||||
@ -208,6 +227,12 @@ mat3 hue = mat3(
|
||||
);
|
||||
|
||||
vec3 col = texture(Source,vTexCoord).rgb;
|
||||
|
||||
if (SEGA == 1.0) col = floor(col*7.0+0.5)/7.0;
|
||||
if (SEGA == 2.0) col = floor(col*2.0+0.5)/2.0;
|
||||
if (SEGA == 3.0) col = floor(col*15.0+0.5)/15.0;
|
||||
|
||||
|
||||
col *= BRIGHTNESS;
|
||||
|
||||
col = pow((col+0.099)/1.099, vec3(gamma_in));
|
||||
@ -223,7 +248,6 @@ if (CS != 0.0){
|
||||
col *= vec3(r_out,g_out,b_out);
|
||||
col = clamp(col,0.0,2.0);
|
||||
}
|
||||
if (SEGA == 1.0) col *= 1.0625;
|
||||
|
||||
col = pow(1.099*col, vec3(1.0/gamma_out))-0.099;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user