Commit 27ae0954 authored by jdgleaver's avatar jdgleaver
Browse files

(handheld) Update colour correction shaders (taken from Pokefan531's latest shader pack:

https://forums.libretro.com/t/real-gba-and-ds-phat-colors/1540/174)
parent f93ec90d
......@@ -14,7 +14,7 @@
#endif
// Parameter lines go here:
#pragma parameter darken_screen "Darken Screen" 0.5 -0.25 2.0 0.05
#pragma parameter darken_screen "Darken Screen" 0.5 -0.25 1.5 0.05
#ifdef PARAMETER_UNIFORM
// All parameter floats need to have COMPAT_PRECISION in front of them
uniform COMPAT_PRECISION float darken_screen;
......@@ -30,14 +30,14 @@ uniform COMPAT_PRECISION float darken_screen;
#define blr 0.0
#define blg 0.0
#define blb 0.0
#define r 0.845
#define g 0.68
#define b 0.755
#define rg 0.09
#define rb 0.16
#define gr 0.17
#define gb 0.085
#define br -0.015
#define r 0.86
#define g 0.66
#define b 0.81
#define rg 0.11
#define rb 0.1325
#define gr 0.19
#define gb 0.0575
#define br -0.05
#define bg 0.23
#define overscan_percent_x 0.0
#define overscan_percent_y 0.0
......@@ -114,13 +114,13 @@ COMPAT_VARYING vec4 TEX0;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define outsize vec4(OutputSize, 1.0 / OutputSize)
void main()
{
vec4 screen = pow(COMPAT_TEXTURE(Source, vTexCoord), vec4(target_gamma + darken_screen)).rgba;
vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma + darken_screen)).rgba;
vec4 avglum = vec4(0.5);
screen = mix(screen, avglum, (1.0 - contrast));
......
......@@ -2,7 +2,8 @@
GBC Color Correction Shader
A shader that replicates the LCD dynamics from a Game Boy Color
Color values are derived from Gambatte's color correction implementation, with some tweaks.
Further tweaks by Pokefan531.
Based on Color Mangler
Author: hunterk
License: Public domain
......@@ -15,12 +16,13 @@
#define COMPAT_PRECISION
#endif
#pragma parameter darken_screen "Darken Screen" 0.0 -0.25 2.0 0.05
// GBC-Color option has brightness values from 0 to 1.2. light position relative to screen - Top: 1.2 Mid: 0.5 Bottom: 0.0
#pragma parameter brighten_screen "Brighten Screen" 0.5 -0.25 1.2 0.05
#ifdef PARAMETER_UNIFORM
// All parameter floats need to have COMPAT_PRECISION in front of them
uniform COMPAT_PRECISION float darken_screen;
uniform COMPAT_PRECISION float brighten_screen;
#else
#define darken_screen 0.0
#define brighten_screen 0.0
#endif
#define target_gamma 2.2
......@@ -28,15 +30,15 @@ uniform COMPAT_PRECISION float darken_screen;
#define blr 0.0
#define blg 0.0
#define blb 0.0
#define r 0.78824
#define g 0.72941
#define b 0.82
#define rg 0.025
#define rb 0.12039
#define gr 0.12157
#define gb 0.12157
#define br 0.0
#define bg 0.275000
#define r 0.87
#define g 0.66
#define b 0.79
#define rg 0.115
#define rb 0.14
#define gr 0.18
#define gb 0.07
#define br -0.05
#define bg 0.225
#if defined(VERTEX)
......@@ -116,7 +118,7 @@ COMPAT_VARYING vec4 TEX0;
void main()
{
vec4 screen = pow(COMPAT_TEXTURE(Source, vTexCoord), vec4(target_gamma + darken_screen)).rgba;
vec4 screen = pow(COMPAT_TEXTURE(Source, vTexCoord), vec4(target_gamma - brighten_screen)).rgba;
// red green blue alpha ; alpha does nothing for our purposes
mat4 color = mat4(r, rg, rb, 0.0, //red
......
......@@ -21,15 +21,15 @@
#define blr 0.0
#define blg 0.0
#define blb 0.0
#define r 0.83
#define g 0.65
#define b 0.765
#define rg 0.105
#define rb 0.105
#define r 0.85
#define g 0.655
#define b 0.865
#define rg 0.095
#define rb 0.06
#define gr 0.20
#define gb 0.13
#define br -0.03
#define bg 0.245
#define gb 0.075
#define br -0.05
#define bg 0.25
#define overscan_percent_x 0.0
#define overscan_percent_y 0.0
......@@ -105,13 +105,13 @@ COMPAT_VARYING vec4 TEX0;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define outsize vec4(OutputSize, 1.0 / OutputSize)
void main()
{
vec4 screen = pow(COMPAT_TEXTURE(Source, vTexCoord), vec4(target_gamma)).rgba;
vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma)).rgba;
vec4 avglum = vec4(0.5);
screen = mix(screen, avglum, (1.0 - contrast));
......
......@@ -21,14 +21,14 @@
#define blr 0.0
#define blg 0.0
#define blb 0.0
#define r 0.745
#define g 0.69
#define b 0.775
#define rg 0.06
#define r 0.83
#define g 0.677
#define b 0.795
#define rg 0.073
#define rb 0.085
#define gr 0.315
#define gb 0.14
#define br -0.06
#define gr 0.26
#define gb 0.12
#define br -0.09
#define bg 0.25
#define overscan_percent_x 0.0
#define overscan_percent_y 0.0
......@@ -105,13 +105,13 @@ COMPAT_VARYING vec4 TEX0;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define outsize vec4(OutputSize, 1.0 / OutputSize)
void main()
{
vec4 screen = pow(COMPAT_TEXTURE(Source, vTexCoord), vec4(target_gamma)).rgba;
vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma)).rgba;
vec4 avglum = vec4(0.5);
screen = mix(screen, avglum, (1.0 - contrast));
......
......@@ -22,15 +22,15 @@
#define blr 0.0
#define blg 0.0
#define blb 0.0
#define r 0.92
#define r 0.98
#define g 0.795
#define b 0.975
#define rg 0.035
#define b 0.98
#define rg 0.04
#define rb 0.01
#define gr 0.24
#define gb 0.015
#define br -0.16
#define bg 0.17
#define gr 0.20
#define gb 0.01
#define br -0.18
#define bg 0.165
#define overscan_percent_x 0.0
#define overscan_percent_y 0.0
......@@ -106,13 +106,13 @@ COMPAT_VARYING vec4 TEX0;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define outsize vec4(OutputSize, 1.0 / OutputSize)
void main()
{
vec4 screen = pow(COMPAT_TEXTURE(Source, vTexCoord), vec4(target_gamma)).rgba;
vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma)).rgba;
vec4 avglum = vec4(0.5);
screen = mix(screen, avglum, (1.0 - contrast));
......
......@@ -14,7 +14,7 @@
#endif
// Parameter lines go here:
#pragma parameter darken_screen "Darken Intensity" 1.0 0.0 1.0 0.05
#pragma parameter darken_screen "Darken Intensity" 1.0 -1.0 1.0 0.05
#ifdef PARAMETER_UNIFORM
// All parameter floats need to have COMPAT_PRECISION in front of them
uniform COMPAT_PRECISION float darken_screen;
......@@ -30,12 +30,12 @@ uniform COMPAT_PRECISION float darken_screen;
#define blr 0.0
#define blg 0.0
#define blb 0.0
#define r 0.74
#define g 0.68
#define b 0.68
#define rg 0.08
#define rb 0.08
#define gr 0.26
#define r 0.73
#define g 0.675
#define b 0.675
#define rg 0.085
#define rb 0.085
#define gr 0.27
#define gb 0.24
#define br 0.0
#define bg 0.24
......@@ -114,13 +114,13 @@ COMPAT_VARYING vec4 TEX0;
// compatibility #defines
#define Source Texture
#define vTexCoord TEX0.xy
#define texture(c, d) COMPAT_TEXTURE(c, d)
#define SourceSize vec4(TextureSize, 1.0 / TextureSize) //either TextureSize or InputSize
#define outsize vec4(OutputSize, 1.0 / OutputSize)
void main()
{
vec4 screen = pow(COMPAT_TEXTURE(Source, vTexCoord), vec4(target_gamma + (darken_screen * 1.7))).rgba;
vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma + (darken_screen * 1.7))).rgba;
vec4 avglum = vec4(0.5);
screen = mix(screen, avglum, (1.0 - contrast));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment