diff --git a/handheld/NSO-gba-color.slangp b/handheld/NSO-gba-color.slangp new file mode 100644 index 0000000..ac18496 --- /dev/null +++ b/handheld/NSO-gba-color.slangp @@ -0,0 +1,6 @@ +shaders = 1 + +shader0 = shaders/color/NSO-gba-color.slang +filter_linear0 = false +scale_type0 = source +scale0 = 1.0 diff --git a/handheld/NSO-gbc-color.slangp b/handheld/NSO-gbc-color.slangp new file mode 100644 index 0000000..8582682 --- /dev/null +++ b/handheld/NSO-gbc-color.slangp @@ -0,0 +1,6 @@ +shaders = 1 + +shader0 = shaders/color/NSO-gbc-color.slang +filter_linear0 = false +scale_type0 = source +scale0 = 1.0 diff --git a/handheld/SP101-color.slangp b/handheld/SP101-color.slangp new file mode 100644 index 0000000..d8843b1 --- /dev/null +++ b/handheld/SP101-color.slangp @@ -0,0 +1,6 @@ +shaders = 1 + +shader0 = shaders/color/sp101-color.slang +filter_linear0 = false +scale_type0 = source +scale0 = 1.0 diff --git a/handheld/SwitchOLED-color.slangp b/handheld/SwitchOLED-color.slangp new file mode 100644 index 0000000..a1f744c --- /dev/null +++ b/handheld/SwitchOLED-color.slangp @@ -0,0 +1,6 @@ +shaders = 1 + +shader0 = shaders/color/SwitchOLED-color.slang +filter_linear0 = false +scale_type0 = source +scale0 = 1.0 diff --git a/handheld/gbc-dev.slangp b/handheld/gbc-dev.slangp new file mode 100644 index 0000000..6c80fcf --- /dev/null +++ b/handheld/gbc-dev.slangp @@ -0,0 +1,6 @@ +shaders = 1 + +shader0 = shaders/color/gbc-dev.slang +filter_linear0 = false +scale_type_0 = source +scale0 = 1.0 diff --git a/handheld/lcd-grid-v2-gba-color-motionblur.slangp b/handheld/lcd-grid-v2-gba-color-motionblur.slangp index eb25630..dddb8b4 100644 --- a/handheld/lcd-grid-v2-gba-color-motionblur.slangp +++ b/handheld/lcd-grid-v2-gba-color-motionblur.slangp @@ -5,28 +5,29 @@ filter_linear0 = "false" scale_type0 = "source" scale0 = "1.0" -shader1 = "shaders/color/gba-color.slang" +shader1 = "shaders/lcd-cgwg/lcd-grid-v2.slang" filter_linear1 = "false" -scale_type1 = "source" +scale_type1 = "viewport" scale1 = "1.0" -shader2 = "shaders/lcd-cgwg/lcd-grid-v2.slang" +shader2 = "shaders/color/gba-color.slang" filter_linear2 = "false" -scale_type2 = "viewport" +scale_type2 = "source" scale2 = "1.0" -parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR" -RSUBPIX_R = "0.750000" -RSUBPIX_G = "0.000000" -RSUBPIX_B = "0.000000" -GSUBPIX_R = "0.000000" -GSUBPIX_G = "0.750000" -GSUBPIX_B = "0.000000" -BSUBPIX_R = "0.000000" -BSUBPIX_G = "0.000000" -BSUBPIX_B = "0.750000" -gain = "1.500000" -gamma = "2.200000" -blacklevel = "0.000000" -ambient = "0.000000" -BGR = "1.000000" +parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR;darken_screen" +RSUBPIX_R = "1" +RSUBPIX_G = "0" +RSUBPIX_B = "0" +GSUBPIX_R = "0" +GSUBPIX_G = "1" +GSUBPIX_B = "0" +BSUBPIX_R = "0" +BSUBPIX_G = "0" +BSUBPIX_B = "1" +gain = "1" +gamma = "2.2" +blacklevel = "0" +ambient = "0" +BGR = "1" +darken_screen = "0" diff --git a/handheld/lcd-grid-v2-gba-color.slangp b/handheld/lcd-grid-v2-gba-color.slangp index 78d2956..199f367 100644 --- a/handheld/lcd-grid-v2-gba-color.slangp +++ b/handheld/lcd-grid-v2-gba-color.slangp @@ -1,27 +1,28 @@ shaders = "2" -shader0 = "shaders/color/gba-color.slang" +shader0 = "shaders/lcd-cgwg/lcd-grid-v2.slang" filter_linear0 = "false" -scale_type0 = "source" +scale_type0 = "viewport" scale0 = "1.0" -shader1 = "shaders/lcd-cgwg/lcd-grid-v2.slang" +shader1 = "shaders/color/gba-color.slang" filter_linear1 = "false" -scale_type1 = "viewport" +scale_type1 = "source" scale1 = "1.0" -parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR" -RSUBPIX_R = "0.750000" -RSUBPIX_G = "0.000000" -RSUBPIX_B = "0.000000" -GSUBPIX_R = "0.000000" -GSUBPIX_G = "0.750000" -GSUBPIX_B = "0.000000" -BSUBPIX_R = "0.000000" -BSUBPIX_G = "0.000000" -BSUBPIX_B = "0.750000" -gain = "1.500000" -gamma = "2.200000" -blacklevel = "0.000000" -ambient = "0.000000" -BGR = "1.000000" +parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR;darken_screen" +RSUBPIX_R = "1" +RSUBPIX_G = "0" +RSUBPIX_B = "0" +GSUBPIX_R = "0" +GSUBPIX_G = "1" +GSUBPIX_B = "0" +BSUBPIX_R = "0" +BSUBPIX_G = "0" +BSUBPIX_B = "1" +gain = "1" +gamma = "2.2" +blacklevel = "0" +ambient = "0" +BGR = "1" +darken_screen = "0" diff --git a/handheld/lcd-grid-v2-gbc-color-motionblur.slangp b/handheld/lcd-grid-v2-gbc-color-motionblur.slangp index e259982..afe87ae 100644 --- a/handheld/lcd-grid-v2-gbc-color-motionblur.slangp +++ b/handheld/lcd-grid-v2-gbc-color-motionblur.slangp @@ -5,28 +5,29 @@ filter_linear0 = "false" scale_type0 = "source" scale0 = "1.0" -shader1 = "shaders/color/gbc-color.slang" +shader1 = "shaders/lcd-cgwg/lcd-grid-v2.slang" filter_linear1 = "false" -scale_type1 = "source" +scale_type1 = "viewport" scale1 = "1.0" -shader2 = "shaders/lcd-cgwg/lcd-grid-v2.slang" +shader2 = "shaders/color/gbc-color.slang" filter_linear2 = "false" -scale_type2 = "viewport" +scale_type2 = "source" scale2 = "1.0" -parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR" -RSUBPIX_R = "0.750000" -RSUBPIX_G = "0.000000" -RSUBPIX_B = "0.000000" -GSUBPIX_R = "0.000000" -GSUBPIX_G = "0.750000" -GSUBPIX_B = "0.000000" -BSUBPIX_R = "0.000000" -BSUBPIX_G = "0.000000" -BSUBPIX_B = "0.750000" -gain = "1.500000" -gamma = "2.200000" -blacklevel = "0.000000" -ambient = "0.000000" -BGR = "0.0" +parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR;lighten_screen" +RSUBPIX_R = "1" +RSUBPIX_G = "0" +RSUBPIX_B = "0" +GSUBPIX_R = "0" +GSUBPIX_G = "1" +GSUBPIX_B = "0" +BSUBPIX_R = "0" +BSUBPIX_G = "0" +BSUBPIX_B = "1" +gain = "1" +gamma = "2.2" +blacklevel = "0" +ambient = "0" +BGR = "0" +lighten_screen = "0" diff --git a/handheld/lcd-grid-v2-gbc-color.slangp b/handheld/lcd-grid-v2-gbc-color.slangp index 9b09339..bb6316d 100644 --- a/handheld/lcd-grid-v2-gbc-color.slangp +++ b/handheld/lcd-grid-v2-gbc-color.slangp @@ -1,27 +1,28 @@ shaders = "2" -shader0 = "shaders/color/gbc-color.slang" +shader0 = "shaders/lcd-cgwg/lcd-grid-v2.slang" filter_linear0 = "false" -scale_type0 = "source" +scale_type0 = "viewport" scale0 = "1.0" -shader1 = "shaders/lcd-cgwg/lcd-grid-v2.slang" +shader1 = "shaders/color/gbc-color.slang" filter_linear1 = "false" -scale_type1 = "viewport" +scale_type1 = "source" scale1 = "1.0" -parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR" -RSUBPIX_R = "0.750000" -RSUBPIX_G = "0.000000" -RSUBPIX_B = "0.000000" -GSUBPIX_R = "0.000000" -GSUBPIX_G = "0.750000" -GSUBPIX_B = "0.000000" -BSUBPIX_R = "0.000000" -BSUBPIX_G = "0.000000" -BSUBPIX_B = "0.750000" -gain = "1.500000" -gamma = "2.200000" -blacklevel = "0.000000" -ambient = "0.000000" -BGR = "0.0" +parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR;lighten_screen" +RSUBPIX_R = "1" +RSUBPIX_G = "0" +RSUBPIX_B = "0" +GSUBPIX_R = "0" +GSUBPIX_G = "1" +GSUBPIX_B = "0" +BSUBPIX_R = "0" +BSUBPIX_G = "0" +BSUBPIX_B = "1" +gain = "1" +gamma = "2.2" +blacklevel = "0" +ambient = "0" +BGR = "0" +lighten_screen = "0" diff --git a/handheld/lcd-grid-v2-nds-color-motionblur.slangp b/handheld/lcd-grid-v2-nds-color-motionblur.slangp index 9f46c7c..bdb55c0 100644 --- a/handheld/lcd-grid-v2-nds-color-motionblur.slangp +++ b/handheld/lcd-grid-v2-nds-color-motionblur.slangp @@ -5,28 +5,28 @@ filter_linear0 = "false" scale_type0 = "source" scale0 = "1.0" -shader1 = "shaders/color/nds-color.slang" +shader1 = "shaders/lcd-cgwg/lcd-grid-v2.slang" filter_linear1 = "false" -scale_type1 = "source" +scale_type1 = "viewport" scale1 = "1.0" -shader2 = "shaders/lcd-cgwg/lcd-grid-v2.slang" +shader2 = "shaders/color/nds-color.slang" filter_linear2 = "false" -scale_type2 = "viewport" +scale_type2 = "source" scale2 = "1.0" parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR" -RSUBPIX_R = "0.750000" -RSUBPIX_G = "0.000000" -RSUBPIX_B = "0.000000" -GSUBPIX_R = "0.000000" -GSUBPIX_G = "0.750000" -GSUBPIX_B = "0.000000" -BSUBPIX_R = "0.000000" -BSUBPIX_G = "0.000000" -BSUBPIX_B = "0.750000" -gain = "1.500000" -gamma = "2.200000" -blacklevel = "0.000000" -ambient = "0.000000" -BGR = "1.000000" +RSUBPIX_R = "1" +RSUBPIX_G = "0" +RSUBPIX_B = "0" +GSUBPIX_R = "0" +GSUBPIX_G = "1" +GSUBPIX_B = "0" +BSUBPIX_R = "0" +BSUBPIX_G = "0" +BSUBPIX_B = "1" +gain = "1" +gamma = "2.2" +blacklevel = "0" +ambient = "0" +BGR = "0" diff --git a/handheld/lcd-grid-v2-nds-color.slangp b/handheld/lcd-grid-v2-nds-color.slangp index ecb3184..1cbb4e2 100644 --- a/handheld/lcd-grid-v2-nds-color.slangp +++ b/handheld/lcd-grid-v2-nds-color.slangp @@ -1,27 +1,27 @@ shaders = "2" -shader0 = "shaders/color/nds-color.slang" +shader0 = "shaders/lcd-cgwg/lcd-grid-v2.slang" filter_linear0 = "false" -scale_type0 = "source" +scale_type0 = "viewport" scale0 = "1.0" -shader1 = "shaders/lcd-cgwg/lcd-grid-v2.slang" +shader1 = "shaders/color/nds-color.slang" filter_linear1 = "false" -scale_type1 = "viewport" +scale_type1 = "source" scale1 = "1.0" parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR" -RSUBPIX_R = "0.750000" -RSUBPIX_G = "0.000000" -RSUBPIX_B = "0.000000" -GSUBPIX_R = "0.000000" -GSUBPIX_G = "0.750000" -GSUBPIX_B = "0.000000" -BSUBPIX_R = "0.000000" -BSUBPIX_G = "0.000000" -BSUBPIX_B = "0.750000" -gain = "1.500000" -gamma = "2.200000" -blacklevel = "0.000000" -ambient = "0.000000" -BGR = "1.000000" +RSUBPIX_R = "1" +RSUBPIX_G = "0" +RSUBPIX_B = "0" +GSUBPIX_R = "0" +GSUBPIX_G = "1" +GSUBPIX_B = "0" +BSUBPIX_R = "0" +BSUBPIX_G = "0" +BSUBPIX_B = "1" +gain = "1" +gamma = "2.2" +blacklevel = "0" +ambient = "0" +BGR = "0" diff --git a/handheld/lcd-grid-v2-palm-color-motionblur.slangp b/handheld/lcd-grid-v2-palm-color-motionblur.slangp index c97a12b..a695817 100644 --- a/handheld/lcd-grid-v2-palm-color-motionblur.slangp +++ b/handheld/lcd-grid-v2-palm-color-motionblur.slangp @@ -5,28 +5,28 @@ filter_linear0 = "false" scale_type0 = "source" scale0 = "1.0" -shader1 = "shaders/color/palm-color.slang" +shader1 = "shaders/lcd-cgwg/lcd-grid-v2.slang" filter_linear1 = "false" -scale_type1 = "source" +scale_type1 = "viewport" scale1 = "1.0" -shader2 = "shaders/lcd-cgwg/lcd-grid-v2.slang" +shader2 = "shaders/color/palm-color.slang" filter_linear2 = "false" -scale_type2 = "viewport" +scale_type2 = "source" scale2 = "1.0" parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR" -RSUBPIX_R = "0.750000" -RSUBPIX_G = "0.000000" -RSUBPIX_B = "0.000000" -GSUBPIX_R = "0.000000" -GSUBPIX_G = "0.750000" -GSUBPIX_B = "0.000000" -BSUBPIX_R = "0.000000" -BSUBPIX_G = "0.000000" -BSUBPIX_B = "0.750000" -gain = "1.500000" -gamma = "2.200000" -blacklevel = "0.000000" -ambient = "0.000000" -BGR = "1.000000" +RSUBPIX_R = "1" +RSUBPIX_G = "0" +RSUBPIX_B = "0" +GSUBPIX_R = "0" +GSUBPIX_G = "1" +GSUBPIX_B = "0" +BSUBPIX_R = "0" +BSUBPIX_G = "0" +BSUBPIX_B = "1" +gain = "1" +gamma = "2.2" +blacklevel = "0" +ambient = "0" +BGR = "0" diff --git a/handheld/lcd-grid-v2-palm-color.slangp b/handheld/lcd-grid-v2-palm-color.slangp index ed2e20e..897eb33 100644 --- a/handheld/lcd-grid-v2-palm-color.slangp +++ b/handheld/lcd-grid-v2-palm-color.slangp @@ -1,27 +1,27 @@ shaders = "2" -shader0 = "shaders/color/palm-color.slang" +shader0 = "shaders/lcd-cgwg/lcd-grid-v2.slang" filter_linear0 = "false" -scale_type0 = "source" +scale_type0 = "viewport" scale0 = "1.0" -shader1 = "shaders/lcd-cgwg/lcd-grid-v2.slang" +shader1 = "shaders/color/palm-color.slang" filter_linear1 = "false" -scale_type1 = "viewport" +scale_type1 = "source" scale1 = "1.0" parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR" -RSUBPIX_R = "0.750000" -RSUBPIX_G = "0.000000" -RSUBPIX_B = "0.000000" -GSUBPIX_R = "0.000000" -GSUBPIX_G = "0.750000" -GSUBPIX_B = "0.000000" -BSUBPIX_R = "0.000000" -BSUBPIX_G = "0.000000" -BSUBPIX_B = "0.750000" -gain = "1.500000" -gamma = "2.200000" -blacklevel = "0.000000" -ambient = "0.000000" -BGR = "1.000000" +RSUBPIX_R = "1" +RSUBPIX_G = "0" +RSUBPIX_B = "0" +GSUBPIX_R = "0" +GSUBPIX_G = "1" +GSUBPIX_B = "0" +BSUBPIX_R = "0" +BSUBPIX_G = "0" +BSUBPIX_B = "1" +gain = "1" +gamma = "2.2" +blacklevel = "0" +ambient = "0" +BGR = "0" diff --git a/handheld/lcd-grid-v2-psp-color-motionblur.slangp b/handheld/lcd-grid-v2-psp-color-motionblur.slangp index e159209..6e0e6e2 100644 --- a/handheld/lcd-grid-v2-psp-color-motionblur.slangp +++ b/handheld/lcd-grid-v2-psp-color-motionblur.slangp @@ -5,28 +5,28 @@ filter_linear0 = "false" scale_type0 = "source" scale0 = "1.0" -shader1 = "shaders/color/psp-color.slang" +shader1 = "shaders/lcd-cgwg/lcd-grid-v2.slang" filter_linear1 = "false" -scale_type1 = "source" +scale_type1 = "viewport" scale1 = "1.0" -shader2 = "shaders/lcd-cgwg/lcd-grid-v2.slang" +shader2 = "shaders/color/psp-color.slang" filter_linear2 = "false" -scale_type2 = "viewport" +scale_type2 = "source" scale2 = "1.0" parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR" -RSUBPIX_R = "0.750000" -RSUBPIX_G = "0.000000" -RSUBPIX_B = "0.000000" -GSUBPIX_R = "0.000000" -GSUBPIX_G = "0.750000" -GSUBPIX_B = "0.000000" -BSUBPIX_R = "0.000000" -BSUBPIX_G = "0.000000" -BSUBPIX_B = "0.750000" -gain = "1.500000" -gamma = "2.200000" -blacklevel = "0.000000" -ambient = "0.000000" -BGR = "1.000000" +RSUBPIX_R = "1" +RSUBPIX_G = "0" +RSUBPIX_B = "0" +GSUBPIX_R = "0" +GSUBPIX_G = "1" +GSUBPIX_B = "0" +BSUBPIX_R = "0" +BSUBPIX_G = "0" +BSUBPIX_B = "1" +gain = "1" +gamma = "2.2" +blacklevel = "0" +ambient = "0" +BGR = "0" diff --git a/handheld/lcd-grid-v2-psp-color.slangp b/handheld/lcd-grid-v2-psp-color.slangp index f9bfb6f..afcd5e7 100644 --- a/handheld/lcd-grid-v2-psp-color.slangp +++ b/handheld/lcd-grid-v2-psp-color.slangp @@ -1,27 +1,27 @@ shaders = "2" -shader0 = "shaders/color/psp-color.slang" +shader0 = "shaders/lcd-cgwg/lcd-grid-v2.slang" filter_linear0 = "false" -scale_type0 = "source" +scale_type0 = "viewport" scale0 = "1.0" -shader1 = "shaders/lcd-cgwg/lcd-grid-v2.slang" +shader1 = "shaders/color/psp-color.slang" filter_linear1 = "false" -scale_type1 = "viewport" +scale_type1 = "source" scale1 = "1.0" parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR" -RSUBPIX_R = "0.750000" -RSUBPIX_G = "0.000000" -RSUBPIX_B = "0.000000" -GSUBPIX_R = "0.000000" -GSUBPIX_G = "0.750000" -GSUBPIX_B = "0.000000" -BSUBPIX_R = "0.000000" -BSUBPIX_G = "0.000000" -BSUBPIX_B = "0.750000" -gain = "1.500000" -gamma = "2.200000" -blacklevel = "0.000000" -ambient = "0.000000" -BGR = "1.000000" +RSUBPIX_R = "1" +RSUBPIX_G = "0" +RSUBPIX_B = "0" +GSUBPIX_R = "0" +GSUBPIX_G = "1" +GSUBPIX_B = "0" +BSUBPIX_R = "0" +BSUBPIX_G = "0" +BSUBPIX_B = "1" +gain = "1" +gamma = "2.2" +blacklevel = "0" +ambient = "0" +BGR = "0" diff --git a/handheld/lcd-grid-v2-sp101-color-motionblur.slangp b/handheld/lcd-grid-v2-sp101-color-motionblur.slangp new file mode 100644 index 0000000..ea99b0e --- /dev/null +++ b/handheld/lcd-grid-v2-sp101-color-motionblur.slangp @@ -0,0 +1,32 @@ +shaders = "3" + +shader0 = "../motionblur/shaders/response-time.slang" +filter_linear0 = "false" +scale_type0 = "source" +scale0 = "1.0" + +shader1 = "shaders/lcd-cgwg/lcd-grid-v2.slang" +filter_linear1 = "false" +scale_type1 = "viewport" +scale1 = "1.0" + +shader2 = "shaders/color/sp101-color.slang" +filter_linear2 = "false" +scale_type2 = "source" +scale2 = "1.0" + +parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR" +RSUBPIX_R = "1" +RSUBPIX_G = "0" +RSUBPIX_B = "0" +GSUBPIX_R = "0" +GSUBPIX_G = "1" +GSUBPIX_B = "0" +BSUBPIX_R = "0" +BSUBPIX_G = "0" +BSUBPIX_B = "1" +gain = "1" +gamma = "2.2" +blacklevel = "0" +ambient = "0" +BGR = "0" diff --git a/handheld/lcd-grid-v2-sp101-color.slangp b/handheld/lcd-grid-v2-sp101-color.slangp new file mode 100644 index 0000000..2699768 --- /dev/null +++ b/handheld/lcd-grid-v2-sp101-color.slangp @@ -0,0 +1,27 @@ +shaders = "2" + +shader0 = "shaders/lcd-cgwg/lcd-grid-v2.slang" +filter_linear0 = "false" +scale_type0 = "viewport" +scale0 = "1.0" + +shader1 = "shaders/color/sp101-color.slang" +filter_linear1 = "false" +scale_type1 = "source" +scale1 = "1.0" + +parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR" +RSUBPIX_R = "1" +RSUBPIX_G = "0" +RSUBPIX_B = "0" +GSUBPIX_R = "0" +GSUBPIX_G = "1" +GSUBPIX_B = "0" +BSUBPIX_R = "0" +BSUBPIX_G = "0" +BSUBPIX_B = "1" +gain = "1" +gamma = "2.2" +blacklevel = "0" +ambient = "0" +BGR = "0" diff --git a/handheld/lcd-grid-v2-vba-color-motionblur.slangp b/handheld/lcd-grid-v2-vba-color-motionblur.slangp index 916c885..4987ad9 100644 --- a/handheld/lcd-grid-v2-vba-color-motionblur.slangp +++ b/handheld/lcd-grid-v2-vba-color-motionblur.slangp @@ -5,28 +5,28 @@ filter_linear0 = "false" scale_type0 = "source" scale0 = "1.0" -shader1 = "shaders/color/vba-color.slang" +shader1 = "shaders/lcd-cgwg/lcd-grid-v2.slang" filter_linear1 = "false" -scale_type1 = "source" +scale_type1 = "viewport" scale1 = "1.0" -shader2 = "shaders/lcd-cgwg/lcd-grid-v2.slang" +shader2 = "shaders/color/vba-color.slang" filter_linear2 = "false" -scale_type2 = "viewport" +scale_type2 = "source" scale2 = "1.0" parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR" -RSUBPIX_R = "0.750000" -RSUBPIX_G = "0.000000" -RSUBPIX_B = "0.000000" -GSUBPIX_R = "0.000000" -GSUBPIX_G = "0.750000" -GSUBPIX_B = "0.000000" -BSUBPIX_R = "0.000000" -BSUBPIX_G = "0.000000" -BSUBPIX_B = "0.750000" -gain = "1.500000" -gamma = "2.200000" -blacklevel = "0.000000" -ambient = "0.000000" -BGR = "1.000000" +RSUBPIX_R = "1" +RSUBPIX_G = "0" +RSUBPIX_B = "0" +GSUBPIX_R = "0" +GSUBPIX_G = "1" +GSUBPIX_B = "0" +BSUBPIX_R = "0" +BSUBPIX_G = "0" +BSUBPIX_B = "1" +gain = "1" +gamma = "2.2" +blacklevel = "0" +ambient = "0" +BGR = "0" diff --git a/handheld/lcd-grid-v2-vba-color.slangp b/handheld/lcd-grid-v2-vba-color.slangp index fd4f049..401c097 100644 --- a/handheld/lcd-grid-v2-vba-color.slangp +++ b/handheld/lcd-grid-v2-vba-color.slangp @@ -1,27 +1,27 @@ shaders = "2" -shader0 = "shaders/color/vba-color.slang" +shader0 = "shaders/lcd-cgwg/lcd-grid-v2.slang" filter_linear0 = "false" -scale_type0 = "source" +scale_type0 = "viewport" scale0 = "1.0" -shader1 = "shaders/lcd-cgwg/lcd-grid-v2.slang" +shader1 = "shaders/color/vba-color.slang" filter_linear1 = "false" -scale_type1 = "viewport" +scale_type1 = "source" scale1 = "1.0" parameters = "RSUBPIX_R;RSUBPIX_G;RSUBPIX_B;GSUBPIX_R;GSUBPIX_G;GSUBPIX_B;BSUBPIX_R;BSUBPIX_G;BSUBPIX_B;gain;gamma;blacklevel;ambient;BGR" -RSUBPIX_R = "0.750000" -RSUBPIX_G = "0.000000" -RSUBPIX_B = "0.000000" -GSUBPIX_R = "0.000000" -GSUBPIX_G = "0.750000" -GSUBPIX_B = "0.000000" -BSUBPIX_R = "0.000000" -BSUBPIX_G = "0.000000" -BSUBPIX_B = "0.750000" -gain = "1.500000" -gamma = "2.200000" -blacklevel = "0.000000" -ambient = "0.000000" -BGR = "1.000000" +RSUBPIX_R = "1" +RSUBPIX_G = "0" +RSUBPIX_B = "0" +GSUBPIX_R = "0" +GSUBPIX_G = "1" +GSUBPIX_B = "0" +BSUBPIX_R = "0" +BSUBPIX_G = "0" +BSUBPIX_B = "1" +gain = "1" +gamma = "2.2" +blacklevel = "0" +ambient = "0" +BGR = "0" diff --git a/handheld/shaders/color/NSO-gba-color.slang b/handheld/shaders/color/NSO-gba-color.slang new file mode 100644 index 0000000..dc7d964 --- /dev/null +++ b/handheld/shaders/color/NSO-gba-color.slang @@ -0,0 +1,95 @@ +#version 450 + +/* + Shader Modified: Pokefan531 + Color Mangler + Author: hunterk + License: Public domain +*/ +// Shader that replicates the Nintendo Switch Online's GBA color filter -- + +layout(push_constant) uniform Push +{ + float darken_screen; +} params; + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; + vec4 OutputSize; + vec4 OriginalSize; + vec4 SourceSize; + float mode; +} global; + +#pragma parameter mode "Color Profile (1=sRGB, 2=DCI, 3=Rec2020)" 1.0 1.0 3.0 1.0 +int color_mode = int(global.mode); + +#pragma parameter darken_screen "Darken Screen" 0.8 0.0 1.0 0.05 + +#define target_gamma 2.2 +#define display_gamma 2.2 + +/* +We'll define our color weights in this pattern: + r, rg, rb, 0.0, //red channel + gr, g, gb, 0.0, //green channel + br, bg, b, 0.0, //blue channel + blr, blg, blb, lum //alpha channel; we'll hide lum at the end, too +*/ + +const mat4 GBA_sRGB = mat4( + 0.865, 0.0575, 0.0575, 0.0, //red channel + 0.1225, 0.925, 0.1225, 0.0, //green channel + 0.0125, 0.0125, 0.82, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +const mat4 GBA_DCI = mat4( + 0.72, 0.0875, 0.0725, 0.0, //red channel + 0.2675, 0.9, 0.185, 0.0, //green channel + 0.0125, 0.0125, 0.7425, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +const mat4 GBA_Rec2020 = mat4( + 0.57, 0.115, 0.0725, 0.0, //red channel + 0.3825, 0.8625, 0.195, 0.0, //green channel + 0.0475, 0.0225, 0.7325, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out mat4 profile; + +void main() +{ + gl_Position = global.MVP * Position; + vTexCoord = TexCoord; + + if (color_mode == 1) profile = GBA_sRGB; + else if (color_mode == 2) profile = GBA_DCI; + else if (color_mode == 3) profile = GBA_Rec2020; +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in mat4 profile; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + // bring out our stored luminance value + float lum = profile[3].w; + + // our adjustments need to happen in linear gamma + vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma + params.darken_screen)).rgba; + + screen = clamp(screen * lum, 0.0, 1.0); + screen = profile * screen; + FragColor = pow(screen, vec4(1.0 / display_gamma)); +} \ No newline at end of file diff --git a/handheld/shaders/color/NSO-gbc-color.slang b/handheld/shaders/color/NSO-gbc-color.slang new file mode 100644 index 0000000..1ed65d7 --- /dev/null +++ b/handheld/shaders/color/NSO-gbc-color.slang @@ -0,0 +1,96 @@ +#version 450 + +/* + Shader Modified: Pokefan531 + Color Mangler + Author: hunterk + License: Public domain +*/ +// Shader that replicates the Nintendo Switch Online's GBC color filter -- +// (Experimental WIP shader. Due to how complex the NSO GBC filter used (using different gamma ramps and greyscale temperatures), it couldn't be replicated to a shader as of now completely, so a side effect of using correct color metrics for RGB, is warm greyscales. This is not an issue with NSO GBA Filter which was easy to replicate. If you want an actual NSO GBC replication, use Reshade NSO-GBC shader pack instead that uses Reshade LUT shader) + +layout(push_constant) uniform Push +{ + float lighten_screen; +} params; + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; + vec4 OutputSize; + vec4 OriginalSize; + vec4 SourceSize; + float mode; +} global; + +#pragma parameter mode "Color Profile (1=sRGB, 2=DCI, 3=Rec2020)" 1.0 1.0 3.0 1.0 +int color_mode = int(global.mode); + +#pragma parameter lighten_screen "Lighten Screen" 1.0 0.0 1.0 0.05 + +#define target_gamma 1.0 +#define display_gamma 1.0 + +/* +We'll define our color weights in this pattern: + r, rg, rb, 0.0, //red channel + gr, g, gb, 0.0, //green channel + br, bg, b, 0.0, //blue channel + blr, blg, blb, lum //alpha channel; we'll hide lum at the end, too +*/ + +const mat4 GBC_sRGB = mat4( + 0.84, 0.105, 0.15, 0.0, //red channel + 0.265, 0.67, 0.30, 0.0, //green channel + 0.0, 0.24, 0.525, 0.0, //blue channel + 0.175, 0.18, 0.18, 0.85 //alpha channel +); + +const mat4 GBC_DCI = mat4( + 0.69, 0.17, 0.195, 0.0, //red channel + 0.31, 0.61, 0.165, 0.0, //green channel + 0.0, 0.22, 0.64, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +const mat4 GBC_Rec2020 = mat4( + 0.57, 0.195, 0.195, 0.0, //red channel + 0.37, 0.605, 0.175, 0.0, //green channel + 0.06, 0.22, 0.63, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out mat4 profile; + +void main() +{ + gl_Position = global.MVP * Position; + vTexCoord = TexCoord; + + if (color_mode == 1) profile = GBC_sRGB; + else if (color_mode == 2) profile = GBC_DCI; + else if (color_mode == 3) profile = GBC_Rec2020; +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in mat4 profile; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + // bring out our stored luminance value + float lum = profile[3].w; + + // our adjustments need to happen in linear gamma + vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma + (params.lighten_screen * -1.0))).rgba; + + screen = clamp(screen * lum, 0.0, 1.0); + screen = profile * screen; + FragColor = pow(screen, vec4(1.0 / display_gamma)); +} \ No newline at end of file diff --git a/handheld/shaders/color/SwitchOLED-color.slang b/handheld/shaders/color/SwitchOLED-color.slang new file mode 100644 index 0000000..dc14a03 --- /dev/null +++ b/handheld/shaders/color/SwitchOLED-color.slang @@ -0,0 +1,112 @@ +#version 450 + +/* + Shader Modified: Pokefan531 + Color Mangler + Author: hunterk + License: Public domain +*/ +// Shader that replicates the Vivid mode of Nintendo Switch OLED Model -- + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; + vec4 OutputSize; + vec4 OriginalSize; + vec4 SourceSize; + float mode, white_toggle; +} global; + +#pragma parameter mode "Color Profile (1=sRGB, 2=DCI, 3=Rec2020)" 1.0 1.0 3.0 1.0 +int color_mode = int(global.mode); + +#pragma parameter white_toggle "Full White Scale" 1.0 0.0 1.0 1.0 +bool white = bool(global.white_toggle); + +#define target_gamma 2.0 +#define display_gamma 2.0 + +/* +We'll define our color weights in this pattern: + r, rg, rb, 0.0, //red channel + gr, g, gb, 0.0, //green channel + br, bg, b, 0.0, //blue channel + blr, blg, blb, lum //alpha channel; we'll hide lum at the end, too +*/ + +const mat4 SWITCH_sRGB = mat4( + 1.54, -0.045, -0.0225, 0.0, //red channel + -0.48, 1.0625, -0.075, 0.0, //green channel + -0.06, -0.0175, 1.1025, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.65 //alpha channel +); + +const mat4 SWITCH_sRGB_white = mat4( + 1.54, -0.045, -0.0225, 0.0, //red channel + -0.48, 1.0625, -0.075, 0.0, //green channel + -0.06, -0.0175, 1.1025, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +const mat4 SWITCH_DCI = mat4( + 1.2125, 0.0025, 0.0, 0.0, //red channel + -0.1625, 1.02, 0.0, 0.0, //green channel + -0.05, -0.0225, 1.0, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.825 //alpha channel +); + +const mat4 SWITCH_DCI_white = mat4( + 1.2125, 0.0025, 0.0, 0.0, //red channel + -0.1625, 1.02, 0.0, 0.0, //green channel + -0.05, -0.0225, 1.0, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +const mat4 SWITCH_Rec2020 = mat4( + 0.865, 0.0475, 0.0, 0.0, //red channel + 0.12, 0.9575, 0.02, 0.0, //green channel + 0.015, -0.005, 0.98, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.995 //alpha channel +); + +const mat4 SWITCH_Rec2020_white = mat4( + 0.865, 0.0475, 0.0, 0.0, //red channel + 0.12, 0.9575, 0.02, 0.0, //green channel + 0.015, -0.005, 0.98, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out mat4 profile; + +void main() +{ + gl_Position = global.MVP * Position; + vTexCoord = TexCoord; + + if (color_mode == 1) profile = (!white) ? SWITCH_sRGB : SWITCH_sRGB_white; + else if (color_mode == 2) profile = (!white) ? SWITCH_DCI : SWITCH_DCI_white; + else if (color_mode == 3) profile = (!white) ? SWITCH_Rec2020 : SWITCH_Rec2020_white; +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in mat4 profile; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + // bring out our stored luminance value + float lum = profile[3].w; + + // our adjustments need to happen in linear gamma + vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma)).rgba; + + screen = clamp(screen * lum, 0.0, 1.0); + screen = profile * screen; + FragColor = pow(screen, vec4(1.0 / display_gamma)); +} \ No newline at end of file diff --git a/handheld/shaders/color/gba-color.slang b/handheld/shaders/color/gba-color.slang index 0216d71..c44a629 100644 --- a/handheld/shaders/color/gba-color.slang +++ b/handheld/shaders/color/gba-color.slang @@ -1,5 +1,13 @@ #version 450 +/* + Shader Modified: Pokefan531 + Color Mangler + Author: hunterk + License: Public domain +*/ +// Shader that replicates the LCD Colorspace from Gameboy Advance -- + layout(push_constant) uniform Push { float darken_screen; @@ -7,76 +15,81 @@ layout(push_constant) uniform Push layout(std140, set = 0, binding = 0) uniform UBO { - mat4 MVP; - vec4 OutputSize; - vec4 OriginalSize; - vec4 SourceSize; + mat4 MVP; + vec4 OutputSize; + vec4 OriginalSize; + vec4 SourceSize; + float mode; } global; +#pragma parameter mode "Color Profile (1=sRGB, 2=DCI, 3=Rec2020)" 1.0 1.0 3.0 1.0 +int color_mode = int(global.mode); + +#pragma parameter darken_screen "Darken Screen" 0.5 0.0 1.0 0.05 + +#define target_gamma 2.0 +#define display_gamma 2.0 + /* - Shader Modified: Pokefan531 - Color Mangler - Author: hunterk - License: Public domain +We'll define our color weights in this pattern: + r, rg, rb, 0.0, //red channel + gr, g, gb, 0.0, //green channel + br, bg, b, 0.0, //blue channel + blr, blg, blb, lum //alpha channel; we'll hide lum at the end, too */ -// Shader that replicates the LCD dynamics from a GameBoy Advance -#pragma parameter darken_screen "Darken Screen" 1.0 -0.25 1.0 0.05 +const mat4 GBA_sRGB = mat4( + 0.80, 0.135, 0.195, 0.0, //red channel + 0.275, 0.64, 0.155, 0.0, //green channel + -0.075, 0.225, 0.65, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.93 //alpha channel +); -#define target_gamma 2.2 -#define display_gamma 2.2 -#define sat 1.0 -#define lum 0.94 -#define contrast 1.0 -#define blr 0.0 -#define blg 0.0 -#define blb 0.0 -#define r 0.82 -#define g 0.665 -#define b 0.73 -#define rg 0.125 -#define rb 0.195 -#define gr 0.24 -#define gb 0.075 -#define br -0.06 -#define bg 0.21 -#define overscan_percent_x 0.0 -#define overscan_percent_y 0.0 +const mat4 GBA_DCI = mat4( + 0.685, 0.16, 0.20, 0.0, //red channel + 0.34, 0.629, 0.19, 0.0, //green channel + -0.025, 0.211, 0.61, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.975 //alpha channel +); + +const mat4 GBA_Rec2020 = mat4( + 0.555, 0.1825, 0.20, 0.0, //red channel + 0.395, 0.61, 0.195, 0.0, //green channel + 0.05, 0.2075, 0.605, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); #pragma stage vertex layout(location = 0) in vec4 Position; layout(location = 1) in vec2 TexCoord; layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out mat4 profile; void main() { - gl_Position = global.MVP * Position; - vTexCoord = TexCoord; + gl_Position = global.MVP * Position; + vTexCoord = TexCoord; + + if (color_mode == 1) profile = GBA_sRGB; + else if (color_mode == 2) profile = GBA_DCI; + else if (color_mode == 3) profile = GBA_Rec2020; } #pragma stage fragment layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in mat4 profile; 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 + params.darken_screen)).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; + // bring out our stored luminance value + float lum = profile[3].w; + + // our adjustments need to happen in linear gamma + vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma + params.darken_screen)).rgba; + screen = clamp(screen * lum, 0.0, 1.0); - screen = color * screen; - FragColor = pow(screen, vec4(1.0 / (display_gamma))); -} + screen = profile * screen; + FragColor = pow(screen, vec4(1.0 / display_gamma)); +} \ No newline at end of file diff --git a/handheld/shaders/color/gbc-color.slang b/handheld/shaders/color/gbc-color.slang index 1acda9d..88d49e7 100644 --- a/handheld/shaders/color/gbc-color.slang +++ b/handheld/shaders/color/gbc-color.slang @@ -1,5 +1,13 @@ #version 450 +/* + Shader Modified: Pokefan531 + Color Mangler + Author: hunterk + License: Public domain +*/ +// Shader that replicates the LCD Colorspace from Gameboy Color -- + layout(push_constant) uniform Push { float lighten_screen; @@ -7,76 +15,81 @@ layout(push_constant) uniform Push layout(std140, set = 0, binding = 0) uniform UBO { - mat4 MVP; - vec4 OutputSize; - vec4 OriginalSize; - vec4 SourceSize; + mat4 MVP; + vec4 OutputSize; + vec4 OriginalSize; + vec4 SourceSize; + float mode; } global; -/* - Shader Modified: Pokefan531 - Color Mangler - Author: hunterk - License: Public domain -*/ -// Shader that replicates the LCD dynamics from a GameBoy Color +#pragma parameter mode "Color Profile (1=sRGB, 2=DCI, 3=Rec2020)" 1.0 1.0 3.0 1.0 +int color_mode = int(global.mode); #pragma parameter lighten_screen "Lighten Screen" 1.0 0.0 1.0 0.05 #define target_gamma 2.2 #define display_gamma 2.2 -#define sat 1.0 -#define lum 0.94 -#define contrast 1.0 -#define blr 0.0 -#define blg 0.0 -#define blb 0.0 -#define r 0.82 -#define g 0.665 -#define b 0.73 -#define rg 0.125 -#define rb 0.195 -#define gr 0.24 -#define gb 0.075 -#define br -0.06 -#define bg 0.21 -#define overscan_percent_x 0.0 -#define overscan_percent_y 0.0 + +/* +We'll define our color weights in this pattern: + r, rg, rb, 0.0, //red channel + gr, g, gb, 0.0, //green channel + br, bg, b, 0.0, //blue channel + blr, blg, blb, lum //alpha channel; we'll hide lum at the end, too +*/ + +const mat4 GBC_sRGB = mat4( + 0.80, 0.135, 0.195, 0.0, //red channel + 0.275, 0.64, 0.155, 0.0, //green channel + -0.075, 0.225, 0.65, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.93 //alpha channel +); + +const mat4 GBC_DCI = mat4( + 0.685, 0.16, 0.20, 0.0, //red channel + 0.34, 0.629, 0.19, 0.0, //green channel + -0.025, 0.211, 0.61, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.975 //alpha channel +); + +const mat4 GBC_Rec2020 = mat4( + 0.555, 0.1825, 0.20, 0.0, //red channel + 0.395, 0.61, 0.195, 0.0, //green channel + 0.05, 0.2075, 0.605, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); #pragma stage vertex layout(location = 0) in vec4 Position; layout(location = 1) in vec2 TexCoord; layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out mat4 profile; void main() { - gl_Position = global.MVP * Position; - vTexCoord = TexCoord; + gl_Position = global.MVP * Position; + vTexCoord = TexCoord; + + if (color_mode == 1) profile = GBC_sRGB; + else if (color_mode == 2) profile = GBC_DCI; + else if (color_mode == 3) profile = GBC_Rec2020; } #pragma stage fragment layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in mat4 profile; 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 + (params.lighten_screen * -1.0))).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; + // bring out our stored luminance value + float lum = profile[3].w; + + // our adjustments need to happen in linear gamma + vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma + (params.lighten_screen * -1.0))).rgba; + screen = clamp(screen * lum, 0.0, 1.0); - screen = color * screen; - FragColor = pow(screen, vec4(1.0 / (display_gamma))); -} + screen = profile * screen; + FragColor = pow(screen, vec4(1.0 / display_gamma)); +} \ No newline at end of file diff --git a/handheld/shaders/color/gbc-dev.slang b/handheld/shaders/color/gbc-dev.slang new file mode 100644 index 0000000..e2a85ab --- /dev/null +++ b/handheld/shaders/color/gbc-dev.slang @@ -0,0 +1,77 @@ +#version 450 +/* + Author: Pokefan531 + License: Public domain +*/ + +// Shader that closely replicates Jeff Frohwein's "Gameboy HiColour Converter" color algorithm. + +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 = 2.2; + float CRT_gamma = 2.2; + float luminance = 1.12; + + 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.730 + g * 0.270 + b * 0.000; + float q = r * 0.085 + g * 0.675 + b * 0.240; + float e = r * 0.085 + g * 0.240 + b * 0.675; + +//part 3 + saturation = 1.0; + Display_gamma = 1.7; + CRT_gamma = 1.0; + luminance = 1.0; + + 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); +} \ No newline at end of file diff --git a/handheld/shaders/color/nds-color.slang b/handheld/shaders/color/nds-color.slang index 325db58..fa1d8c0 100644 --- a/handheld/shaders/color/nds-color.slang +++ b/handheld/shaders/color/nds-color.slang @@ -6,7 +6,7 @@ Author: hunterk License: Public domain */ -// Shader that replicates the LCD dynamics from a Nintendo DS Phat -- +// Shader that replicates the LCD Colorspace from a Nintendo DS Phat -- layout(std140, set = 0, binding = 0) uniform UBO { @@ -20,60 +20,60 @@ layout(std140, set = 0, binding = 0) uniform UBO #pragma parameter mode "Color Profile (1=sRGB, 2=DCI, 3=Rec2020)" 1.0 1.0 3.0 1.0 int color_mode = int(global.mode); -#pragma parameter white_toggle "Toggle White Balance" 0.0 0.0 1.0 1.0 +#pragma parameter white_toggle "Toggle White Balance" 1.0 0.0 1.0 1.0 bool white = bool(global.white_toggle); -#define target_gamma 2.2 -#define display_gamma 2.2 +#define target_gamma 2.0 +#define display_gamma 2.0 /* We'll define our color weights in this pattern: r, rg, rb, 0.0, //red channel gr, g, gb, 0.0, //green channel br, bg, b, 0.0, //blue channel - blr, blg, blb, lum //alpha channel; we'll hide luma at the end, too + blr, blg, blb, lum //alpha channel; we'll hide lum at the end, too */ -const mat4 NDS_Rec2020 = mat4( - 0.58, 0.13, 0.09, 0.0, - 0.38, 0.645, 0.20, 0.0, - 0.04, 0.225, 0.71, 0.0, - 0.0, 0.0, 0.0, 1.0 -); - -const mat4 NDS_Rec2020_white = mat4( - 0.535, 0.12, 0.09, 0.0, - 0.345, 0.585, 0.20, 0.0, - 0.04, 0.215, 0.71, 0.0, - 0.0, 0.0, 0.0, 1.0 -); - -const mat4 NDS_DCI = mat4( - 0.745, 0.10, 0.09, 0.0, - 0.315, 0.665, 0.195, 0.0, - -0.06, 0.235, 0.715, 0.0, - 0.0, 0.0, 0.0, 0.95 -); - -const mat4 NDS_DCI_white = mat4( - 0.685, 0.095, 0.09, 0.0, - 0.29, 0.605, 0.19, 0.0, - -0.06, 0.215, 0.715, 0.0, - 0.0, 0.0, 0.0, 1.0 -); - const mat4 NDS_sRGB = mat4( - 0.815, 0.07, 0.075, 0.0, - 0.215, 0.62, 0.155, 0.0, - -0.12, 0.22, 0.77, 0.0, - 0.0, 0.0, 0.0, 0.89 + 0.705, 0.09, 0.1075, 0.0, //red channel + 0.235, 0.585, 0.1725, 0.0, //green channel + -0.075, 0.24, 0.72, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel ); const mat4 NDS_sRGB_white = mat4( - 0.815, 0.07, 0.075, 0.0, - 0.215, 0.62, 0.155, 0.0, - -0.12, 0.22, 0.77, 0.0, - 0.0, 0.0, 0.0, 0.97 + 0.815, 0.10, 0.1075, 0.0, //red channel + 0.275, 0.64, 0.1725, 0.0, //green channel + -0.09, 0.26, 0.72, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.915 //alpha channel +); + +const mat4 NDS_DCI = mat4( + 0.605, 0.115, 0.115, 0.0, //red channel + 0.295, 0.575, 0.205, 0.0, //green channel + -0.03, 0.23, 0.68, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +const mat4 NDS_DCI_white = mat4( + 0.69, 0.125, 0.12, 0.0, //red channel + 0.335, 0.625, 0.20, 0.0, //green channel + -0.025, 0.25, 0.68, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.975 //alpha channel +); + +const mat4 NDS_Rec2020 = mat4( + 0.495, 0.135, 0.1175, 0.0, //red channel + 0.345, 0.555, 0.2075, 0.0, //green channel + 0.055, 0.225, 0.675, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +const mat4 NDS_Rec2020_white = mat4( + 0.55, 0.1475, 0.1175, 0.0, //red channel + 0.39, 0.61, 0.2075, 0.0, //green channel + 0.06, 0.2425, 0.675, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel ); #pragma stage vertex @@ -87,9 +87,9 @@ void main() gl_Position = global.MVP * Position; vTexCoord = TexCoord; - if (color_mode == 3) profile = (!white) ? NDS_Rec2020 : NDS_Rec2020_white; + if (color_mode == 1) profile = (!white) ? NDS_sRGB : NDS_sRGB_white; else if (color_mode == 2) profile = (!white) ? NDS_DCI : NDS_DCI_white; - else if (color_mode == 1) profile = (!white) ? NDS_sRGB : NDS_sRGB_white; + else if (color_mode == 3) profile = (!white) ? NDS_Rec2020 : NDS_Rec2020_white; } #pragma stage fragment @@ -109,4 +109,4 @@ void main() screen = clamp(screen * lum, 0.0, 1.0); screen = profile * screen; FragColor = pow(screen, vec4(1.0 / display_gamma)); -} +} \ No newline at end of file diff --git a/handheld/shaders/color/palm-color.slang b/handheld/shaders/color/palm-color.slang index 490ae57..034483b 100644 --- a/handheld/shaders/color/palm-color.slang +++ b/handheld/shaders/color/palm-color.slang @@ -1,82 +1,112 @@ #version 450 -layout(push_constant) uniform Push -{ - float palm_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 Palm OS Phones +// Shader that replicates the LCD Colorspace from a PSP 1000 Model -- -#pragma parameter palm_gamma "Use Palm's Gamma" 0.0 0.0 1.0 1.0 +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; + vec4 OutputSize; + vec4 OriginalSize; + vec4 SourceSize; + float mode, white_toggle; +} global; + +#pragma parameter mode "Color Profile (1=sRGB, 2=DCI, 3=Rec2020)" 1.0 1.0 3.0 1.0 +int color_mode = int(global.mode); + +#pragma parameter white_toggle "Toggle White Balance" 1.0 0.0 1.0 1.0 +bool white = bool(global.white_toggle); #define target_gamma 2.2 #define display_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.88 -#define g 0.69 -#define b 0.765 -#define rg 0.06 -#define rb 0.085 -#define gr 0.24 -#define gb 0.15 -#define br -0.12 -#define bg 0.25 -#define overscan_percent_x 0.0 -#define overscan_percent_y 0.0 + +/* +We'll define our color weights in this pattern: + r, rg, rb, 0.0, //red channel + gr, g, gb, 0.0, //green channel + br, bg, b, 0.0, //blue channel + blr, blg, blb, lum //alpha channel; we'll hide lum at the end, too +*/ + +const mat4 PSP_sRGB = mat4( + 0.525, 0.0525, 0.09, 0.0, //red channel + 0.13, 0.545, 0.15, 0.0, //green channel + -0.07, 0.1975, 0.76, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +const mat4 PSP_sRGB_white = mat4( + 0.90, 0.065, 0.09, 0.0, //red channel + 0.225, 0.685, 0.15, 0.0, //green channel + -0.125, 0.25, 0.76, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.89 //alpha channel +); + +const mat4 PSP_DCI = mat4( + 0.73, 0.067, 0.03, 0.0, //red channel + 0.30, 0.771, 0.0825, 0.0, //green channel + -0.105, 0.162, 0.855, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.97 //alpha channel +); + +const mat4 PSP_DCI_white = mat4( + 0.79, 0.067, 0.033, 0.0, //red channel + 0.32, 0.771, 0.085, 0.0, //green channel + -0.11, 0.162, 0.882, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.9 //alpha channel +); + +const mat4 PSP_Rec2020 = mat4( + 0.57, 0.098, 0.03, 0.0, //red channel + 0.38, 0.742, 0.0975, 0.0, //green channel + 0.0, 0.16, 0.855, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +const mat4 PSP_Rec2020_white = mat4( + 0.60, 0.098, 0.03, 0.0, //red channel + 0.40, 0.742, 0.099, 0.0, //green channel + 0.0, 0.16, 0.871, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); #pragma stage vertex layout(location = 0) in vec4 Position; layout(location = 1) in vec2 TexCoord; layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out mat4 profile; void main() { - gl_Position = global.MVP * Position; - vTexCoord = TexCoord; + gl_Position = global.MVP * Position; + vTexCoord = TexCoord; + + if (color_mode == 1) profile = (!white) ? PSP_sRGB : PSP_sRGB_white; + else if (color_mode == 2) profile = (!white) ? PSP_DCI : PSP_DCI_white; + else if (color_mode == 3) profile = (!white) ? PSP_Rec2020 : PSP_Rec2020_white; } #pragma stage fragment layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in mat4 profile; 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 + (params.palm_gamma * 0.4))).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; + // bring out our stored luminance value + float lum = profile[3].w; + + // our adjustments need to happen in linear gamma + vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma)).rgba; + screen = clamp(screen * lum, 0.0, 1.0); - screen = color * screen; - FragColor = pow(screen, vec4(1.0 / (display_gamma))); + screen = profile * screen; + FragColor = pow(screen, vec4(1.0 / display_gamma)); } \ No newline at end of file diff --git a/handheld/shaders/color/psp-color.slang b/handheld/shaders/color/psp-color.slang index ced5e60..57ac29d 100644 --- a/handheld/shaders/color/psp-color.slang +++ b/handheld/shaders/color/psp-color.slang @@ -1,75 +1,112 @@ #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 Colorspace from a PSP 1000 Model -- -// Shader that replicates the LCD dynamics from PSP 1000 and PSP 2000 -#define target_gamma 2.21 -#define display_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.98 -#define g 0.795 -#define b 0.98 -#define rg 0.04 -#define rb 0.01 -#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 +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; + vec4 OutputSize; + vec4 OriginalSize; + vec4 SourceSize; + float mode, white_toggle; +} global; + +#pragma parameter mode "Color Profile (1=sRGB, 2=DCI, 3=Rec2020)" 1.0 1.0 3.0 1.0 +int color_mode = int(global.mode); + +#pragma parameter white_toggle "Toggle White Balance" 1.0 0.0 1.0 1.0 +bool white = bool(global.white_toggle); + +#define target_gamma 2.0 +#define display_gamma 2.0 + +/* +We'll define our color weights in this pattern: + r, rg, rb, 0.0, //red channel + gr, g, gb, 0.0, //green channel + br, bg, b, 0.0, //blue channel + blr, blg, blb, lum //alpha channel; we'll hide lum at the end, too +*/ + +const mat4 PSP_sRGB = mat4( + 0.835, 0.0425, 0.0225, 0.0, //red channel + 0.16, 0.745, 0.015, 0.0, //green channel + -0.13, 0.155, 0.9625, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +const mat4 PSP_sRGB_white = mat4( + 0.965, 0.045, 0.0225, 0.0, //red channel + 0.185, 0.79, 0.015, 0.0, //green channel + -0.15, 0.165, 0.9625, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.87 //alpha channel +); + +const mat4 PSP_DCI = mat4( + 0.725, 0.07, 0.0375, 0.0, //red channel + 0.235, 0.73, 0.0775, 0.0, //green channel + -0.08, 0.1475, 0.885, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +const mat4 PSP_DCI_white = mat4( + 0.825, 0.075, 0.0375, 0.0, //red channel + 0.27, 0.77, 0.0775, 0.0, //green channel + -0.095, 0.155, 0.885, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.91 //alpha channel +); + +const mat4 PSP_Rec2020 = mat4( + 0.56, 0.10, 0.0375, 0.0, //red channel + 0.325, 0.70, 0.09, 0.0, //green channel + 0.0125, 0.1475, 0.8725, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +const mat4 PSP_Rec2020_white = mat4( + 0.625, 0.105, 0.0375, 0.0, //red channel + 0.36, 0.7375, 0.09, 0.0, //green channel + 0.015, 0.1575, 0.8725, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); #pragma stage vertex layout(location = 0) in vec4 Position; layout(location = 1) in vec2 TexCoord; layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out mat4 profile; void main() { - gl_Position = global.MVP * Position; - vTexCoord = TexCoord; + gl_Position = global.MVP * Position; + vTexCoord = TexCoord; + + if (color_mode == 1) profile = (!white) ? PSP_sRGB : PSP_sRGB_white; + else if (color_mode == 2) profile = (!white) ? PSP_DCI : PSP_DCI_white; + else if (color_mode == 3) profile = (!white) ? PSP_Rec2020 : PSP_Rec2020_white; } #pragma stage fragment layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in mat4 profile; 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; + // bring out our stored luminance value + float lum = profile[3].w; + + // our adjustments need to happen in linear gamma + vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma)).rgba; + screen = clamp(screen * lum, 0.0, 1.0); - screen = color * screen; + screen = profile * screen; FragColor = pow(screen, vec4(1.0 / display_gamma)); } \ No newline at end of file diff --git a/handheld/shaders/color/sp101-color.slang b/handheld/shaders/color/sp101-color.slang new file mode 100644 index 0000000..03c378e --- /dev/null +++ b/handheld/shaders/color/sp101-color.slang @@ -0,0 +1,113 @@ +#version 450 + +/* + Shader Modified: Pokefan531 + Color Mangler + Author: hunterk + License: Public domain +*/ +// Shader that replicates the LCD Colorspace from a Gameboy SP 101 (backlit version) -- +// (Note: This is also very close to what DS-Lite and DSi line colorspace looks) + +layout(std140, set = 0, binding = 0) uniform UBO +{ + mat4 MVP; + vec4 OutputSize; + vec4 OriginalSize; + vec4 SourceSize; + float mode, white_toggle; +} global; + +#pragma parameter mode "Color Profile (1=sRGB, 2=DCI, 3=Rec2020)" 1.0 1.0 3.0 1.0 +int color_mode = int(global.mode); + +#pragma parameter white_toggle "Toggle White Balance" 1.0 0.0 1.0 1.0 +bool white = bool(global.white_toggle); + +#define target_gamma 2.0 +#define display_gamma 2.0 + +/* +We'll define our color weights in this pattern: + r, rg, rb, 0.0, //red channel + gr, g, gb, 0.0, //green channel + br, bg, b, 0.0, //blue channel + blr, blg, blb, lum //alpha channel; we'll hide lum at the end, too +*/ + +const mat4 NDS_sRGB = mat4( + 0.86, 0.03, 0.0025, 0.0, //red channel + 0.10, 0.745, -0.03, 0.0, //green channel + -0.06, 0.0675, 1.0275, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.97 //alpha channel +); + +const mat4 NDS_sRGB_white = mat4( + 0.955, 0.0375, 0.0025, 0.0, //red channel + 0.11, 0.885, -0.03, 0.0, //green channel + -0.065, 0.0775, 1.0275, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.94 //alpha channel +); + +const mat4 NDS_DCI = mat4( + 0.725, 0.06, 0.02, 0.0, //red channel + 0.215, 0.73, 0.0225, 0.0, //green channel + -0.04, 0.065, 0.9575, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +const mat4 NDS_DCI_white = mat4( + 0.805, 0.07, 0.02, 0.0, //red channel + 0.235, 0.8575, 0.0225, 0.0, //green channel + -0.04, 0.0725, 0.9575, 0.0, //blue channel + 0.0, 0.0, 0.0, 0.96 //alpha channel +); + +const mat4 NDS_Rec2020 = mat4( + 0.56, 0.091, 0.02, 0.0, //red channel + 0.31, 0.695, 0.035, 0.0, //green channel + 0.0275, 0.07, 0.945, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +const mat4 NDS_Rec2020_white = mat4( + 0.625, 0.105, 0.02, 0.0, //red channel + 0.345, 0.815, 0.035, 0.0, //green channel + 0.03, 0.08, 0.945, 0.0, //blue channel + 0.0, 0.0, 0.0, 1.0 //alpha channel +); + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; +layout(location = 1) out mat4 profile; + +void main() +{ + gl_Position = global.MVP * Position; + vTexCoord = TexCoord; + + if (color_mode == 1) profile = (!white) ? NDS_sRGB : NDS_sRGB_white; + else if (color_mode == 2) profile = (!white) ? NDS_DCI : NDS_DCI_white; + else if (color_mode == 3) profile = (!white) ? NDS_Rec2020 : NDS_Rec2020_white; +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 1) in mat4 profile; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + // bring out our stored luminance value + float lum = profile[3].w; + + // our adjustments need to happen in linear gamma + vec4 screen = pow(texture(Source, vTexCoord), vec4(target_gamma)).rgba; + + screen = clamp(screen * lum, 0.0, 1.0); + screen = profile * screen; + FragColor = pow(screen, vec4(1.0 / display_gamma)); +} \ No newline at end of file