mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-22 15:51:30 +11:00
Add Pokefan531's newest color shaders. Keep original gba-color around as gba-color-old.
This commit is contained in:
parent
de93a3b37c
commit
a363633558
5
handheld/gba-color.slangp
Normal file
5
handheld/gba-color.slangp
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
shaders = 1
|
||||||
|
|
||||||
|
shader0 = shaders/color/gba-color.slang
|
||||||
|
filter_linear0 = false
|
||||||
|
scale_type_0 = source
|
5
handheld/nds-color.slangp
Normal file
5
handheld/nds-color.slangp
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
shaders = 1
|
||||||
|
|
||||||
|
shader0 = shaders/color/nds-color.slang
|
||||||
|
filter_linear0 = false
|
||||||
|
scale_type_0 = source
|
5
handheld/psp-color.slangp
Normal file
5
handheld/psp-color.slangp
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
shaders = 1
|
||||||
|
|
||||||
|
shader0 = shaders/color/psp-color.slang
|
||||||
|
filter_linear0 = false
|
||||||
|
scale_type_0 = source
|
77
handheld/shaders/color/gba-color-old.slang
Normal file
77
handheld/shaders/color/gba-color-old.slang
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
#version 450
|
||||||
|
/*
|
||||||
|
Author: Pokefan531
|
||||||
|
License: Public domain
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Shader that replicates the LCD dynamics from a GameBoy Advance
|
||||||
|
|
||||||
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
|
{
|
||||||
|
mat4 MVP;
|
||||||
|
vec4 OutputSize;
|
||||||
|
vec4 OriginalSize;
|
||||||
|
vec4 SourceSize;
|
||||||
|
} global;
|
||||||
|
|
||||||
|
#pragma stage vertex
|
||||||
|
layout(location = 0) in vec4 Position;
|
||||||
|
layout(location = 1) in vec2 TexCoord;
|
||||||
|
layout(location = 0) out vec2 vTexCoord;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_Position = global.MVP * Position;
|
||||||
|
vTexCoord = TexCoord;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma stage fragment
|
||||||
|
layout(location = 0) in vec2 vTexCoord;
|
||||||
|
layout(location = 1) in vec2 FragCoord;
|
||||||
|
layout(location = 0) out vec4 FragColor;
|
||||||
|
layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||||
|
|
||||||
|
|
||||||
|
vec3 grayscale(vec3 col)
|
||||||
|
{
|
||||||
|
// Non-conventional way to do grayscale,
|
||||||
|
// but bSNES uses this as grayscale value.
|
||||||
|
return vec3(dot(col, vec3(0.2126, 0.7152, 0.0722)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
//part 1
|
||||||
|
float saturation = 1.0;
|
||||||
|
float Display_gamma = 1.02;
|
||||||
|
float CRT_gamma = 2.4;
|
||||||
|
float luminance = 1.0;
|
||||||
|
|
||||||
|
vec3 gamma = vec3(CRT_gamma / Display_gamma);
|
||||||
|
vec3 res = texture(Source, vTexCoord).xyz;
|
||||||
|
res = mix(grayscale(res), res, saturation); // Apply saturation
|
||||||
|
res = pow(res, gamma.rgb); // Apply gamma
|
||||||
|
vec4 c = vec4(clamp(res * luminance, 0.0, 1.0), 1.0);
|
||||||
|
|
||||||
|
//part 2
|
||||||
|
float r = c.x;
|
||||||
|
float g = c.y;
|
||||||
|
float b = c.z;
|
||||||
|
float a = c.w;
|
||||||
|
float w = r * 0.714 + g * 0.251 + b * 0.000;
|
||||||
|
float q = r * 0.071 + g * 0.643 + b * 0.216;
|
||||||
|
float e = r * 0.071 + g * 0.216 + b * 0.643;
|
||||||
|
|
||||||
|
//part 3
|
||||||
|
saturation = 1.0;
|
||||||
|
Display_gamma = 3.6;
|
||||||
|
CRT_gamma = 2.4;
|
||||||
|
luminance = 1.01;
|
||||||
|
|
||||||
|
res = vec3(w, q, e);
|
||||||
|
gamma = gamma = vec3(CRT_gamma / Display_gamma);
|
||||||
|
res = mix(grayscale(res), res, saturation); // Apply saturation
|
||||||
|
res = pow(res, gamma.rgb); // Apply gamma
|
||||||
|
|
||||||
|
FragColor = vec4(clamp(res * luminance, 0.0, 1.0), 1.0);
|
||||||
|
}
|
|
@ -1,77 +1,81 @@
|
||||||
#version 450
|
#version 450
|
||||||
/*
|
|
||||||
Author: Pokefan531
|
layout(push_constant) uniform Push
|
||||||
License: Public domain
|
{
|
||||||
*/
|
float display_gamma;
|
||||||
|
} params;
|
||||||
// Shader that replicates the LCD dynamics from a GameBoy Advance
|
|
||||||
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
layout(std140, set = 0, binding = 0) uniform UBO
|
{
|
||||||
{
|
mat4 MVP;
|
||||||
mat4 MVP;
|
vec4 OutputSize;
|
||||||
vec4 OutputSize;
|
vec4 OriginalSize;
|
||||||
vec4 OriginalSize;
|
vec4 SourceSize;
|
||||||
vec4 SourceSize;
|
} global;
|
||||||
} global;
|
|
||||||
|
/*
|
||||||
#pragma stage vertex
|
Shader Modified: Pokefan531
|
||||||
layout(location = 0) in vec4 Position;
|
Color Mangler
|
||||||
layout(location = 1) in vec2 TexCoord;
|
Author: hunterk
|
||||||
layout(location = 0) out vec2 vTexCoord;
|
License: Public domain
|
||||||
|
*/
|
||||||
void main()
|
// Shader that replicates the LCD dynamics from a GameBoy Advance
|
||||||
{
|
|
||||||
gl_Position = global.MVP * Position;
|
#pragma parameter display_gamma "Light Intensity" 1.8 1.0 2.5 0.05
|
||||||
vTexCoord = TexCoord;
|
|
||||||
}
|
#define target_gamma 2.2
|
||||||
|
#define sat 1.0
|
||||||
#pragma stage fragment
|
#define lum 1.0
|
||||||
layout(location = 0) in vec2 vTexCoord;
|
#define contrast 1.0
|
||||||
layout(location = 1) in vec2 FragCoord;
|
#define blr 0.0
|
||||||
layout(location = 0) out vec4 FragColor;
|
#define blg 0.0
|
||||||
layout(set = 0, binding = 2) uniform sampler2D Source;
|
#define blb 0.0
|
||||||
|
#define r 0.84
|
||||||
|
#define g 0.67
|
||||||
vec3 grayscale(vec3 col)
|
#define b 0.74
|
||||||
{
|
#define rg 0.08
|
||||||
// Non-conventional way to do grayscale,
|
#define rb 0.17
|
||||||
// but bSNES uses this as grayscale value.
|
#define gr 0.16
|
||||||
return vec3(dot(col, vec3(0.2126, 0.7152, 0.0722)));
|
#define gb 0.09
|
||||||
}
|
#define br 0.0
|
||||||
|
#define bg 0.26
|
||||||
void main()
|
#define overscan_percent_x 0.0
|
||||||
{
|
#define overscan_percent_y 0.0
|
||||||
//part 1
|
|
||||||
float saturation = 1.0;
|
#pragma stage vertex
|
||||||
float Display_gamma = 1.02;
|
layout(location = 0) in vec4 Position;
|
||||||
float CRT_gamma = 2.4;
|
layout(location = 1) in vec2 TexCoord;
|
||||||
float luminance = 1.0;
|
layout(location = 0) out vec2 vTexCoord;
|
||||||
|
|
||||||
vec3 gamma = vec3(CRT_gamma / Display_gamma);
|
void main()
|
||||||
vec3 res = texture(Source, vTexCoord).xyz;
|
{
|
||||||
res = mix(grayscale(res), res, saturation); // Apply saturation
|
gl_Position = global.MVP * Position;
|
||||||
res = pow(res, gamma.rgb); // Apply gamma
|
vTexCoord = TexCoord;
|
||||||
vec4 c = vec4(clamp(res * luminance, 0.0, 1.0), 1.0);
|
}
|
||||||
|
|
||||||
//part 2
|
#pragma stage fragment
|
||||||
float r = c.x;
|
layout(location = 0) in vec2 vTexCoord;
|
||||||
float g = c.y;
|
layout(location = 0) out vec4 FragColor;
|
||||||
float b = c.z;
|
layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||||
float a = c.w;
|
|
||||||
float w = r * 0.714 + g * 0.251 + b * 0.000;
|
void main()
|
||||||
float q = r * 0.071 + g * 0.643 + b * 0.216;
|
{
|
||||||
float e = r * 0.071 + g * 0.216 + b * 0.643;
|
vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma)).rgba;
|
||||||
|
vec4 avglum = vec4(0.5);
|
||||||
//part 3
|
screen = mix(screen, avglum, (1.0 - contrast));
|
||||||
saturation = 1.0;
|
|
||||||
Display_gamma = 3.6;
|
// r g b black
|
||||||
CRT_gamma = 2.4;
|
mat4 color = mat4(r, rg, rb, 0.0, //red channel
|
||||||
luminance = 1.01;
|
gr, g, gb, 0.0, //green channel
|
||||||
|
br, bg, b, 0.0, //blue channel
|
||||||
res = vec3(w, q, e);
|
blr, blg, blb, 0.0); //alpha channel; these numbers do nothing for our purposes.
|
||||||
gamma = gamma = vec3(CRT_gamma / Display_gamma);
|
|
||||||
res = mix(grayscale(res), res, saturation); // Apply saturation
|
mat4 adjust = mat4((1.0 - sat) * 0.3086 + sat, (1.0 - sat) * 0.3086, (1.0 - sat) * 0.3086, 1.0,
|
||||||
res = pow(res, gamma.rgb); // Apply gamma
|
(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,
|
||||||
FragColor = vec4(clamp(res * luminance, 0.0, 1.0), 1.0);
|
0.0, 0.0, 0.0, 1.0);
|
||||||
}
|
color *= adjust;
|
||||||
|
screen = clamp(screen * lum, 0.0, 1.0);
|
||||||
|
screen = color * screen;
|
||||||
|
FragColor = pow(screen, vec4(1.0 / params.display_gamma));
|
||||||
|
}
|
75
handheld/shaders/color/nds-color.slang
Normal file
75
handheld/shaders/color/nds-color.slang
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
#version 450
|
||||||
|
|
||||||
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
|
{
|
||||||
|
mat4 MVP;
|
||||||
|
vec4 OutputSize;
|
||||||
|
vec4 OriginalSize;
|
||||||
|
vec4 SourceSize;
|
||||||
|
} global;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Shader Modified: Pokefan531
|
||||||
|
Color Mangler
|
||||||
|
Author: hunterk
|
||||||
|
License: Public domain
|
||||||
|
*/
|
||||||
|
// Shader that replicates the LCD dynamics from an Original Nintendo DS
|
||||||
|
|
||||||
|
#define display_gamma 2.25
|
||||||
|
#define target_gamma 2.2
|
||||||
|
#define sat 1.0
|
||||||
|
#define lum 1.0
|
||||||
|
#define contrast 1.0
|
||||||
|
#define blr 0.0
|
||||||
|
#define blg 0.0
|
||||||
|
#define blb 0.0
|
||||||
|
#define r 0.77
|
||||||
|
#define g 0.65
|
||||||
|
#define b 0.74
|
||||||
|
#define rg 0.09
|
||||||
|
#define rb 0.09
|
||||||
|
#define gr 0.23
|
||||||
|
#define gb 0.11
|
||||||
|
#define br 0.0
|
||||||
|
#define bg 0.26
|
||||||
|
#define overscan_percent_x 0.0
|
||||||
|
#define overscan_percent_y 0.0
|
||||||
|
|
||||||
|
#pragma stage vertex
|
||||||
|
layout(location = 0) in vec4 Position;
|
||||||
|
layout(location = 1) in vec2 TexCoord;
|
||||||
|
layout(location = 0) out vec2 vTexCoord;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_Position = global.MVP * Position;
|
||||||
|
vTexCoord = TexCoord;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma stage fragment
|
||||||
|
layout(location = 0) in vec2 vTexCoord;
|
||||||
|
layout(location = 0) out vec4 FragColor;
|
||||||
|
layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma)).rgba;
|
||||||
|
vec4 avglum = vec4(0.5);
|
||||||
|
screen = mix(screen, avglum, (1.0 - contrast));
|
||||||
|
|
||||||
|
// r g b black
|
||||||
|
mat4 color = mat4(r, rg, rb, 0.0, //red channel
|
||||||
|
gr, g, gb, 0.0, //green channel
|
||||||
|
br, bg, b, 0.0, //blue channel
|
||||||
|
blr, blg, blb, 0.0); //alpha channel; these numbers do nothing for our purposes.
|
||||||
|
|
||||||
|
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;
|
||||||
|
FragColor = pow(screen, vec4(1.0 / display_gamma));
|
||||||
|
}
|
75
handheld/shaders/color/psp-color.slang
Normal file
75
handheld/shaders/color/psp-color.slang
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
#version 450
|
||||||
|
|
||||||
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
|
{
|
||||||
|
mat4 MVP;
|
||||||
|
vec4 OutputSize;
|
||||||
|
vec4 OriginalSize;
|
||||||
|
vec4 SourceSize;
|
||||||
|
} global;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Shader Modified: Pokefan531
|
||||||
|
Color Mangler
|
||||||
|
Author: hunterk
|
||||||
|
License: Public domain
|
||||||
|
*/
|
||||||
|
// Shader that replicates the LCD dynamics from PSP 1000 and PSP 2000
|
||||||
|
|
||||||
|
#define display_gamma 2.2
|
||||||
|
#define target_gamma 2.21
|
||||||
|
#define sat 1.0
|
||||||
|
#define lum 1.0
|
||||||
|
#define contrast 1.0
|
||||||
|
#define blr 0.0
|
||||||
|
#define blg 0.0
|
||||||
|
#define blb 0.0
|
||||||
|
#define r 0.97
|
||||||
|
#define g 0.75
|
||||||
|
#define b 0.995
|
||||||
|
#define rg 0.01
|
||||||
|
#define rb 0.0025
|
||||||
|
#define gr 0.005
|
||||||
|
#define gb 0.0025
|
||||||
|
#define br 0.0
|
||||||
|
#define bg 0.24
|
||||||
|
#define overscan_percent_x 0.0
|
||||||
|
#define overscan_percent_y 0.0
|
||||||
|
|
||||||
|
#pragma stage vertex
|
||||||
|
layout(location = 0) in vec4 Position;
|
||||||
|
layout(location = 1) in vec2 TexCoord;
|
||||||
|
layout(location = 0) out vec2 vTexCoord;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_Position = global.MVP * Position;
|
||||||
|
vTexCoord = TexCoord;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma stage fragment
|
||||||
|
layout(location = 0) in vec2 vTexCoord;
|
||||||
|
layout(location = 0) out vec4 FragColor;
|
||||||
|
layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma)).rgba;
|
||||||
|
vec4 avglum = vec4(0.5);
|
||||||
|
screen = mix(screen, avglum, (1.0 - contrast));
|
||||||
|
|
||||||
|
// r g b black
|
||||||
|
mat4 color = mat4(r, rg, rb, 0.0, //red channel
|
||||||
|
gr, g, gb, 0.0, //green channel
|
||||||
|
br, bg, b, 0.0, //blue channel
|
||||||
|
blr, blg, blb, 0.0); //alpha channel; these numbers do nothing for our purposes.
|
||||||
|
|
||||||
|
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;
|
||||||
|
FragColor = pow(screen, vec4(1.0 / display_gamma));
|
||||||
|
}
|
81
handheld/shaders/color/vba-color.slang
Normal file
81
handheld/shaders/color/vba-color.slang
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
#version 450
|
||||||
|
|
||||||
|
layout(push_constant) uniform Push
|
||||||
|
{
|
||||||
|
float target_gamma;
|
||||||
|
} params;
|
||||||
|
|
||||||
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
|
{
|
||||||
|
mat4 MVP;
|
||||||
|
vec4 OutputSize;
|
||||||
|
vec4 OriginalSize;
|
||||||
|
vec4 SourceSize;
|
||||||
|
} global;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Shader Modified: Pokefan531
|
||||||
|
Color Mangler
|
||||||
|
Author: hunterk
|
||||||
|
License: Public domain
|
||||||
|
*/
|
||||||
|
// Shader that replicates the LCD dynamics from a GameBoy Advance
|
||||||
|
|
||||||
|
#pragma parameter target_gamma "Darken Intensity" 2.9 1.0 2.9 0.05
|
||||||
|
|
||||||
|
#define display_gamma 1.45
|
||||||
|
#define sat 1.0
|
||||||
|
#define lum 1.0
|
||||||
|
#define contrast 1.0
|
||||||
|
#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 gb 0.24
|
||||||
|
#define br 0.0
|
||||||
|
#define bg 0.24
|
||||||
|
#define overscan_percent_x 0.0
|
||||||
|
#define overscan_percent_y 0.0
|
||||||
|
|
||||||
|
#pragma stage vertex
|
||||||
|
layout(location = 0) in vec4 Position;
|
||||||
|
layout(location = 1) in vec2 TexCoord;
|
||||||
|
layout(location = 0) out vec2 vTexCoord;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_Position = global.MVP * Position;
|
||||||
|
vTexCoord = TexCoord;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma stage fragment
|
||||||
|
layout(location = 0) in vec2 vTexCoord;
|
||||||
|
layout(location = 0) out vec4 FragColor;
|
||||||
|
layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 screen = pow(texture(Source, vTexCoord), vec4(params.target_gamma)).rgba;
|
||||||
|
vec4 avglum = vec4(0.5);
|
||||||
|
screen = mix(screen, avglum, (1.0 - contrast));
|
||||||
|
|
||||||
|
// r g b black
|
||||||
|
mat4 color = mat4(r, rg, rb, 0.0, //red channel
|
||||||
|
gr, g, gb, 0.0, //green channel
|
||||||
|
br, bg, b, 0.0, //blue channel
|
||||||
|
blr, blg, blb, 0.0); //alpha channel; these numbers do nothing for our purposes.
|
||||||
|
|
||||||
|
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;
|
||||||
|
FragColor = pow(screen, vec4(1.0 / display_gamma));
|
||||||
|
}
|
5
handheld/vba-color.slangp
Normal file
5
handheld/vba-color.slangp
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
shaders = 1
|
||||||
|
|
||||||
|
shader0 = shaders/color/vba-color.slang
|
||||||
|
filter_linear0 = false
|
||||||
|
scale_type_0 = source
|
Loading…
Reference in a new issue