add gba-color shader

This commit is contained in:
hunterk 2017-04-13 07:39:35 -05:00 committed by endrift
parent c4e06cc904
commit c30352fde1
2 changed files with 141 additions and 0 deletions

View File

@ -0,0 +1,42 @@
varying vec2 texCoord;
uniform sampler2D tex;
uniform vec2 texSize;
uniform float darken_screen;
uniform float target_gamma;
uniform float display_gamma;
uniform float sat;
uniform float lum;
uniform float contrast;
uniform float blr;
uniform float blg;
uniform float blb;
uniform float r;
uniform float g;
uniform float b;
uniform float rg;
uniform float rb;
uniform float gr;
uniform float gb;
uniform float br;
uniform float bg;
void main() {
vec4 screen = pow(texture2D(tex, texCoord), vec4(target_gamma + darken_screen)).rgba;
vec4 avglum = vec4(0.5);
screen = mix(screen, avglum, (1.0 - contrast));
mat4 color = mat4(r, rg, rb, 0.0,
gr, g, gb, 0.0,
br, bg, b, 0.0,
blr, blg, blb, 1.0);
mat4 adjust = mat4((1.0 - sat) * 0.3086 + sat, (1.0 - sat) * 0.3086, (1.0 - sat) * 0.3086, 1.0,
(1.0 - sat) * 0.6094, (1.0 - sat) * 0.6094 + sat, (1.0 - sat) * 0.6094, 1.0,
(1.0 - sat) * 0.0820, (1.0 - sat) * 0.0820, (1.0 - sat) * 0.0820 + sat, 1.0,
0.0, 0.0, 0.0, 1.0);
color *= adjust;
screen = clamp(screen * lum, 0.0, 1.0);
screen = color * screen;
gl_FragColor = pow(screen, vec4(1.0 / display_gamma + (darken_screen / 8.)));
}

View File

@ -0,0 +1,99 @@
[shader]
name=GBA Color
author=Pokefan531 and hunterk
description=Modifies the color output to simulate the GBA LCD characteristics.
passes=1
[pass.0]
fragmentShader=gba-color.fs
blend=1
[pass.0.uniform.darken_screen]
type=float
default=0.5
readableName=Darken Screen
[pass.0.uniform.target_gamma]
type=float
default=2.2
readableName=Target Gamma
[pass.0.uniform.display_gamma]
type=float
default=2.5
readableName=Display Gamma
[pass.0.uniform.sat]
type=float
default=1.0
readableName=Saturation
[pass.0.uniform.lum]
type=float
default=0.99
readableName=Luminance
[pass.0.uniform.contrast]
type=float
default=1.0
readableName=Constrast
[pass.0.uniform.blr]
type=float
default=0.0
readableName=Black's Red Tint
[pass.0.uniform.blg]
type=float
default=0.0
readableName=Black's Green Tint
[pass.0.uniform.blb]
type=float
default=0.0
readableName=Black's Blue Tint
[pass.0.uniform.r]
type=float
default=0.84
readableName=Red's Intensity
[pass.0.uniform.g]
type=float
default=0.67
readableName=Green's Intensity
[pass.0.uniform.b]
type=float
default=0.73
readableName=Blue's Intensity
[pass.0.uniform.rg]
type=float
default=0.09
readableName=Red's Green Tint
[pass.0.uniform.rb]
type=float
default=0.15
readableName=Red's Blue Tint
[pass.0.uniform.gr]
type=float
default=0.18
readableName=Green's Red Tint
[pass.0.uniform.gb]
type=float
default=0.10
readableName=Green's Blue Tint
[pass.0.uniform.br]
type=float
default=0.0
readableName=Blue's Red Tint
[pass.0.uniform.bg]
type=float
default=0.26
readableName=Blue's Green Tint