mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-22 15:51:30 +11:00
Merge pull request #91 from jdgleaver/simpletex_lcd-cc-fix
simpletex_lcd: Fix GBA/GBC colour correction
This commit is contained in:
commit
2fe1341361
|
@ -121,6 +121,8 @@ const float LINE_WEIGHT_B = 8.0 / 3.0;
|
|||
const float INV_BG_TEXTURE_SIZE = 1.0 / BG_TEXTURE_SIZE;
|
||||
|
||||
// Colour correction
|
||||
#define TARGET_GAMMA 2.2
|
||||
const float INV_DISPLAY_GAMMA = 1.0 / 2.2;
|
||||
#define CC_R 0.84
|
||||
#define CC_G 0.66
|
||||
#define CC_B 0.81
|
||||
|
@ -143,8 +145,12 @@ void main()
|
|||
// Get colour of current pixel
|
||||
vec3 colour = texture(Source, registers.SourceSize.zw * imgCenterCoord.xy).rgb;
|
||||
|
||||
// Darken colours (if required...)
|
||||
colour.rgb = pow(colour.rgb, vec3(1.0 + registers.DARKEN_COLOUR));
|
||||
// Darken colours (if required...) and apply colour correction
|
||||
colour.rgb = pow(colour.rgb, vec3(TARGET_GAMMA + registers.DARKEN_COLOUR));
|
||||
colour.rgb = mat3(CC_R, CC_RG, CC_RB,
|
||||
CC_GR, CC_G, CC_GB,
|
||||
CC_BR, CC_BG, CC_B) * colour.rgb;
|
||||
colour.rgb = clamp(pow(colour.rgb, vec3(INV_DISPLAY_GAMMA)), 0.0, 1.0);
|
||||
|
||||
// Generate grid pattern...
|
||||
vec2 distFromCenter = abs(imgCenterCoord.xy - imgPixelCoord.xy);
|
||||
|
@ -182,12 +188,6 @@ void main()
|
|||
// (lineWeight == 1 -> set colour to value specified by DARKEN_GRID)
|
||||
colour.rgb = mix(colour.rgb, vec3(1.0 - registers.DARKEN_GRID), lineWeight);
|
||||
|
||||
// Apply colour correction
|
||||
colour.rgb = mat3(CC_R, CC_RG, CC_RB,
|
||||
CC_GR, CC_G, CC_GB,
|
||||
CC_BR, CC_BG, CC_B) * colour.rgb;
|
||||
colour.rgb = clamp(colour.rgb, 0.0, 1.0);
|
||||
|
||||
// Get background sample point
|
||||
// > NB: external texture coordinates are referenced in a completely different fashion
|
||||
// here than they are in GLSL shaders...
|
||||
|
|
|
@ -121,6 +121,8 @@ const float LINE_WEIGHT_B = 8.0 / 3.0;
|
|||
const float INV_BG_TEXTURE_SIZE = 1.0 / BG_TEXTURE_SIZE;
|
||||
|
||||
// Colour correction
|
||||
#define TARGET_GAMMA 2.2
|
||||
const float INV_DISPLAY_GAMMA = 1.0 / 2.2;
|
||||
#define CC_R 0.84
|
||||
#define CC_G 0.66
|
||||
#define CC_B 0.81
|
||||
|
@ -143,8 +145,12 @@ void main()
|
|||
// Get colour of current pixel
|
||||
vec3 colour = texture(Source, registers.SourceSize.zw * imgCenterCoord.xy).rgb;
|
||||
|
||||
// Darken colours (if required...)
|
||||
colour.rgb = pow(colour.rgb, vec3(1.0 + registers.DARKEN_COLOUR));
|
||||
// Darken colours (if required...) and apply colour correction
|
||||
colour.rgb = pow(colour.rgb, vec3(TARGET_GAMMA + registers.DARKEN_COLOUR));
|
||||
colour.rgb = mat3(CC_R, CC_RG, CC_RB,
|
||||
CC_GR, CC_G, CC_GB,
|
||||
CC_BR, CC_BG, CC_B) * colour.rgb;
|
||||
colour.rgb = clamp(pow(colour.rgb, vec3(INV_DISPLAY_GAMMA)), 0.0, 1.0);
|
||||
|
||||
// Generate grid pattern...
|
||||
vec2 distFromCenter = abs(imgCenterCoord.xy - imgPixelCoord.xy);
|
||||
|
@ -182,12 +188,6 @@ void main()
|
|||
// (lineWeight == 1 -> set colour to value specified by DARKEN_GRID)
|
||||
colour.rgb = mix(colour.rgb, vec3(1.0 - registers.DARKEN_GRID), lineWeight);
|
||||
|
||||
// Apply colour correction
|
||||
colour.rgb = mat3(CC_R, CC_RG, CC_RB,
|
||||
CC_GR, CC_G, CC_GB,
|
||||
CC_BR, CC_BG, CC_B) * colour.rgb;
|
||||
colour.rgb = clamp(colour.rgb, 0.0, 1.0);
|
||||
|
||||
// Get background sample point
|
||||
// > NB: external texture coordinates are referenced in a completely different fashion
|
||||
// here than they are in GLSL shaders...
|
||||
|
|
|
@ -121,6 +121,8 @@ const float LINE_WEIGHT_B = 8.0 / 3.0;
|
|||
const float INV_BG_TEXTURE_SIZE = 1.0 / BG_TEXTURE_SIZE;
|
||||
|
||||
// Colour correction
|
||||
#define TARGET_GAMMA 2.2
|
||||
const float INV_DISPLAY_GAMMA = 1.0 / 2.2;
|
||||
#define CC_R 0.86629
|
||||
#define CC_G 0.70857
|
||||
#define CC_B 0.77215
|
||||
|
@ -143,8 +145,12 @@ void main()
|
|||
// Get colour of current pixel
|
||||
vec3 colour = texture(Source, registers.SourceSize.zw * imgCenterCoord.xy).rgb;
|
||||
|
||||
// Darken colours (if required...)
|
||||
colour.rgb = pow(colour.rgb, vec3(1.0 + registers.DARKEN_COLOUR));
|
||||
// Darken colours (if required...) and apply colour correction
|
||||
colour.rgb = pow(colour.rgb, vec3(TARGET_GAMMA + registers.DARKEN_COLOUR));
|
||||
colour.rgb = mat3(CC_R, CC_RG, CC_RB,
|
||||
CC_GR, CC_G, CC_GB,
|
||||
CC_BR, CC_BG, CC_B) * colour.rgb;
|
||||
colour.rgb = clamp(pow(colour.rgb, vec3(INV_DISPLAY_GAMMA)), 0.0, 1.0);
|
||||
|
||||
// Generate grid pattern...
|
||||
vec2 distFromCenter = abs(imgCenterCoord.xy - imgPixelCoord.xy);
|
||||
|
@ -182,12 +188,6 @@ void main()
|
|||
// (lineWeight == 1 -> set colour to value specified by DARKEN_GRID)
|
||||
colour.rgb = mix(colour.rgb, vec3(1.0 - registers.DARKEN_GRID), lineWeight);
|
||||
|
||||
// Apply colour correction
|
||||
colour.rgb = mat3(CC_R, CC_RG, CC_RB,
|
||||
CC_GR, CC_G, CC_GB,
|
||||
CC_BR, CC_BG, CC_B) * colour.rgb;
|
||||
colour.rgb = clamp(colour.rgb, 0.0, 1.0);
|
||||
|
||||
// Get background sample point
|
||||
// > NB: external texture coordinates are referenced in a completely different fashion
|
||||
// here than they are in GLSL shaders...
|
||||
|
|
|
@ -121,6 +121,8 @@ const float LINE_WEIGHT_B = 8.0 / 3.0;
|
|||
const float INV_BG_TEXTURE_SIZE = 1.0 / BG_TEXTURE_SIZE;
|
||||
|
||||
// Colour correction
|
||||
#define TARGET_GAMMA 2.2
|
||||
const float INV_DISPLAY_GAMMA = 1.0 / 2.2;
|
||||
#define CC_R 0.86629
|
||||
#define CC_G 0.70857
|
||||
#define CC_B 0.77215
|
||||
|
@ -143,8 +145,12 @@ void main()
|
|||
// Get colour of current pixel
|
||||
vec3 colour = texture(Source, registers.SourceSize.zw * imgCenterCoord.xy).rgb;
|
||||
|
||||
// Darken colours (if required...)
|
||||
colour.rgb = pow(colour.rgb, vec3(1.0 + registers.DARKEN_COLOUR));
|
||||
// Darken colours (if required...) and apply colour correction
|
||||
colour.rgb = pow(colour.rgb, vec3(TARGET_GAMMA + registers.DARKEN_COLOUR));
|
||||
colour.rgb = mat3(CC_R, CC_RG, CC_RB,
|
||||
CC_GR, CC_G, CC_GB,
|
||||
CC_BR, CC_BG, CC_B) * colour.rgb;
|
||||
colour.rgb = clamp(pow(colour.rgb, vec3(INV_DISPLAY_GAMMA)), 0.0, 1.0);
|
||||
|
||||
// Generate grid pattern...
|
||||
vec2 distFromCenter = abs(imgCenterCoord.xy - imgPixelCoord.xy);
|
||||
|
@ -182,12 +188,6 @@ void main()
|
|||
// (lineWeight == 1 -> set colour to value specified by DARKEN_GRID)
|
||||
colour.rgb = mix(colour.rgb, vec3(1.0 - registers.DARKEN_GRID), lineWeight);
|
||||
|
||||
// Apply colour correction
|
||||
colour.rgb = mat3(CC_R, CC_RG, CC_RB,
|
||||
CC_GR, CC_G, CC_GB,
|
||||
CC_BR, CC_BG, CC_B) * colour.rgb;
|
||||
colour.rgb = clamp(colour.rgb, 0.0, 1.0);
|
||||
|
||||
// Get background sample point
|
||||
// > NB: external texture coordinates are referenced in a completely different fashion
|
||||
// here than they are in GLSL shaders...
|
||||
|
|
|
@ -14,8 +14,8 @@ BACKGROUND = "shaders/simpletex_lcd/png/4k/textured_paper.png"
|
|||
BACKGROUND_linear = false
|
||||
|
||||
parameters = "GRID_INTENSITY;GRID_WIDTH;GRID_BIAS;DARKEN_GRID;DARKEN_COLOUR"
|
||||
GRID_INTENSITY = "0.9"
|
||||
GRID_INTENSITY = "0.65"
|
||||
GRID_WIDTH = "0.6"
|
||||
GRID_BIAS = "0.65"
|
||||
GRID_BIAS = "0.6"
|
||||
DARKEN_GRID = "0.0"
|
||||
DARKEN_COLOUR = "0.4"
|
||||
DARKEN_COLOUR = "0.35"
|
||||
|
|
|
@ -14,8 +14,8 @@ BACKGROUND = "shaders/simpletex_lcd/png/2k/textured_paper.png"
|
|||
BACKGROUND_linear = false
|
||||
|
||||
parameters = "GRID_INTENSITY;GRID_WIDTH;GRID_BIAS;DARKEN_GRID;DARKEN_COLOUR"
|
||||
GRID_INTENSITY = "0.9"
|
||||
GRID_INTENSITY = "0.65"
|
||||
GRID_WIDTH = "0.6"
|
||||
GRID_BIAS = "0.65"
|
||||
GRID_BIAS = "0.6"
|
||||
DARKEN_GRID = "0.0"
|
||||
DARKEN_COLOUR = "0.4"
|
||||
DARKEN_COLOUR = "0.35"
|
||||
|
|
|
@ -14,8 +14,8 @@ BACKGROUND = "shaders/simpletex_lcd/png/4k/textured_paper.png"
|
|||
BACKGROUND_linear = false
|
||||
|
||||
parameters = "GRID_INTENSITY;GRID_WIDTH;GRID_BIAS;DARKEN_GRID;DARKEN_COLOUR"
|
||||
GRID_INTENSITY = "1.0"
|
||||
GRID_WIDTH = "0.9"
|
||||
GRID_BIAS = "0.65"
|
||||
GRID_INTENSITY = "0.8"
|
||||
GRID_WIDTH = "0.65"
|
||||
GRID_BIAS = "0.5"
|
||||
DARKEN_GRID = "0.0"
|
||||
DARKEN_COLOUR = "0.3"
|
||||
DARKEN_COLOUR = "0.05"
|
||||
|
|
|
@ -14,8 +14,8 @@ BACKGROUND = "shaders/simpletex_lcd/png/2k/textured_paper.png"
|
|||
BACKGROUND_linear = false
|
||||
|
||||
parameters = "GRID_INTENSITY;GRID_WIDTH;GRID_BIAS;DARKEN_GRID;DARKEN_COLOUR"
|
||||
GRID_INTENSITY = "1.0"
|
||||
GRID_WIDTH = "0.9"
|
||||
GRID_BIAS = "0.65"
|
||||
GRID_INTENSITY = "0.8"
|
||||
GRID_WIDTH = "0.65"
|
||||
GRID_BIAS = "0.5"
|
||||
DARKEN_GRID = "0.0"
|
||||
DARKEN_COLOUR = "0.3"
|
||||
DARKEN_COLOUR = "0.05"
|
||||
|
|
|
@ -14,8 +14,8 @@ BACKGROUND = "shaders/simpletex_lcd/png/4k/textured_paper.png"
|
|||
BACKGROUND_linear = false
|
||||
|
||||
parameters = "GRID_INTENSITY;GRID_WIDTH;GRID_BIAS;DARKEN_GRID;DARKEN_COLOUR"
|
||||
GRID_INTENSITY = "1.0"
|
||||
GRID_WIDTH = "0.8"
|
||||
GRID_BIAS = "0.6"
|
||||
GRID_INTENSITY = "0.8"
|
||||
GRID_WIDTH = "0.65"
|
||||
GRID_BIAS = "0.5"
|
||||
DARKEN_GRID = "0.0"
|
||||
DARKEN_COLOUR = "0.5"
|
||||
DARKEN_COLOUR = "0.05"
|
||||
|
|
|
@ -14,8 +14,8 @@ BACKGROUND = "shaders/simpletex_lcd/png/2k/textured_paper.png"
|
|||
BACKGROUND_linear = false
|
||||
|
||||
parameters = "GRID_INTENSITY;GRID_WIDTH;GRID_BIAS;DARKEN_GRID;DARKEN_COLOUR"
|
||||
GRID_INTENSITY = "1.0"
|
||||
GRID_WIDTH = "0.8"
|
||||
GRID_BIAS = "0.6"
|
||||
GRID_INTENSITY = "0.8"
|
||||
GRID_WIDTH = "0.65"
|
||||
GRID_BIAS = "0.5"
|
||||
DARKEN_GRID = "0.0"
|
||||
DARKEN_COLOUR = "0.5"
|
||||
DARKEN_COLOUR = "0.05"
|
||||
|
|
Loading…
Reference in a new issue