sync to koko-aio 1.9.20

This commit is contained in:
Antonio Orefice 2024-05-16 17:37:58 +02:00
parent 8724e92bd3
commit 0a741ee7a2
84 changed files with 4255 additions and 610 deletions

View File

@ -1,14 +1,17 @@
#reference "FXAA-bloom.slangp"
DO_BEZEL = "1.000000"
BEZEL_INNER_ZOOM = "-0.391000"
BEZEL_INNER_ZOOM = "-0.39000"
BEZEL_FRAME_ZOOM = "-0.140000"
BEZEL_R = "0.070000"
BEZEL_G = "0.050000"
BEZEL_B = "0.035000"
BEZEL_CON = "2.180000"
BEZEL_REFL_STRENGTH = "0.5"
BEZEL_DIFFUSION_STR = "0.5"
BEZEL_CORNER_DARK = "0.400000"
BEZEL_REFL_STRENGTH = "0.40"
BEZEL_DIFFUSION_STR = "0.70"
BEZEL_SPCL_STRENGTH = "0.3"
BEZEL_RFL_BLR_SHD = "-1.0"
BEZEL_CORNER_DARK = "0.300000"
BEZEL_LIGHT_NO_FADEOUT = "1.0"
DO_BG_IMAGE = "1.000000"
BG_IMAGE_OVER = "1.000000"

View File

@ -11,7 +11,7 @@ HALO_SHARPNESS = "6.0"
HALO_VS_SCAN = "1.0"
DO_BLOOM = "1.000000"
BLOOM_MIX = "0.35"
BLOOM_MIX = "0.30"
DO_PIXELGRID_W = "0.000000"
PIXELGRID_MIN_H = "0.200000"

View File

@ -51,7 +51,7 @@ DO_AMBILIGHT = "1.0"
DO_CURVATURE = "1.0"
GEOM_CORNER_SIZE = "0.005"
GEOM_CORNER_SMOOTH = "400"
GEOM_CORNER_SMOOTH = "350"
DO_BEZEL = "0.0"
BEZEL_R = "-0.19"
@ -70,8 +70,8 @@ DO_VIGNETTE = "0.0"
DO_SPOT = "0.0"
S_POSITION_X = "-0.5"
S_POSITION_Y = "0.5"
S_SIZE = "0.4"
S_POWER = "0.05"
S_SIZE = "0.36"
S_POWER = "0.06"
DO_DYNZOOM = "0.015"

View File

@ -1,5 +1,5 @@
#reference "monitor-Commodore_1084S-Night.slangp"
BEZEL_INNER_ZOOM = "-0.391000"
BEZEL_INNER_ZOOM = "-0.3900"
BEZEL_FRAME_ZOOM = "-0.140000"
BEZEL_IMAGE_BORDER = "1.030000"

View File

@ -1,8 +1,14 @@
#reference "monitor-Commodore_1084S.slangp"
BEZEL_REFL_STRENGTH = "2.000000"
BEZEL_DIFFUSION_STR = "0.720000"
BEZEL_R = "-0.01"
BEZEL_G = "-0.03"
BEZEL_B = "-0.045"
BEZEL_LIGHT_NO_FADEOUT = "1.0"
BEZEL_REFL_STRENGTH = "0.4"
BEZEL_DIFFUSION_STR = "0.6"
BEZEL_SPCL_STRENGTH = "0.3"
BEZEL_CORNER_DARK = "0.400000"
BG_IMAGE_NIGHTIFY = "0.800000"

View File

@ -1,6 +1,6 @@
#reference "monitor-Commodore_1084S.slangp"
BEZEL_INNER_ZOOM = "-0.391000"
BEZEL_INNER_ZOOM = "-0.39"
BEZEL_FRAME_ZOOM = "-0.140000"
BEZEL_IMAGE_BORDER = "1.030000"

View File

@ -12,18 +12,19 @@ HALO_VS_SCAN = "1.0"
DO_CURVATURE = "1.000000"
GEOM_CORNER_SIZE = "0.005"
GEOM_CORNER_SMOOTH = "400.000000"
GEOM_CORNER_SMOOTH = "150.000000"
DO_BEZEL = "1.000000"
BEZEL_R = "0.070000"
BEZEL_G = "0.050000"
BEZEL_B = "0.035000"
BEZEL_INNER_ZOOM = "-0.522000"
BEZEL_FRAME_ZOOM = "-0.247000"
BEZEL_INNER_ZOOM = "-0.5200"
BEZEL_FRAME_ZOOM = "-0.245000"
BEZEL_IMAGE_BORDER = "1.040000"
BEZEL_RFL_OFFSET = "-0.003000"
BEZEL_REFL_STRENGTH = "0.2"
BEZEL_SPCL_STRENGTH = "0.5"
BEZEL_REFL_STRENGTH = "0.3"
BEZEL_SPCL_STRENGTH = "0.25"
BEZEL_ROUGHNESS = "2.0"
DO_VIGNETTE = "1.0"
V_POWER = "1.0"
@ -32,8 +33,8 @@ DO_VIGNETTE = "1.0"
DO_SPOT = "1.000000"
S_POSITION_X = "-0.5"
S_POSITION_Y = "0.5"
S_SIZE = "0.640000"
S_POWER = "0.07"
S_SIZE = "0.58"
S_POWER = "0.08"
DO_BG_IMAGE = "1.0"
BG_IMAGE_OVER = "1.0"
@ -59,6 +60,5 @@ LUMINANCE = "0.300000"
PIXELGRID_MAX_H = "0.500000"
PIXELGRID_H_PRST = "1.000000"
PIXELGRID_OFFSET_CORE = "0.170000"
BEZEL_REFL_STRENGTH = "0.350000"

View File

@ -4,7 +4,7 @@ DO_BLOOM = "1.0"
DO_BEZEL = "1.0"
BEZEL_FRAME_ZOOM = "0.04"
BEZEL_INNER_ZOOM = "-0.175"
BEZEL_INNER_ZOOM = "-0.17"
# Since SCANLINE_SM_TYPE ="1.0" mitigates moiree,
# but is not used in this preset, use the following to mitigate, instead:
@ -16,8 +16,8 @@ DO_BEZEL = "1.0"
DO_SPOT = "1.0"
DO_VIGNETTE = "1.0"
GEOM_CORNER_SIZE = 0.005
GEOM_CORNER_SMOOTH = "400"
GEOM_CORNER_SIZE = "0.005"
GEOM_CORNER_SMOOTH = "150"
GAMMA_OUT = 0.5

View File

@ -4,6 +4,6 @@
PIXELGRID_MIN_H = "0.200000"
BEZEL_FRAME_ZOOM = "0.17"
BEZEL_INNER_ZOOM = "-0.015"
BEZEL_IMAGE_BORDER = "1.02"
BEZEL_INNER_ZOOM = "-0.011"
BEZEL_IMAGE_BORDER = "1.02"

View File

@ -9,6 +9,7 @@ BEZEL_RFL_BLR_SHD = "0.800000"
BEZEL_DIFFUSION_STR = "0.500000"
BEZEL_SPCL_STRENGTH = "0.800000"
BEZEL_CORNER_DARK = "0.000000"
BEZEL_LIGHT_NO_FADEOUT = "1.0"
DO_BG_IMAGE = "1.000000"
AMBI_STEPS = "5.000000"
AMBI_FALLOFF = "0.280000"

View File

@ -2,7 +2,7 @@
DO_BEZEL = "1.0"
BEZEL_FRAME_ZOOM = "0.04"
BEZEL_INNER_ZOOM = "-0.173"
BEZEL_INNER_ZOOM = "-0.17"
DO_CURVATURE = 1.0
@ -11,4 +11,4 @@ DO_SPOT = "1.0"
GEOM_CORNER_SIZE = 0.005
GEOM_CORNER_SMOOTH = "400"
GEOM_CORNER_SMOOTH = "150"

View File

@ -2,7 +2,7 @@
DO_BEZEL = "1.0"
BEZEL_FRAME_ZOOM = "0.17"
BEZEL_INNER_ZOOM = "-0.015"
BEZEL_INNER_ZOOM = "-0.011"
BEZEL_IMAGE_BORDER = "1.02"
@ -12,4 +12,4 @@ DO_SPOT = "1.0"
DO_VIGNETTE = "1.0"
GEOM_CORNER_SIZE = 0.005
GEOM_CORNER_SMOOTH = "400"
GEOM_CORNER_SMOOTH = "150"

View File

@ -56,7 +56,7 @@ DO_BLOOM = "0.0"
DO_CURVATURE = "1.0"
GEOM_CORNER_SIZE = 0.005
GEOM_CORNER_SMOOTH = "400"
GEOM_CORNER_SMOOTH = "350"
@ -66,7 +66,7 @@ DO_BEZEL = "0.0"
BEZEL_B = "-0.19"
BEZEL_CON = "2.18"
BEZEL_FRAME_ZOOM = "0.0"
BEZEL_INNER_ZOOM = "-0.16"
BEZEL_INNER_ZOOM = "-0.163"
BEZEL_RFL_BLR_SHD = "-0.200000"
@ -83,8 +83,8 @@ DO_VIGNETTE = "0.0"
DO_SPOT = "0.0"
S_POSITION_X = "-0.5"
S_POSITION_Y = "0.5"
S_SIZE = "0.4"
S_POWER = "0.05"
S_SIZE = "0.36"
S_POWER = "0.06"
DO_DYNZOOM = "0.015"

View File

@ -23,7 +23,7 @@ HALO_POWER = "0.5"
DO_BEZEL = "1.0"
BEZEL_FRAME_ZOOM = "0.17"
BEZEL_INNER_ZOOM = "-0.015"
BEZEL_INNER_ZOOM = "-0.011"
BEZEL_IMAGE_BORDER = "1.02"
DO_SPOT = "1.0"
@ -33,7 +33,7 @@ DO_RF_NOISE = "1.0"
RF_NOISE_STRENGTH = "0.025"
GEOM_CORNER_SIZE = 0.005
GEOM_CORNER_SMOOTH = "400"
GEOM_CORNER_SMOOTH = "150"
BLOOM_GAMMA = "5.000000"
BLOOM_GAMMA_OUT = "1.800000"

View File

@ -8,12 +8,12 @@ DO_BEZEL = "1.0"
BEZEL_B = "-0.3"
BEZEL_CON = "1.3"
BEZEL_FRAME_ZOOM = "0.04"
BEZEL_INNER_ZOOM = "-0.175"
BEZEL_INNER_ZOOM = "-0.17"
BEZEL_IMAGE_BORDER = "1.02"
DO_CURVATURE = 1.0
GEOM_CORNER_SIZE = 0.005
GEOM_CORNER_SMOOTH = 400
GEOM_CORNER_SMOOTH = "150"
DO_VIGNETTE = "1.0"
DO_SPOT = "1.0"

View File

@ -4,6 +4,6 @@ DO_SHIFT_RGB = "1.0"
BEZEL_FRAME_ZOOM = "0.17"
BEZEL_INNER_ZOOM = "-0.015"
BEZEL_INNER_ZOOM = "-0.011"
BEZEL_IMAGE_BORDER = "1.02"

View File

@ -0,0 +1,9 @@
#reference "tv-flickering.slangp"
IN_GLOW_POWER = "1.8"
TEMPERATURE = "8500.000000"
DO_FXAA = "0.000000"
DO_PIXELGRID_H = "0.400000"
PIXELGRID_COREY_FAKE_SCAN = "1.000000"
PIXELGRID_DECON_R_H = "-0.600000"
PIXELGRID_DECON_B_H = "0.600000"

View File

@ -37,16 +37,16 @@ DO_BLOOM = "1.000000"
BLOOM_MIX = "0.250000"
DO_CURVATURE = "1.000000"
GEOM_CORNER_SMOOTH = "400.000000"
GEOM_CORNER_SIZE = 0.005
GEOM_CORNER_SMOOTH = "150"
DO_BEZEL = "1.000000"
BEZEL_FRAME_ZOOM = "0.04"
BEZEL_INNER_ZOOM = "-0.175"
BEZEL_INNER_ZOOM = "-0.17"
BEZEL_R = "-0.190000"
BEZEL_G = "-0.190000"
BEZEL_B = "-0.190000"
BEZEL_CON = "2.180000"
BEZEL_SPCL_STRENGTH = "0.950000"
DO_VIGNETTE = "1.000000"
V_SIZE = "1.08"

View File

@ -8,11 +8,11 @@ DO_BEZEL = "1.0"
BEZEL_B = "-0.3"
BEZEL_CON = "1.3"
BEZEL_FRAME_ZOOM = "0.04"
BEZEL_INNER_ZOOM = "-0.175"
BEZEL_INNER_ZOOM = "-0.17"
DO_CURVATURE = 1.0
GEOM_CORNER_SIZE = 0.005
GEOM_CORNER_SMOOTH = 400
GEOM_CORNER_SIZE = "0.005"
GEOM_CORNER_SMOOTH = "150.000000"
DO_VIGNETTE = "1.0"
DO_SPOT = "1.0"

View File

@ -4,11 +4,9 @@ DO_SHIFT_RGB = "1.0"
BEZEL_FRAME_ZOOM = "0.17"
BEZEL_INNER_ZOOM = "-0.015"
BEZEL_INNER_ZOOM = "-0.011"
BEZEL_IMAGE_BORDER = "1.02"
BEZEL_RFL_BLR_SHD = "-0.200000"
BEZEL_RFL_OFFSET = "0.001000"
BEZEL_REFL_ZOOM = "0.990000"
DO_VIGNETTE = "1.0"
DO_SPOT = "1.0"

View File

@ -70,8 +70,8 @@ DO_BLOOM = "1.000000"
BLOOM_OVER_WHITE = "0.5"
DO_CURVATURE = "1.000000"
GEOM_CORNER_SIZE = "0.010000"
GEOM_CORNER_SMOOTH = "200.000000"
GEOM_CORNER_SIZE = "0.005"
GEOM_CORNER_SMOOTH = "150.000000"
DO_PIXELGRID = "1.0"
@ -81,8 +81,8 @@ DO_DYNZOOM = "0.015"
DO_SPOT = "1.0"
S_POSITION_X = "-0.5"
S_POSITION_Y = "0.5"
S_SIZE = "0.4"
S_POWER = "0.05"
S_SIZE = "0.36"
S_POWER = "0.06"
DO_VIGNETTE = "1.0"
V_SIZE = "1.08"
@ -96,8 +96,8 @@ DO_AMBILIGHT = 1.0
DO_BEZEL = "1.0"
BEZEL_FRAME_ZOOM = "0.17"
BEZEL_INNER_ZOOM = "-0.01"
BEZEL_INNER_ZOOM = "-0.011"
BEZEL_IMAGE_BORDER = "1.02"
BEZEL_RFL_BLR_SHD = "-0.200000"
BEZEL_RFL_OFFSET = "0.001000"
BEZEL_REFL_ZOOM = "0.990000"
BEZEL_REFL_ZOOM = "1.0"

View File

@ -6,9 +6,10 @@ GAMMA_OUT = "0.43"
PIXELGRID_H_PRST = "1.0"
PIXELGRID_GAMMA_H = "4.2"
PIXELGRID_OFFSET_CORE = "0.12"
PIXELGRID_COREY_FAKE_SCAN = "-0.0"
DO_BEZEL = "1.000000"
BEZEL_INNER_ZOOM = "-0.391000"
BEZEL_INNER_ZOOM = "-0.3900"
BEZEL_FRAME_ZOOM = "-0.140000"
BEZEL_R = "0.070000"
BEZEL_G = "0.050000"
@ -16,7 +17,9 @@ DO_BEZEL = "1.000000"
BEZEL_CON = "2.180000"
BEZEL_REFL_STRENGTH = "1.5"
BEZEL_DIFFUSION_STR = "0.5"
BEZEL_CORNER_DARK = "0.400000"
BEZEL_CORNER_DARK = "0.600000"
BEZEL_LIGHT_NO_FADEOUT = "1.0"
DO_BG_IMAGE = "1.000000"
BG_IMAGE_OVER = "1.000000"

View File

@ -24,7 +24,7 @@ DO_PIXELGRID = "1.000000"
PIXELGRID_MAX_H = "0.900000"
PIXELGRID_OFFSET_CORE = "0.1"
PIXELGRID_GAMMA_H = "5.199997"
PIXELGRID_NO_INTERBLEED_H = "1.000000"
PIXELGRID_NO_INTERBLEED_H = "2.000000"
PIXELGRID_DECON_R_H = "-0.600000"
PIXELGRID_DECON_B_H = "0.600000"
PIXELGRID_Y_MASK = "0.000000"

View File

@ -0,0 +1,22 @@
#reference "Monitor-Screen_Hmask-Screen_SlotMask.slangp"
BEZEL_INNER_ZOOM = "-0.195"
BEZEL_FRAME_ZOOM = "0.021000"
BEZEL_R = "-0.5"
BEZEL_G = "-0.5"
BEZEL_B = "-0.5"
BEZEL_CON = "0.87"
BEZEL_SPCL_STRENGTH = "0.200000"
BEZEL_RFL_BLR_SHD = "-1.5"
BEZEL_REFL_STRENGTH = "1.000000"
BEZEL_DIFFUSION_STR = "0.600000"
BEZEL_LIGHT_NO_FADEOUT = "0.500000"
BEZEL_CORNER_DARK = "0.600000"
PIXELGRID_Y_SPARK = "0.0"
PIXELGRID_Y_MASK_STEEP = "7.0"
AMBI_STEPS = "5.000000"
AMBI_OVER_BEZEL_SIZE = "0.500000"
AMBI_STRETCH = "0.100000"
AMBI_OVER_BEZEL = "1.30000"

View File

@ -44,10 +44,10 @@ DO_BLOOM = "1.000000"
BLOOM_EYE_INERTIA = "10.000000"
BLOOM_OVER_WHITE = "0.000000"
DO_CURVATURE = "1.000000"
GEOM_CORNER_SIZE = "0.010000"
GEOM_CORNER_SMOOTH = "200.000000"
GEOM_CORNER_SIZE = "0.005"
GEOM_CORNER_SMOOTH = "150.000000"
DO_BEZEL = "1.000000"
BEZEL_INNER_ZOOM = "-0.010000"
BEZEL_INNER_ZOOM = "-0.011"
BEZEL_FRAME_ZOOM = "0.170000"
DO_VIGNETTE = "1.000000"
V_SIZE = "1.000000"

View File

@ -1,7 +1,10 @@
#reference "Base.slangp"
IN_GLOW_POWER = "1.600000"
GAMMA_OUT = "0.500000"
IN_GLOW_GAMMA = "2"
GAMMA_OUT = "0.5"
LUMINANCE = "0.0"
DO_SHIFT_RGB = "1.000000"

View File

@ -0,0 +1,41 @@
#reference "Monitor-Screen_Hmask-Screen_SlotMask_Taller.slangp"
GAMMA_OUT = "0.49"
IN_GLOW_SPREAD = "1.999999"
IN_GLOW_SPREAD_SHARPNESS = "1.2"
LUMINANCE = "0.1"
IN_GLOW_W = "2.0"
IN_GLOW_H = "3.0"
DO_PIXELGRID = "1.000000"
DO_PIXELGRID_H = "1.0"
PIXELGRID_MIN_W = "0.050000"
PIXELGRID_MAX_W = "0.250000"
PIXELGRID_MIN_H = "0.300000"
PIXELGRID_MAX_H = "0.700000"
PIXELGRID_INFLATION = "1.150000"
PIXELGRID_GAMMA_H = "5.2"
PIXELGRID_MAX_W = "0.400000"
PIXELGRID_GAMMA_W = "1.500000"
PIXELGRID_Y_MASK = "0.300000"
PIXELGRID_Y_MASK_STEEP = "8.000000"
PIXELGRID_Y_SPARK = "0.500000"
HALO_VS_SCAN = "1.000000"
BLOOM_MIX = "0.300001"
BLOOM_POWER = "3.9"
BLOOM_EYE_INERTIA = "250.000000"
BLOOM_OVER_WHITE = "0.000000"

View File

@ -29,7 +29,7 @@ DO_PIXELGRID = "1.000000"
PIXELGRID_MAX_H = "1.250000"
PIXELGRID_OFFSET_CORE = "0.06"
PIXELGRID_GAMMA_H = "8.000000"
PIXELGRID_NO_INTERBLEED_H = "3.0"
PIXELGRID_NO_INTERBLEED_H = "4.0"
PIXELGRID_DECON_R_H = "-0.600000"
PIXELGRID_DECON_B_H = "0.600000"
PIXELGRID_Y_MASK = "0.000000"

View File

@ -53,12 +53,14 @@ DO_BLOOM = "1.000000"
BLOOM_EYE_INERTIA = "750.000000"
DO_CURVATURE = "1.000000"
GEOM_CORNER_SIZE = "0.010000"
GEOM_CORNER_SMOOTH = "200.000000"
GEOM_CORNER_SIZE = "0.0050"
GEOM_CORNER_SMOOTH = "150.000000"
DO_BEZEL = "1.000000"
BEZEL_INNER_ZOOM = "-0.010000"
BEZEL_INNER_ZOOM = "-0.011"
BEZEL_FRAME_ZOOM = "0.170000"
DO_VIGNETTE = "1.000000"
V_SIZE = "1.080000"
DO_SPOT = "1.000000"

View File

@ -8,5 +8,4 @@ PIXELGRID_H_PRST = "1.000000"
DO_PIXELGRID_H = "0.600000"
GEOM_CORNER_SIZE = "0.005000"
GEOM_CORNER_SMOOTH = "800.000000"
BEZEL_FRAME_ZOOM = "0.175000"
GEOM_CORNER_SMOOTH = "200.000000"

View File

@ -23,6 +23,7 @@ PIXELGRID_MAX_W = "0.500000"
PIXELGRID_MAX_H = "0.500000"
PIXELGRID_GAMMA_H = "3.000001"
PIXELGRID_Y_MASK = "0.000000"
PIXELGRID_INFLATION = "0.0"
DO_DOT_MATRIX = "0.0"
@ -45,8 +46,8 @@ BLOOM_EYE_ADPT_SRT = "1.5"
DO_CURVATURE = "1.000000"
GEOM_WARP_X = "0.000000"
GEOM_WARP_Y = "0.000000"
GEOM_CORNER_SIZE = "0.019000"
GEOM_CORNER_SMOOTH = "311.000000"
GEOM_CORNER_SIZE = "0.01000"
GEOM_CORNER_SMOOTH = "500.000000"
DO_BEZEL = "0.0"
@ -58,3 +59,4 @@ V_SIZE = "1.600000"
DO_SPOT = "1.000000"
S_POWER = "0.050000"
RESSWITCH_GLITCH_SIZE = "0.0"

View File

@ -2,6 +2,7 @@
bg_under = "../textures/overlays/gamegear.jpg"
bg_over = "../textures/overlays/gamegear.jpg"
DO_HALO = "1.000000"
HALO_POWER = "0.200000"
@ -25,7 +26,7 @@ DO_PIXELGRID = "1.000000"
PIXELGRID_MIN_W = "0.450000"
PIXELGRID_MAX_W = "1.00000"
PIXELGRID_H_PRST = "3.000000"
PIXELGRID_INFLATION = "0.0"
DO_PIXELGRID_H = "0.000000"
PIXELGRID_Y_MASK = "0.500000"
@ -38,6 +39,7 @@ PIXELGRID_Y_MASK = "0.500000"
DO_BG_IMAGE = "1.000000"
BG_IMAGE_WRAP_MODE = "1.000000"
BG_IMAGE_OFFY = "-0.111000"
BG_IMAGE_OFFX = "0.0005"
BG_IMAGE_ZOOM = "1.200485"
BG_IMAGE_NIGHTIFY = "0.200000"
@ -52,7 +54,7 @@ DO_BLOOM = "1.000000"
DO_CURVATURE = "1.0"
GEOM_WARP_X = "0.0"
GEOM_WARP_Y = "0.0"
GEOM_CORNER_SIZE = "0.010000"
GEOM_CORNER_SIZE = "0.0050000"
GEOM_CORNER_SMOOTH = "350.000000"
DO_AMBILIGHT = "1.0"
@ -74,19 +76,22 @@ DO_VIGNETTE = "1.000000"
S_POSITION_X = "-0.5"
S_POSITION_Y = "0.5"
ASPECT_X = "-1.000000"
ASPECT_Y = "1.000000"
ASPECT_X = "0.00000"
DO_GAME_GEOM_OVERRIDE = "1.000000"
GAME_GEOM_INT_SCALE = "0.000000"
GAME_GEOM_ASPECT = "1.330000"
GAME_GEOM_VSHIFT = "-0.420000"
GAME_GEOM_HSHIFT = "-0.110000"
GAME_GEOM_ZOOM = "0.480000"
DO_GAME_GEOM_OVERRIDE = "0.000000"
DO_GLOBAL_SHZO = "1.000000"
GLOBAL_OFFX = "-0.013000"
GLOBAL_OFFY = "-0.046500"
GLOBAL_ZOOM = "0.533001"
RESSWITCH_GLITCH_SIZE = "0.0"
DO_DOT_MATRIX = "0.000000"

View File

@ -1,6 +1,7 @@
#reference "GameboyAdvance-Overlay.slangp"
bg_under = "../textures/overlays/gba.jpg"
bg_over = "../textures/overlays/gba.jpg"
DO_AMBILIGHT = "1.0"
BG_IMAGE_NIGHTIFY = "0.900000"

View File

@ -1,7 +1,7 @@
#reference "../koko-aio-ng.slangp"
bg_under = "../textures/overlays/gba.jpg"
bg_over = "../textures/overlays/gba.jpg"
DO_CCORRECTION = "1.000000"
@ -31,6 +31,8 @@ DO_PIXELGRID = "1.000000"
PIXELGRID_MIN_H = "0.400000"
PIXELGRID_MAX_H = "0.950000"
PIXELGRID_INFLATION = "0.0"
PIXELGRID_Y_MASK = "0.000000"
DO_BG_IMAGE = "1.000000"
@ -50,7 +52,7 @@ DO_BLOOM = "1.000000"
DO_CURVATURE = "1.0"
GEOM_WARP_X = "0.0"
GEOM_WARP_Y = "0.0"
GEOM_CORNER_SIZE = "0.010000"
GEOM_CORNER_SIZE = "0.0050000"
GEOM_CORNER_SMOOTH = "350.000000"
DO_AMBILIGHT = "0.0"
@ -69,14 +71,17 @@ DO_VIGNETTE = "1.000000"
S_POSITION_X = "-0.5"
S_POSITION_Y = "0.5"
ASPECT_X = "-1.000000"
ASPECT_Y = "1.000000"
DO_GLOBAL_SHZO = "1.000000"
GLOBAL_OFFX = "0.001500"
GLOBAL_OFFY = "-0.029000"
GLOBAL_ZOOM = "0.481500"
ASPECT_X = "254.000000"
ASPECT_Y = "162.000000"
DO_GAME_GEOM_OVERRIDE = "1.000000"
GAME_GEOM_INT_SCALE = "0.000000"
GAME_GEOM_ASPECT = "1.550000"
GAME_GEOM_VSHIFT = "-0.280000"
GAME_GEOM_HSHIFT = "0.010000"
GAME_GEOM_ZOOM = "0.500000"
DO_DOT_MATRIX = "0.000000"
RESSWITCH_GLITCH_SIZE = "0.0"

View File

@ -0,0 +1,21 @@
#reference "GameboyColor-Overlay.slangp"
TEMPERATURE = "7200.000000"
PIXELGRID_BASAL_GRID = "0.000000"
PIXELGRID_INFLATION = "0.0"
DO_HALO = "1.000000"
HALO_NO_PREGAIN = "1.000000"
HALO_POWER = "0.500000"
HALO_SHARPNESS = "7.000000"
HALO_VS_SCAN = "1.000000"
DO_BLOOM = "1.000000"
BLOOM_MIX = "0.400001"
BG_IMAGE_NIGHTIFY = "0.700000"
DO_AMBILIGHT = "1.000000"
AMBI_STEPS = "5.000000"
AMBI_FALLOFF = "0.260000"
AMBI_BG_IMAGE_BLEND_MODE = "1.000000"
AMBI_ADD_ON_BLACK = "0.000000"
AMBI_BG_IMAGE_FORCE = "1.000000"
DO_VIGNETTE = "0.000000"
DO_SPOT = "0.000000"

View File

@ -0,0 +1,21 @@
#reference "GameboyColor-Overlay-Taller.slangp"
TEMPERATURE = "7200.000000"
PIXELGRID_BASAL_GRID = "0.000000"
PIXELGRID_INFLATION = "0.0"
DO_HALO = "1.000000"
HALO_NO_PREGAIN = "1.000000"
HALO_POWER = "0.500000"
HALO_SHARPNESS = "7.000000"
HALO_VS_SCAN = "1.000000"
DO_BLOOM = "1.000000"
BLOOM_MIX = "0.400001"
BG_IMAGE_NIGHTIFY = "0.700000"
DO_AMBILIGHT = "1.000000"
AMBI_STEPS = "5.000000"
AMBI_FALLOFF = "0.260000"
AMBI_BG_IMAGE_BLEND_MODE = "1.000000"
AMBI_ADD_ON_BLACK = "0.000000"
AMBI_BG_IMAGE_FORCE = "1.000000"
DO_VIGNETTE = "0.000000"
DO_SPOT = "0.000000"

View File

@ -0,0 +1,18 @@
#reference "GameboyColor-Overlay.slangp"
PIXELGRID_MIN_W = "0.400000"
PIXELGRID_MAX_W = "0.800000"
PIXELGRID_INFLATION = "0.0"
DOT_M_G_SHARP = "1.000000"
BG_IMAGE_OFFY = "-0.183499"
BG_IMAGE_ZOOM = "1.368502"
GLOBAL_OFFY = "-0.160000"
GLOBAL_ZOOM = "0.435499"
DO_GAME_GEOM_OVERRIDE = "1.000000"
GAME_GEOM_ZOOM = "1.0"
GAME_GEOM_VSHIFT = "0.000000"

View File

@ -0,0 +1,21 @@
#reference "GameboyColor.slangp"
bg_over = "../textures/overlays/gbc.jpg"
bg_under = "../textures/overlays/gbc.jpg"
DO_BG_IMAGE = "1.000000"
BG_IMAGE_OFFY = "-0.425000"
BG_IMAGE_ZOOM = "2.000000"
BG_IMAGE_WRAP_MODE = "2.000000"
DO_GLOBAL_SHZO = "1.000000"
GLOBAL_OFFX = "-0.000000"
GLOBAL_OFFY = "-0.069000"
GLOBAL_ZOOM = "0.640000"
GEOM_CORNER_SIZE = "0.01"
GEOM_CORNER_SMOOTH = "200.000000"
DO_AMBILIGHT = "0.0"
RESSWITCH_GLITCH_SIZE = "0.0"

View File

@ -0,0 +1,59 @@
#reference "../koko-aio-ng.slangp"
DO_CCORRECTION = "1.000000"
IN_GLOW_POWER = "1.000001"
IN_GLOW_GAMMA = "2.000000"
GAMMA_OUT = "0.500000"
DO_IN_GLOW = "0.000000"
DO_PIXELGRID = "1.000000"
DO_PIXELGRID_H = "0.000000"
PIXELGRID_SIZE_W = "0.000000"
PIXELGRID_H_PRST = "4.000000"
PIXELGRID_H_COUNT = "4.000000"
PIXELGRID_R_SHIFT = "1.000000"
PIXELGRID_G_SHIFT = "2.000000"
PIXELGRID_B_SHIFT = "3.000000"
PIXELGRID_MAX_W = "0.800000"
PIXELGRID_BASAL_GRID = "1.999998"
PIXELGRID_Y_MASK = "0.000000"
PIXELGRID_INFLATION = "0.0"
DO_DOT_MATRIX = "1.000000"
DOT_M_G_STR = "0.500000"
DOT_M_G_TRESH = "0.800000"
DOT_M_MBLUR_STR = "0.000000"
DOT_M_SHADOW_OFF = "1.000000"
DO_HALO = "0.0"
DO_BLOOM = "0.0"
DO_CURVATURE = "0.000000"
GEOM_CORNER_SMOOTH = "500.000000"
AMBI_FALLOFF = "0.100000"
AMBI_POWER = "1.999999"
AMBI_INT_OFFSET = "0.220000"
AMBI_SMP_INT_OFFSET = "0.100000"
AMBI_STRETCH = "1.000000"
AMBI_STRETCH_VERTICAL = "0.180001"
AMBI_GAMMA = "3.000000"
DO_VIGNETTE = "1.000000"
V_SIZE = "1.000000"
V_POWER = "0.999999"
DO_SPOT = "1.000000"
S_POSITION_X = "0.000000"
S_POSITION_Y = "0.950001"
S_SIZE = "2.099999"
S_POWER = "0.200000"
ASPECT_X = "-3.000000"
ASPECT_Y = "1.000000"
DO_DYNZOOM = "0.000000"
RESSWITCH_GLITCH_SIZE = "0.0"

View File

@ -3,10 +3,11 @@
BG_IMAGE_OFFY = "-0.115000"
BG_IMAGE_ZOOM = "1.368502"
GLOBAL_OFFY = "-0.174000"
GLOBAL_ZOOM = "0.38"
DO_GAME_GEOM_OVERRIDE = "1.000000"
GAME_GEOM_VSHIFT = "-2.869998"
GAME_GEOM_ZOOM = "0.660000"
GAME_GEOM_ZOOM = "1.0"
GAME_GEOM_VSHIFT = "0.000000"

View File

@ -59,6 +59,7 @@ DO_SPOT = "1.000000"
S_POWER = "0.120000"
DO_PIXELGRID = "0.0"
PIXELGRID_INFLATION = "0.0"
DO_GAME_GEOM_OVERRIDE = "0.000000"
DO_HALO = "0.0"
DO_BLOOM = "0.0"
@ -67,4 +68,7 @@ DO_BEZEL = "0.000000"
DO_AMBILIGHT = "0.0"
DO_DYNZOOM = "0.000000"
GEOM_CORNER_SMOOTH = "500.000000"
GEOM_CORNER_SIZE = "0.005"
RESSWITCH_GLITCH_SIZE = "0.0"

View File

@ -33,12 +33,17 @@ DO_DOT_MATRIX = "1.000000"
DOT_M_SHADOW_STR = "0.750000"
DOT_M_SHADOW_OFF = "1.000000"
PIXELGRID_INFLATION = "0.0"
DO_HALO = "0.0"
DO_BLOOM = "0.0"
DO_CURVATURE = "0.0"
GEOM_CORNER_SIZE = "0.01000"
GEOM_CORNER_SMOOTH = "800.000000"
DO_BEZEL = "0.0"
AMBI_FALLOFF = "0.400000"
@ -61,5 +66,5 @@ ASPECT_X = "-5.000000"
DO_GAME_GEOM_OVERRIDE = "0.000000"
RESSWITCH_GLITCH_SIZE = "0.0"

View File

@ -13,3 +13,4 @@ DO_GLOBAL_SHZO = "1.000000"
GLOBAL_OFFY = "-0.017500"
GLOBAL_ZOOM = "0.670505"
RESSWITCH_GLITCH_SIZE = "0.0"

View File

@ -20,7 +20,7 @@ DO_PIXELGRID = "1.000000"
PIXELGRID_R_SHIFT = "1.000000"
PIXELGRID_G_SHIFT = "2.000000"
PIXELGRID_B_SHIFT = "3.000000"
PIXELGRID_INFLATION = "0.0"
DO_PIXELGRID_H = "0.000000"
PIXELGRID_Y_MASK = "0.7"
@ -45,13 +45,17 @@ DO_CURVATURE = "1.0"
GEOM_CORNER_SIZE = "0.010000"
GEOM_CORNER_SMOOTH = "350.000000"
//From Base.slangp
DO_AMBILIGHT = 1.0
AMBI_FALLOFF = "0.40"
AMBI_POWER = "1.8"
AMBI_STEPS = "60.0"
AMBI_OVER_BEZEL = "0.2"
AMBI_STRETCH = "0.3"
AMBI_FALLOFF = "0.100000"
AMBI_POWER = "1.999999"
AMBI_INT_OFFSET = "0.220000"
AMBI_SMP_INT_OFFSET = "0.100000"
AMBI_STRETCH = "1.000000"
AMBI_STRETCH_VERTICAL = "0.180001"
AMBI_GAMMA = "3.000000"
DO_DYNZOOM = "0.000000"
DO_VIGNETTE = "1.000000"
@ -66,5 +70,6 @@ ASPECT_Y = "1.000000"
DO_GAME_GEOM_OVERRIDE = "1.000000"
GAME_GEOM_INT_SCALE = "2.000000"
GAME_GEOM_INT_SCALE_MAX = "5.000000"
GAME_GEOM_OFF_FIX = "4.000000"
GAME_GEOM_OFF_FIX = "0.000000"
RESSWITCH_GLITCH_SIZE = "0.0"

View File

@ -53,7 +53,7 @@
//set it to the minimum value which allows you to see ambient lights and background image around the frame.
#define BEZEL_FRAME_SURROUND_MARGIN 0.06
//to speedup things, bezel rende logic can be completely skipped in the inner tube, if we
//to speedup things, bezel render logic can be completely skipped in the inner tube, if we
//already know it is completely transparent.
//Set the following to the maximum value that allow you to see
//bezel borders and, if present in the source bezel texture, inner content/border shades
@ -72,8 +72,8 @@
// Define the size and the smoothness of the rectangle
// in the bezel corners that will hide and blur the reflections
#define BEZEL_REFL_CORNER_BLANK_SIZE 0.091
#define BEZEL_REFL_CORNER_BLANK_SHADE 0.055 // keep it > 0.0
#define BEZEL_REFL_CORNER_BLANK_SIZE 0.095
#define BEZEL_REFL_CORNER_BLANK_SHADE 0.095 // keep it > 0.0
//When colorizing the bezel via ambient light, it is possible to choose where
@ -83,6 +83,11 @@
#define AMBI_OVER_BEZEL_AR_CORRECTION 0.98
//This is used to fadeout reflection and diffusion strength
//It alters the start of the gradient
//Set it roughly to (tube size / bezel total size)
#define BEZEL_REFL_FADEOUT_START 0.90
// AMBIENT LIGHT STATIC CONFIG ##########################################################################################
@ -127,6 +132,10 @@
#define NEW_SCALEMOD_X (global.flick_and_noise_passSize.x/(360.0*2.0) / 2.2)
#define NEW_SCALEMOD_Y (global.flick_and_noise_passSize.y/(270.0*2.0) / 2.2)
// AUTOCROP
//which coords holds the autocrop zoom value
#define AUTOCROP_SAMPLING_POINT vec2(0.125)
// RESOLUTION SWITCH GLITCH EMULATION ##########################################################################################
//Where to sample alpha from avglum pass to understand if resolution has changed (very internal setting)

View File

@ -135,8 +135,9 @@
// #define PIXELGRID_DOUBLESCAN 0.0
// #define PIXELGRID_MIN_H 0.300000
// #define PIXELGRID_MAX_H 0.700000
// #define PIXELGRID_INFLATION 0.5
// #define PIXELGRID_GAMMA_H 5.2
// #define PIXELGRID_NO_INTERBLEED_H 0.0
// #define PIXELGRID_NO_INTERBLEED_H 1.0
// #define PIXELGRID_H_ANTIMOIRE 0.0
// #define PIXELGRID_OFFSET_CORE 0.00000
// #define PIXELGRID_DECON_R_H 0.0
@ -211,15 +212,16 @@
// #define BEZEL_USE_STRAIGHT 0.0
// #define BEZEL_INNER_ZOOM -0.01
// #define BEZEL_FRAME_ZOOM 0.17
// #define BEZEL_R -0.3
// #define BEZEL_G -0.3
// #define BEZEL_B -0.3
// #define BEZEL_R -0.35
// #define BEZEL_G -0.35
// #define BEZEL_B -0.35
// #define BEZEL_CON 1.3
// #define BEZEL_RFL_ZOOM 0.0
// #define BEZEL_REFL_STRENGTH 0.65
// #define BEZEL_REFL_STRENGTH 0.5
// #define BEZEL_RFL_BLR_SHD -0.200000
// #define BEZEL_ROUGHNESS 1.0
// #define BEZEL_DIFFUSION_STR 0.0
// #define BEZEL_DIFFUSION_STR 0.2
// #define BEZEL_LIGHT_NO_FADEOUT 0.5
// #define BEZEL_SPCL_STRENGTH 0.5
// #define BEZEL_CORNER_DARK 0.8
@ -281,6 +283,13 @@
// #define DO_DYNZOOM 0.015
// #define AUTOCROP_MAX 0.0
// #define AUTOCROP_MIN 1.0
// #define AUTOCROP_SAMPLES 10
// #define AUTOCROP_SAMPLE_SIZE 2.0
// #define AUTOCROP_STEADINESS 0.01
// #define AUTOCROP_SAMPLES 0.02
// #define DO_GAME_GEOM_OVERRIDE 0.0
// #define GAME_GEOM_INT_SCALE 0.0
// #define GAME_GEOM_INT_SCALE_MAX 10.0
@ -314,10 +323,10 @@
////////////////////////////////////////////////////////////////////////////
//Renders only changed parts of screen, set to 1.0 to lower power consumption:
// #define DELTA_RENDER 1.0
#define DELTA_RENDER 0.0
//Halve rendering refresh on bezel and ambilight set to 1.0 to spare gpu cycles:
// #define HALVE_BORDER_UPDATE 1.0
#define HALVE_BORDER_UPDATE 0.0
//Skip random() function used for noise/debanding/bezel roughness,
//set to 1.0 to spare gpu cycles:

View File

@ -213,14 +213,16 @@ https://github.com/kokoko3k/koko-aio-slang-misc/tree/main
The decision will be based on the ratio of output dimensions and the core.
Phosphors height Min, Max:
Try to keep scanline height between those values, depending on content brightness.
Inflation Strength:
Scanlines appear as inflated depending on the pixel brightness.
Phosphors width min->max gamma:
Since emulating phosphors with high Min-Max range changes the apparent gamma of the final image,
it is advised, if needed, to use this option to compensate, instead of the main gamma correction.
It is also a quick way to make the image brighter or darker.
Inter-line extra steepness (for integer scaling)
Inter-line extra steepness (good for integer scaling, nice when Phosphors height max > 1.0)
When you set maximum height to anything > 0.5, the phosphor light will bleed over
the adiacent (up/down) ones so that they will start to blend togheter.
This option will avoid the bleeding.
Setting this option to anything >1.0 will avoid the bleeding.
You may want them to blend or not, depending on your preference to keep scanlines separated.
This function is useful when you want to emulate handhelds screens using integer scaling,
where cells are well separated.
@ -442,10 +444,12 @@ https://github.com/kokoko3k/koko-aio-slang-misc/tree/main
WARP X, WARP Y:
control how much the display is curved along its axes.
Corner radius, Corner sharpness:
Control the "smoothness" of the display corners.
Cut curvature ears;
If you see weird image repetition try this.
**Corners/Edges:**<br>
Corner radius, Edge sharpness:
Control the "smoothness" of the display edges.
**Bezel:**<br>
Draws a monitor frame with simulated reflections from the game content.<br>
@ -480,6 +484,8 @@ https://github.com/kokoko3k/koko-aio-slang-misc/tree/main
The amount of material roughness in reflection area
Diffusion strength
Mix an amount of high blurred reflection to simulate light diffusion
Light fadeout distance
Modulates the reflected and diffused light fadeout. higher numbers -> no fadeout.
Specularity strength
The amount of specular reflection
Darken corners
@ -620,6 +626,37 @@ https://github.com/kokoko3k/koko-aio-slang-misc/tree/main
Please TURN THIS OFF if you want to use integer scaling, since this obstructs it.
The higher, the more prominent the effect.
**Autocrop**:
Clears solid bars around the frame.
Autocrop maximum amount:
The higher, the more solid borders wil be cropped around the image.
0.3 means 30%
Number of mandatory lines to crop:
The minimum lines to always crop; this is useful because sometimes
games have one or two "spurious" lines at the very edge of the screen that
won't allow autocrop to work at all.
This can be used to ignore them.
Samples per frame:
Higher values makes the shader search more in a single frame for solid areas.
This leads to more accurate result in less time, however it will also stress the gpu more.
Fortunately even low/lighter values like 10 will work good if you're ok
in waiting 2..3 seconds for the final crop value to be found.
Sample size:
Search multiple pixels at once, this provide a big performance boost, but less accuracy.
It means that some solid bar could remain around the image.
Scene change treshold
When autocrop finds a maximum crop value, it only tries to crop more when the scene changes.
By lowering this value, you tell the shader to try higher the crop more often.
Use 0.0 is probably useful only to trigger a new search.
Transition speed
This modulates the smoothness of the animation between various crop values.
**Override content geometry:**<br>
Contrary to the global aspect ratio control, this changes only the game geometry.<br>
Bezel stays the same.<br>

View File

@ -62,29 +62,42 @@ shaders = 17
# Color tools
# Ghosting
# Phosphor persistance
# Geometry override shifting (so it needs clamp_to _border)
# It generates mipmaps to be used by several passes afterwards
# Also, it carries a series of debug patterns that need to be activated by modifying
# some #defines in the pass itself
#ASMDEBUG GLSL27
shader0 = shaders-ng/colortools_and_ntsc_pass.slang
alias0 = "colortools_and_ntsc_pass"
#float_framebuffer needed by phosphor persistance
float_framebuffer0 = true
filter_linear0 = false
scale_type0 = source
scale0 = 1.0
wrap_mode0 = "clamp_to_border"
// (**Note 0)
// Watch out for filter_linear0 and wrap_mode0
// In retroarch, metadatas such as the followings, usually applies to the
// previous pass (Original, in this case).
// However it seems that those metadatas are applied to the feedback of the pass itself.
// Now, since we need to compare colortools_and_ntsc_pass and colortools_and_ntsc_passFeedback
// for Deltarender purposes, it is important that they share the same filtering and wrap mode.
// Hence, we have to set the following as the same of float_framebuffer0,filter_linear0 and wrap_mode0
float_framebuffer0 = "true"
filter_linear0 = "true"
wrap_mode0 = "mirrored_repeat"
# This pass emulates the flickering observed on crts when the input signal is interlaced
# and there is high brightness difference between adiacent scanlines.
# This pass is able to generate mipmaps because the next pass has mipmap_input true.
#
# Note that the wrap_mode is set to "mirrored_repeat".
# This allow to cheaply generate a mirrored image that will be used later on to
# draw reflections on the bezel.
#
# Also, it upscales the input signal to 2X.
# This is needed because FXAA, the glow and the halo pass works best at at least 640x480 resolution.
# This is needed because FXAA, the glow and the halo pass works best with at least 640x480 resolution.
# Note that this is needed only for lowres content, but if the input signal is already at that
# size, there is no need to scale to 2x, and it is possible to gain performance by turning
# scale_x1 and scale_y1 from 2.0 to 1.0.
@ -94,14 +107,20 @@ float_framebuffer0 = true
# and only scale_y1 = 2.0 is needed.
# As an alternative option you can configure P-UAE to always output to low resolution for x and y
# But this way you loose the emulation for hires content (not much games uses it anyway).
# ASMDEBUG: GLSL30
shader1 = shaders-ng/flick_and_noise.slang
alias1 = "flick_and_noise_pass"
filter_linear1 = false
scale_type1 = source
scale_x1 = 2.0
scale_y1 = 2.0
mipmap_input1 = "true"
//(See **Note 0)
wrap_mode1 = "mirrored_repeat"
float_framebuffer1 = true
float_framebuffer1 = "true"
filter_linear1 = "true"
@ -112,12 +131,13 @@ float_framebuffer0 = true
# makes first_pass mipmaps available to everyone.
# Even if theoretically not needed, texture() occurrence in FXAA_pass needed to be switched
# to textureLod(..,0.0) or it acts weird, don't ask me why.
# ASMDEBUG: GLSL33
shader2 = shaders-ng/fxaa.slang
alias2 = "FXAA_pass"
filter_linear2 = true
scale_type2 = source
scale2 = 1.0
mipmap_input2 = true
//this *has* to be clamp_to_border because specular reflections need to turn to black
//if geometry content override is shifting/zooming out the image.
wrap_mode2 = "clamp_to_border"
@ -127,94 +147,96 @@ float_framebuffer0 = true
# This pass emulates NTSC/PAL composite color bleeding and deconvergence
# deconvergence should really be applied in th final pass, but it is too heavy there.
# This pass also apply the input gamma needed for glow pass.
# ASMDEBUG: GLSL36
shader3 = shaders-ng/shift_and_bleed.slang
alias3 = "shift_and_bleed_pass"
filter_linear3 = true
scale3 = 1.0
scale_type3 = source
float_framebuffer3 = true
mipmap_input3 = false
wrap_mode3 = "mirrored_repeat"
# Blur and/or glows and/or sharpens the image as requested
# This passes aims to simulate the signal input power.
# ASMDEBUG: GLSL39
shader4 = shaders-ng/in_glow_x.slang
alias4 = "in_glow_pass_x"
filter_linear4 = true
scale4 = 1.0
scale_type4 = source
float_framebuffer4 = true
//This has to be mipmap true and mirrored true
//mipmaps and mirrored are used to emulate light diffusion from reflection blur pass
//mipmaps are also used by deltarender
wrap_mode4 = "mirrored_repeat"
mipmap_input4 = true
wrap_mode4 = "clamp_to_edge"
# ASMDEBUG: GLSL42
shader5 = shaders-ng/in_glow_y.slang
alias5 = "in_glow_pass"
filter_linear5 = true
scale5 = 1.0
scale_type5 = source
float_framebuffer5 = true
wrap_mode5 = "mirrored_repeat"
wrap_mode5 = "clamp_to_border"
# This essentially is the same as glowing by a code point of view.
# But the result of this pass will be added (+) to the input signal
# in the final pass.
# ASMDEBUG: GLSL45
shader6 = shaders-ng/halo_pre_gamma.slang
alias6 = "halo_pre_gamma_pass"
filter_linear6 = true
scale6 = 1.0
scale_type6 = source
float_framebuffer6 = true
mipmap_input6 = false
wrap_mode6 = "clamp_to_edge"
# This has to be clamp_to_border in order for the glow pass to return a black frame
# around it, which is needed so that when using geometry override and zooming out the content,
# it will have black surrounding.
wrap_mode6 = "clamp_to_border"
# ASMDEBUG: GLSL48
shader7 = shaders-ng/halo.slang
alias7 = "halo_pass"
filter_linear7 = true
scale7 = 1.0
scale_type7 = source
float_framebuffer7 = true
mipmap_input7 = false
wrap_mode7 = "clamp_to_edge"
wrap_mode7 = "clamp_to_border"
# Get the average luminance needed by ambilight here, because:
# * mipmap_input only works on "Source" texture
# * the following pass does not use the previous one
# * the previous pass represents scene changes.
# Get the average luminance needed by ambilight here.
# The rgb channels of the following pass contains luminance info
# Used by the bezel code to light up the bezel corners.
# The alpha channel contains the sum/3.0 of rgb channels
# used to detect scene changes.
# This pass computes the average luminance of the image
# by grabbing a mipmap from first_pass.
# by grabbing a mipmap from colortools_and_ntsc_pass.
# It stores at:
# alpha@coords 0.25,0.25 at reduced sampling to aid ambient light scene change detection
# alpha@coords 0.75,0.75 temporally smoother for use with bloom exposure and dynamic zoom
# rgb: it puts a small mipmap from first_pass that will be used to light-up the bezel highlights
# rgb: it puts a small mipmap from colortools_and_ntsc_pass used to light-up the bezel highlights.
# alpha@other coords: simple continuous sampling used to modulate bezel highlights strength.
# ASMDEBUG: GLSL51
shader8 = shaders-ng/avglum_pass.slang
alias8 = "avglum_pass"
filter_linear8 = true
scale_type8 = source
scale8 = 0.5
wrap_mode8 = "mirrored_repeat"
mipmap_input8 = false
wrap_mode8 = "clamp_to_border"
float_framebuffer8 = "true"
# The following passes will blur the mirrored part of first_pass
# to emulate soft bezel reflections.
# ASMDEBUG: GLSL54
shader9 = shaders-ng/reflection_blur_pre.slang
alias9 = "reflected_blurred_pass_pre"
filter_linear9 = true
@ -222,13 +244,12 @@ float_framebuffer7 = true
scale9 = 1.0
wrap_mode9 = "clamp_to_border"
# ASMDEBUG: GLSL57
shader10 = shaders-ng/reflection_blur.slang
alias10 = "reflected_blurred_pass"
filter_linear10 = true
scale_type10 = source
scale10 = 1.0
mipmap_input10 = false
wrap_mode10 = "mirrored_repeat"
# In the following passes we emulate bloom effect.
@ -236,6 +257,8 @@ float_framebuffer7 = true
# and then do other blur passes at reduced size to keep it fast.
# Every blur pass samples radially around the center and offsets
# the starting point in every subsequent pass.
# ASMDEBUG: GLSL60
shader11 = shaders-ng/bloom_pass_1.slang
alias11 = "bloom_pass_1"
filter_linear11 = true
@ -243,7 +266,7 @@ float_framebuffer7 = true
scale11 = 1.0
wrap_mode11 = "mirrored_repeat"
# ASMDEBUG: GLSL63
shader12 = shaders-ng/bloom_pass_2.slang
alias12 = "bloom_pass_2"
filter_linear12 = true
@ -251,7 +274,7 @@ float_framebuffer7 = true
scale12 = 0.5
wrap_mode12 = "clamp_to_edge"
# ASMDEBUG: GLSL66
shader13 = shaders-ng/bloom_pass_3.slang
alias13 = "bloom_pass_3"
filter_linear13 = true
@ -259,7 +282,7 @@ float_framebuffer7 = true
scale13 = 1.0
wrap_mode13 = "clamp_to_edge"
# ASMDEBUG: GLSL69
shader14 = shaders-ng/bloom_pass_4.slang
alias14 = "bloom_pass_final"
filter_linear14 = true
@ -270,10 +293,11 @@ float_framebuffer7 = true
# Gather mipmaps from first_pass and use them to light virtual leds under the virtual monitor
# Use mipmaps from colortools_and_ntsc_pass to light virtual leds under the virtual monitor
# and temporally smooth led lights.
# Extra logic makes it possible to lower the led reaction time when a scene change is detected.
# this is achieved through average luminance sampling from avglum_pass
# ASMDEBUG: GLSL72
shader15 = shaders-ng/ambi_temporal_pass.slang
alias15 = "ambi_temporal_pass"
filter_linear15 = true
@ -291,6 +315,7 @@ float_framebuffer7 = true
# * Black frame insertions
# * Bezel
# * Background images
# ASMDEBUG: GLSL75
shader16 = shaders-ng/final_pass.slang
alias16 = "final_pass"
filter_linear16 = true

View File

@ -36,6 +36,10 @@ void main() {
vSmpBorder_min = smp_internalness;
vSmpBorder_max = 1.0-smp_internalness;
if (DO_GAME_GEOM_OVERRIDE > 0.5) {
vSmpBorder_min = content_geom_override_zoom(vec2(vSmpBorder_min), GAME_GEOM_ASPECT, get_in_aspect(), GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM).x;
vSmpBorder_max = content_geom_override_zoom(vec2(vSmpBorder_max), GAME_GEOM_ASPECT, get_in_aspect(), GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM).x;
}
bool isrotated = is_rotated();
vIs_rotated = float(isrotated);
@ -45,8 +49,14 @@ void main() {
else
vAMBI_STRETCH = AMBI_STRETCH;
//Keep leds in place when content geometry zoom changes
float ambi_int_offset = AMBI_INT_OFFSET;
if (DO_GAME_GEOM_OVERRIDE + DO_BEZEL > 1.5) {
ambi_int_offset = content_geom_override_zoom (vec2(ambi_int_offset), GAME_GEOM_ASPECT, get_in_aspect(), GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM).x;
}
//Move virtual leds position inside to compensate for widen effect
float led_internalness = AMBI_INT_OFFSET + (vAMBI_STRETCH *0.025);
float led_internalness = ambi_int_offset + (vAMBI_STRETCH *0.025);
//less internalness when using bezel:
@ -62,7 +72,7 @@ void main() {
vSmp_step = (vSmpBorder_max - vSmpBorder_min) / (leds_per_strip-1);
//Calc a lod for a texture sized led_strip x led_strip
lod = log2(global.flick_and_noise_passSize.y / leds_per_strip);
lod = log2(global.flick_and_noise_passSize.y / leds_per_strip) - 1;
//Scale to the original aspect
@ -80,9 +90,9 @@ void main() {
if (DO_GLOBAL_SHZO >0.5)
pre_pass_coords = zoom(pre_pass_coords + vec2(-GLOBAL_OFFX, -GLOBAL_OFFY), GLOBAL_ZOOM );
if (DO_GAME_GEOM_OVERRIDE > 0.5)
pre_pass_coords = content_geom_override(pre_pass_coords, GAME_GEOM_ASPECT, get_in_aspect(), GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM);
if (DO_GAME_GEOM_OVERRIDE > 0.5) {
pre_pass_coords = content_geom_override_zoom(pre_pass_coords, GAME_GEOM_ASPECT, get_in_aspect(), GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM);
}
if (DO_BEZEL > 0.5)
pre_pass_coords = zoomout_coords(pre_pass_coords, -get_BEZEL_INNER_ZOOM());
@ -118,13 +128,20 @@ layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 1) uniform sampler2D PastSampler;
layout(set = 0, binding = 2) uniform sampler2D avglum_pass;
layout(set = 0, binding = 3) uniform sampler2D avglum_passFeedback;
layout(set = 0, binding = 4) uniform sampler2D flick_and_noise_pass;
layout(set = 0, binding = 4) uniform sampler2D colortools_and_ntsc_pass;
vec3 ambi_push_pass(vec2 coords, float f_lod) {
vec3 pixel_out = textureLod(flick_and_noise_pass, coords, f_lod).rgb;
vec2 smp_coords = coords;
if (AUTOCROP_MAX > 0.0) {
float autocrop_zoom = texture(avglum_pass, AUTOCROP_SAMPLING_POINT).a;
smp_coords = zoom(smp_coords, autocrop_zoom);
}
vec3 pixel_out = textureLod(colortools_and_ntsc_pass, smp_coords, f_lod).rgb;
pixel_out = pow(pixel_out, vec3(AMBI_GAMMA));
pixel_out = pixel_push_luminance(pixel_out, vAMBI_POWER);
return pixel_out;
}
@ -145,10 +162,14 @@ vec3 ambi_pre_pass(vec2 coords) {
coords = tilt(coords, vIs_rotated, TILT_X);
//Skip coords in the rect "under the tube"
if (coords.x > tol_start &&
coords.x < tol_end &&
coords.y > tol_start &&
coords.y < tol_end)
// if (is_first_inside_rect(coords, vec4(tol_start, tol_start, tol_end ,tol_end)))
// return vec3(0.0);
vec2 skip_coords = coords;
if (DO_GAME_GEOM_OVERRIDE > 0.5 )
skip_coords = content_geom_override_zoom_inv(skip_coords, GAME_GEOM_ASPECT, get_in_aspect(), GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM);
if (is_first_inside_rect(skip_coords, vec4(tol_start, tol_start, tol_end ,tol_end)))
return vec3(0.0);
//Stretch the lights?

View File

@ -1,5 +1,9 @@
#version 450
#define AUTOCROP_TOLERANCE (1.0/255.0)
//How many pseudorandom samplings per line
/* In this pass we calculate the average luminance of the scene.
* It is cheaply obtained by the use of mipmaps. */
@ -7,7 +11,7 @@
//The mipmap wideness needed by the highlights on the bezel.
//the higher, the smoother.
#define mip_lod 5
#define mip_lod 4
#pragma stage vertex
layout(location = 0) in vec4 Position;
@ -19,8 +23,9 @@ layout(location = 3) out float vReduced_sample_time_is_now;
layout(location = 4) out float vAvglum_needed;
layout(location = 5) out float vBezel_or_Bloom;
layout(location = 6) out float vResSwitch_res_changed;
layout(location = 7) out vec2 vTexCoord_unscaled;
layout(location = 7) out float vResChanged;
layout(location = 8) out vec2 vTexCoord_unscaled;
//layout(location = 9) out vec2 vLods;
#include "includes/functions.include.slang"
@ -30,14 +35,14 @@ void main() {
vTexCoord = TexCoord;
vTexCoord_unscaled = TexCoord;
if (DO_GAME_GEOM_OVERRIDE > 0.5)
vTexCoord = content_geom_override(vTexCoord, GAME_GEOM_ASPECT, get_in_aspect(), GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM);
vTexCoord = content_geom_override_zoom(vTexCoord, GAME_GEOM_ASPECT, get_in_aspect(), GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM);
//Get fuzzy mul and pow factor
vFuzzy_main_pass_stage_1 = apply_fuzzy_main_pass_stage_1();
vReduced_sample_time_is_now = mod(params.FrameCount,AMBI_AVGLUM_DIVIDER);
vAvglum_needed = DO_AMBILIGHT + DO_BEZEL + (DO_DYNZOOM*10.0) + DO_BLOOM + (RESSWITCH_GLITCH_SIZE*10.0) ;
vAvglum_needed = DO_AMBILIGHT + DO_BEZEL + (DO_DYNZOOM*10.0) + DO_BLOOM + (RESSWITCH_GLITCH_SIZE*10.0) + AUTOCROP_MAX ;
vBezel_or_Bloom = DO_BEZEL + DO_BLOOM;
//RESSWITCH shaking:
@ -45,6 +50,12 @@ void main() {
if (abs(params.OutputSize.y - params.avglum_passFeedbackSize.y) / params.OutputSize.y > RESSWITCH_GLITCH_TRESHOLD)
if (params.FrameCount > 30) //needed to avoid shaking at start
vResSwitch_res_changed = 1.0;
//AID Scene chnge detection
vResChanged = float(params.OutputSize.xy - params.avglum_passFeedbackSize.xy != vec2(0.0));
//float lod_max = lodmax(params.OriginalSize.xy);
//vLods.x = lod_max/2.0;
//vLods.y = vLods.x/2.0;
}
#pragma stage fragment
@ -55,12 +66,16 @@ layout(location = 3) in float vReduced_sample_time_is_now;
layout(location = 4) in float vAvglum_needed;
layout(location = 5) in float vBezel_or_Bloom;
layout(location = 6) in float vResSwitch_res_changed;
layout(location = 7) in vec2 vTexCoord_unscaled;
layout(location = 7) in float vResChanged;
layout(location = 8) in vec2 vTexCoord_unscaled;
//layout(location = 9) in vec2 vLods;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D flick_and_noise_pass;
layout(set = 0, binding = 1) uniform sampler2D colortools_and_ntsc_passFeedback;
layout(set = 0, binding = 2) uniform sampler2D colortools_and_ntsc_pass;
layout(set = 0, binding = 3) uniform sampler2D avglum_passFeedback;
/* The following will allow to sample at reduced interval
The scene change detection logic will take advantage of it
So that quick fades will still be treated as scene changes
@ -70,16 +85,16 @@ layout(set = 0, binding = 3) uniform sampler2D avglum_passFeedback;
#include "includes/functions.include.slang"
#define RGB_TO_GRAYSCALE = vec3(0.299, 0.587, 0.114)
#define RGB_TO_GRAYSCALE vec3(0.299, 0.587, 0.114)
float get_avg_lum_from_mip() {
vec3 mip = textureLod(flick_and_noise_pass, vec2(0.5,0.5),20.0).rgb;
vec3 mip = textureLod(colortools_and_ntsc_pass, vec2(0.5,0.5),20.0).rgb;
mip = apply_fuzzy_main_pass_stage_2(mip, vFuzzy_main_pass_stage_1);
//return (mip.r+mip.g+mip.b)/3.0;
return rgb_to_gray(mip);
}
float get_avg_lum_from_mip_nocc() {
vec3 mip = textureLod(flick_and_noise_pass, vec2(0.5,0.5),20.0).rgb;
vec3 mip = textureLod(colortools_and_ntsc_pass, vec2(0.5,0.5),20.0).rgb;
return rgb_to_gray(mip);
}
@ -90,10 +105,10 @@ float get_avg_lum_from_mip_nocc() {
float get_avglum() {
/* avglum alpha has some zones:
* 0.25 -> reduced sampling, used for to aid scene detection
* 0.75 -> smoothed_sampling, used to adapt fullscreen zoom and adaptive black
* 0.50 -> smoothed_sampling, no color corrections.
* RESSWITCH_SAMPLING_POINT (0.9) -> resolution change detection
*
* 0.75 -> smoothed_sampling, used to adapt fullscreen zoom and adaptive black
* AUTOCROP_SAMPLING_POINT (0.825) -> autocrop zoom value pixked up by final pass.
* RESSWITCH_SAMPLING_POINT (0.900) -> resolution change detection
* anything else: continuous sampling
*/
@ -126,6 +141,192 @@ float get_avglum() {
}
bool scene_changed( sampler2D pre_smp, sampler2D cur_smp, float threshold) {
vec3 pre_mip = textureLod( pre_smp, vec2(0.5), 20.0).rgb;
vec3 cur_mip = textureLod( cur_smp, vec2(0.5), 20.0).rgb;
//If resolution changes, we definitely need to change scene.
//This should be optimal for Amiga games.
if (vResChanged == 1.0) return true;
float pre_v = rgb_to_gray(pre_mip);
float cur_v = rgb_to_gray(cur_mip);
float diff_v = cur_v - pre_v;
// fadein: if the previous image is almost black and
// image is fading in, trigger a scene scange
if (pre_v < 2.0/255.0)
if (pre_v < cur_v)
return true;
float diff_v_abs = abs(diff_v);
// if lum is different enough trigger scene change
if (diff_v_abs >= threshold)
return true;
/*
// from blank screen to something else, trigger SC
// This compares different lod mipmaps from the same samplig point
// to guess if the screen is solid or not.
vec3 pre_mip_l20 = pre_mip;
vec3 pre_mip_l1 = textureLod( pre_smp, vec2(0.5), vLods.x).rgb;
vec3 pre_mip_l2 = textureLod( pre_smp, vec2(0.5), vLods.y).rgb;
if ( pre_mip_l1 == pre_mip_l2 && pre_mip_l2 == pre_mip_l20 )
return true;
*/
return false;
}
float quasirandom(float n) {
//n has to be integer for this to work.
// https://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/
return fract(n*0.754877626895905);
//return abs(sin(n));
}
float get_next_autocrop_amount(float max_autocrop_amount) {
//Implementation requires the line_step to be the same for vertical and horizontal sampling.
//This could be a bit inefficient tho.
const float size_max = max(params.OriginalSize.x,params.OriginalSize.y) ;
const float next_line_step = 1/size_max;
//This is needed to avoid sampling edges which may return out out of range values.
const vec2 d = params.OriginalSize.zw * 0.5 * (1+AUTOCROP_MIN*2);
//Reference color, topleft.
vec3 ref = textureLod(colortools_and_ntsc_pass, vec2(d), 0.0).rgb; // FIXME, ref sample needs to be fuzzy too?
float ref_lum = ref.r + ref.g + ref.b ;
//convert zoom back to maximum cropped lines
const float max_crop_lines = ( size_max * (max_autocrop_amount -1) ) / ( 2*max_autocrop_amount) ;
//Sample top,bottom,left,right lines; stop when a line sum contain a different pixel color than the reference
for (float croppedlines = AUTOCROP_MIN ; croppedlines < max_crop_lines ; croppedlines++) {
vec3 smp_sum;
float line_lum;
float fuzzy = AUTOCROP_SAMPLE_SIZE;
//Top
smp_sum = vec3(0.0);
for ( float x = params.FrameCount ; x < params.FrameCount+AUTOCROP_SAMPLES ; x ++ ) {
smp_sum += textureLod(colortools_and_ntsc_pass, vec2( scale_to_range( quasirandom(x), d.x, 1-d.x ) , 0.0 + next_line_step * croppedlines), fuzzy).rgb;
// One should skip already sampled zones, but benchmarks say that for 20 to 50 samples gain is low or even less than 1.0
// Probably because computing ranges is time consuming per se.
//float start = croppedlines*params.OriginalSize.z+d.x;
//float end = 1-(croppedlines*params.OriginalSize.z)-d.x;
//smp_sum += textureLod(colortools_and_ntsc_pass, vec2( scale_to_range( quasirandom(x), start, end) , d.y + next_line_step * croppedlines)).rgb;
}
line_lum = (smp_sum.r + smp_sum.g + smp_sum.b) / (AUTOCROP_SAMPLES);
if ( abs(ref_lum - line_lum) > AUTOCROP_TOLERANCE)
return size_max / (size_max - (croppedlines) * 2) ;
//BOTTOM
smp_sum = vec3(0.0);
for ( float x = params.FrameCount ; x < params.FrameCount+AUTOCROP_SAMPLES ; x ++ ) {
smp_sum += textureLod(colortools_and_ntsc_pass, vec2( scale_to_range( quasirandom(x), d.x, 1-d.x ) , (1.0-eps)-next_line_step*croppedlines), fuzzy).rgb;
// One should skip already sampled zones, but benchmarks say that for 20 to 50 samples gain is low or even less than 1.0
// Probably because computing ranges is time consuming per se.
//float start = croppedlines*params.OriginalSize.z+d.x;
//float end = 1-(croppedlines*params.OriginalSize.z)-d.x;
//smp_sum += textureLod(colortools_and_ntsc_pass, vec2( scale_to_range( quasirandom(x), start, end) , (1.0-d.y)-next_line_step*croppedlines)).rgb;
}
line_lum = (smp_sum.r + smp_sum.g + smp_sum.b) / (AUTOCROP_SAMPLES);
if (abs( ref_lum - line_lum) > AUTOCROP_TOLERANCE) {
return size_max / (size_max - (croppedlines) * 2) ;
}
//LEFT
smp_sum = vec3(0.0);
for ( float y = params.FrameCount; y < params.FrameCount+AUTOCROP_SAMPLES; y ++ ) {
smp_sum += textureLod(colortools_and_ntsc_pass, vec2(0.0+next_line_step*croppedlines, scale_to_range( quasirandom(y), d.y, 1-d.y ) ), fuzzy).rgb;
// One should skip already sampled zones, but benchmarks say that for 20 to 50 samples gain is low or even less than 1.0
// Probably because computing ranges is time consuming per se.
//float start = (croppedlines+1)*params.OriginalSize.w+d.y;
//float end = 1-(croppedlines+1)*params.OriginalSize.w-d.y;
//smp_sum += textureLod(colortools_and_ntsc_pass, vec2(d.x+next_line_step*croppedlines, scale_to_range( quasirandom(y), start, end ) )).rgb;
}
line_lum = (smp_sum.r + smp_sum.g + smp_sum.b) / (AUTOCROP_SAMPLES);
if (abs( ref_lum - line_lum) > AUTOCROP_TOLERANCE)
return size_max / (size_max - (croppedlines) * 2) ;
//RIGHT
smp_sum = vec3(0.0);
for ( float y = params.FrameCount; y < params.FrameCount+AUTOCROP_SAMPLES; y ++ ) {
smp_sum += textureLod(colortools_and_ntsc_pass, vec2((1.0-eps)-next_line_step*croppedlines, scale_to_range( quasirandom(y), d.y, 1-d.y ) ), fuzzy).rgb;
// One should skip already sampled zones, but benchmarks say that for 20 to 50 samples gain is low or even less than 1.0
// Probably because computing ranges is time consuming per se.
//float start = (croppedlines+1)*params.OriginalSize.w+d.y;
//float end = 1-(croppedlines+1)*params.OriginalSize.w-d.y;
//smp_sum += textureLod(colortools_and_ntsc_pass, vec2((1.0-d.x)-next_line_step*croppedlines, scale_to_range( quasirandom(y), d.y, 1-d.y ) )).rgb;
}
line_lum = (smp_sum.r + smp_sum.g + smp_sum.b) / (AUTOCROP_SAMPLES);
if (abs( ref_lum - line_lum) > AUTOCROP_TOLERANCE)
return size_max / (size_max - (croppedlines) * 2);
}
return max_autocrop_amount;
}
float get_autocrop() {
// This return a value that will be used in the final pass to zoom the picture.
float previous_autocrop_amount = AUTOCROP_MAX+1;
if (params.FrameCount < 30.0) {
previous_autocrop_amount = AUTOCROP_MAX+1; //Good start point.
} else {
previous_autocrop_amount = texture(avglum_passFeedback,AUTOCROP_SAMPLING_POINT).a;
}
//next_autocrop_amount = get_next_autocrop_amount(AUTOCROP_MAX);
// Reset crop if scene has changed?
float next_autocrop_amount;
if (scene_changed( colortools_and_ntsc_passFeedback, colortools_and_ntsc_pass, AUTOCROP_STEADINESS) ) {
//When a scene changes, we must release the maximum crop amount and find a new one.
//For entrance effect:
//return AUTOCROP_MAX+1; //"entrance effect?
//No frills way:
next_autocrop_amount = get_next_autocrop_amount(AUTOCROP_MAX+1);
return next_autocrop_amount;
//Mix can't work in the long run if we don't track scene changing over multiple frames.
//next_autocrop_amount = get_next_autocrop_amount(AUTOCROP_MAX+1);
//previous_autocrop_amount = texture(avglum_passFeedback,AUTOCROP_SAMPLING_POINT).a;
//float r = mix( previous_autocrop_amount , next_autocrop_amount, 0.75);
//return r;
return next_autocrop_amount;
} else {
previous_autocrop_amount = texture(avglum_passFeedback,AUTOCROP_SAMPLING_POINT).a;
next_autocrop_amount = get_next_autocrop_amount(previous_autocrop_amount);
float r = mix( previous_autocrop_amount , next_autocrop_amount, AUTOCROP_TRANSITION_SPEED);
return clamp(r, 1.0, AUTOCROP_MAX+1); // needed to sanitize output when Feedback is unavailable (eg: just switched autocrop on)
}
}
void main() {
/*Grab a mipmap from the flick_and_noise_pass.
Calculate the average luminance from the smallest mipmap and put into the alpha channel
@ -139,6 +340,8 @@ void main() {
vec4 pixel_out;
//We also reserve a sampling point in alpha channel to store if the resolution has changed.
//The value stored will be used by the first pass as an argument to sin() to shake the image.
if (is_first_inside_rect(vTexCoord_unscaled, vec4(RESSWITCH_SAMPLING_POINT-0.01 , RESSWITCH_SAMPLING_POINT+0.01) )) {
@ -152,6 +355,11 @@ void main() {
#endif
}
} else if (is_first_inside_rect(vTexCoord_unscaled, vec4(AUTOCROP_SAMPLING_POINT-0.01, AUTOCROP_SAMPLING_POINT+0.01) )) {
if (AUTOCROP_MAX > 0.001)
pixel_out.a = get_autocrop();
} else {
pixel_out.a = get_avglum();
}
@ -161,7 +369,7 @@ void main() {
//Create a small mipmap to be used to light the bezel corners
//and by the bloom pass to identify bright areas.
if (vBezel_or_Bloom > 0.0)
pixel_out.rgb = textureLod(flick_and_noise_pass, vTexCoord, mip_lod).rgb;
pixel_out.rgb = textureLod(colortools_and_ntsc_pass, vTexCoord, mip_lod).rgb;
FragColor = pixel_out;

View File

@ -61,7 +61,7 @@ layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 1) uniform sampler2D Source;
//layout(set = 0, binding = 2) uniform sampler2D avglum_pass;
layout(set = 0, binding = 3) uniform sampler2D flick_and_noise_pass;
layout(set = 0, binding = 3) uniform sampler2D colortools_and_ntsc_pass;
layout(set = 0, binding = 4) uniform sampler2D bloom_pass_finalFeedback;
@ -74,14 +74,14 @@ layout(set = 0, binding = 4) uniform sampler2D bloom_pass_finalFeedback;
#define BLOOM_PUPIL_EXPOSURE_CURVE_SHOULDER 0.33
//How big is the zone in which the luminance will be computed for puple temporal adaption (range 2..20)
#define BLOOM_PUPIL_LUM_ZONE_W 7
#define BLOOM_PUPIL_LUM_ZONE_W 6
//The speed of the pupil adaption
#define BLOOM_PUPIL_ADAPTION_SPEED 0.2
float get_avg_lum_from_mip(sampler2D tex, vec2 co, float lod) {
vec3 mip = textureLod(flick_and_noise_pass, co, lod).rgb;
vec3 mip = textureLod(colortools_and_ntsc_pass, co, lod).rgb;
mip = apply_fuzzy_main_pass_stage_2(mip, vFuzzy_main_pass_stage_1);
//return (mip.r+mip.g+mip.b)/3.0;
float luminance_from_feedback = rgb_to_gray(mip);
@ -140,9 +140,9 @@ void main() {
//Use mipmap available in avglum_pass to identify bright areas.
//vec3 avglum = texture(avglum_pass,vCo_avglum).rgb;
#define ZONE_LUMINANCE_LOD 5.0
#define ZONE_LUMINANCE_LOD 2.0 //Higher values lead to ugly glitch when panning or banding in static content.
vec3 avglum = textureLod(flick_and_noise_pass, vTexCoord, ZONE_LUMINANCE_LOD).rgb;
vec3 avglum = textureLod(colortools_and_ntsc_pass, vTexCoord, ZONE_LUMINANCE_LOD).rgb;
float b_brightness = max(avglum.b,max(avglum.r,avglum.g));
b_brightness *= 1-BLOOM_OVER_WHITE;
over_white_correction =1- b_brightness;
@ -153,7 +153,7 @@ void main() {
// (Branching with (if BLOOM_EYE_ADPT_SRT == 0.0) does not gain anything.)
// Modulate exposure over time too.
//Smooth luminance with specified lod in this alpha channel
float zone_luminance = get_avg_lum_from_mip(flick_and_noise_pass, vTexCoord, BLOOM_PUPIL_LUM_ZONE_W);
float zone_luminance = get_avg_lum_from_mip(colortools_and_ntsc_pass, vTexCoord, BLOOM_PUPIL_LUM_ZONE_W);
float smoothed_avglum = zone_luminance * BLOOM_EYE_ADPT_SRT;
bloom_mix_adapted = max(0.0, BLOOM_MIX - smoothed_avglum);

View File

@ -11,7 +11,7 @@
#define CYELLOW vec3(1.0,1.0,0.0)
#define CCUSTOM vec3(0.3,0.5,0.1)
#define DEBUG_COLOR vec3(1,0,0)
#define DEBUG_COLOR vec3(1,1,1)
#define DEBUG_BLINK_TIME 100
#define DEBUG_GRADIENT_STEPS 64
@ -77,6 +77,12 @@ void main() {
gl_Position = global.MVP * Position;
vTexCoord = TexCoord * 1.0001;
if (DO_GAME_GEOM_OVERRIDE > 0.5) {
vec2 shift = vec2(GAME_GEOM_HSHIFT,GAME_GEOM_VSHIFT);
vTexCoord = content_geom_override_shift(vTexCoord, GAME_GEOM_ASPECT, get_in_aspect(), shift.y, shift.x, GAME_GEOM_ZOOM);
}
if (DO_NTSC_ARTIFACTS > 0.0) {
vNTSC_FILTER_FC = NTSC_FILTER_FC * 0.1;
vSubcarrierFrequency_mul_size_mul_TAU = NTSC_FILTER_SCF * 0.1 * params.SourceSize.x * TAU;
@ -141,7 +147,7 @@ vec4 ntscdec(vec2 uv, vec3 RGB_ori) {
// Sample composite signal and decode to YIQ
vec2 YIQ_processed = vec2(0.0);
vec2 YIQ_processed_shifted = vec2(0.0);
//by doing another ntsc filtering with this histed phase, we're able to better identify
//by doing another ntsc filtering with this shifted phase, we're able to better identify
//artifacts that will drive the blur modulation.
float phase_shift_for_blur;
@ -423,6 +429,11 @@ vec3 persistence(vec3 feedback, vec3 pixel_now, float start_decay, float late_pe
void main() {
vec2 co = vTexCoord;
if (AUTOCROP_MAX > 0.0)
co = clamp(co, params.OriginalSize.zw * AUTOCROP_MIN,
1-params.OriginalSize.zw * AUTOCROP_MIN );
#ifndef D3D_WORKAROUND
float shake = texture(avglum_passFeedback, RESSWITCH_SAMPLING_POINT).a;
//co.y += sin(shake * 2 * pi) * RESSWITCH_GLITCH_SIZE;

View File

@ -175,6 +175,11 @@
#ifndef IN_GLOW_SPREAD
#define IN_GLOW_SPREAD global.IN_GLOW_SPREAD
#endif
#ifndef IN_GLOW_SPREAD_SHARPNESS
#define IN_GLOW_SPREAD_SHARPNESS global.IN_GLOW_SPREAD_SHARPNESS
#endif
#ifndef IN_GLOW_W
@ -349,6 +354,10 @@
#define BEZEL_DIFFUSION_STR global.BEZEL_DIFFUSION_STR
#endif
#ifndef BEZEL_LIGHT_NO_FADEOUT
#define BEZEL_LIGHT_NO_FADEOUT global.BEZEL_LIGHT_NO_FADEOUT
#endif
#ifndef BEZEL_CORNER_DARK
#define BEZEL_CORNER_DARK global.BEZEL_CORNER_DARK
#endif
@ -573,6 +582,32 @@
#define TILT_BEZEL_K global.TILT_BEZEL_K
#endif
#ifndef AUTOCROP_MAX
#define AUTOCROP_MAX global.AUTOCROP_MAX
#endif
#ifndef AUTOCROP_MIN
#define AUTOCROP_MIN global.AUTOCROP_MIN
#endif
#ifndef AUTOCROP_SAMPLES
#define AUTOCROP_SAMPLES global.AUTOCROP_SAMPLES
#endif
#ifndef AUTOCROP_SAMPLE_SIZE
#define AUTOCROP_SAMPLE_SIZE global.AUTOCROP_SAMPLE_SIZE
#endif
#ifndef AUTOCROP_TRANSITION_SPEED
#define AUTOCROP_TRANSITION_SPEED global.AUTOCROP_TRANSITION_SPEED
#endif
#ifndef AUTOCROP_STEADINESS
#define AUTOCROP_STEADINESS global.AUTOCROP_STEADINESS
#endif
#ifndef TATE
#define TATE global.TATE
#endif
@ -665,7 +700,9 @@
#define PIXELGRID_DOUBLESCAN global.PIXELGRID_DOUBLESCAN
#endif
#ifndef PIXELGRID_INFLATION
#define PIXELGRID_INFLATION global.PIXELGRID_INFLATION
#endif
#ifndef PIXELGRID_MIN_H
#define PIXELGRID_MIN_H global.PIXELGRID_MIN_H

View File

@ -175,6 +175,13 @@ layout(std140, set = 0, binding = 0) uniform UBO {
float TILT_BEZEL_K;
float TILT_FOV;
float AUTOCROP_MAX;
float AUTOCROP_MIN;
float AUTOCROP_SAMPLES;
float AUTOCROP_SAMPLE_SIZE;
float AUTOCROP_TRANSITION_SPEED;
float AUTOCROP_STEADINESS;
float DO_BACKDROP;
float BACKDROP_OFFX;
float BACKDROP_OFFY;
@ -210,9 +217,10 @@ layout(std140, set = 0, binding = 0) uniform UBO {
float PIXELGRID_MAX_H;
float PIXELGRID_MAX_W;
float PIXELGRID_SIZE_W;
float PIXELGRID_INFLATION;
float PLACEHOLDER1; //2fps lost if deleted (!)
float PLACEHOLDER2; //2fps lost if deleted (!)
float BEZEL_LIGHT_NO_FADEOUT;
float IN_GLOW_SPREAD_SHARPNESS;
float PIXELGRID_MUL_X;
@ -280,9 +288,9 @@ layout(std140, set = 0, binding = 0) uniform UBO {
} global;
#pragma parameter LABEL0000 "Read the documentation in docs-ng.md text file" 0.0 0.0 0.0 1.0
#pragma parameter LABEL0001 "==================================================" 0.0 0.0 0.0 1.0
#pragma parameter LABEL0002 " " 0.0 0.0 0.0 1.0
#pragma parameter LABEL0000 "Read the documentation in docs-ng.md text file" 0.0 0.0 0.0 0.0
#pragma parameter LABEL0001 "==================================================" 0.0 0.0 0.0 0.0
#pragma parameter LABEL0002 " " 0.0 0.0 0.0 0.0
// Color correction
#pragma parameter DO_CCORRECTION "★ Color corrections enable? (co) ==>" 0.0 0.0 1.0 1.0
@ -300,19 +308,19 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter COLOR_MONO_HUE_BIAS " . Hue bright-dark bias" 0.0 -2.0 2.0 0.01
#pragma parameter SATURATION " Saturation in (1.0=off)" 1.0 0.0 2.0 0.01
#pragma parameter VIBRANCE " Vibrance in (0.0=off)" 0.0 0.0 5.0 0.1
#pragma parameter LABEL0003 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0003 " " 0.0 0.0 0.0 0.0
// FXAA
// Apply an antialiasing filter via FXAA from Nvidia.
#pragma parameter DO_FXAA "★ FXAA enable? (*f) ==>" 0.0 0.0 1.0 1.0
#pragma parameter LABEL0004 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0004 " " 0.0 0.0 0.0 0.0
// RF Noise
#pragma parameter DO_RF_NOISE "★ RF Noise enable? (rf) ==>" 0.0 0.0 1.0 1.0
#pragma parameter RF_NOISE_STRENGTH " Strength" 0.05 0.0 1.0 0.005
#pragma parameter LABEL0005 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0005 " " 0.0 0.0 0.0 0.0
// Dedithering
#pragma parameter DO_DEDITHER "★ Dedither enable? (not with NTSC artifacts) ==>" 0.0 0.0 1.0 1.0
@ -320,7 +328,7 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter DEDITHER_STRENGTH " Basic search strength" 0.8 0.0 1.0 0.1
#pragma parameter DEDITHER_STRENGTH2 " Extensive search strength" 0.0 0.0 1.0 0.1
#pragma parameter LABEL0006 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0006 " " 0.0 0.0 0.0 0.0
// NTSC color artifacting
#pragma parameter DO_NTSC_ARTIFACTS "★ CVBS: NTSC color artifacts enable? (nt) ==>" 0.0 0.0 1.0 1.0
@ -336,7 +344,7 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter NTSC_ARTF_NOBLEED " . 2* Under treshold: Cancel Bandwidth limited chroma" 0.0 0.0 1.0 0.01
#pragma parameter NTSC_ARTF_ZAP " . 3* Under treshold: Cancel artifacts" 0.0 0.0 1.0 0.01
#pragma parameter LABEL0007 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0007 " " 0.0 0.0 0.0 0.0
// YIQ/YUV bandwidth limited chroma bleeding.
@ -345,14 +353,14 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter SAT_BLEED_STRENGTH " Strength" 1.0 0.0 5.0 0.01
#pragma parameter SAT_BLEED_SIZE " Size (capped to 5.0 in d3d)" 5.0 1.0 20.0 1.0
#pragma parameter SAT_BLEED_FALLOFF " Falloff" 1.7 1.0 2.0 0.01
#pragma parameter LABEL0008 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0008 " " 0.0 0.0 0.0 0.0
//Phosphor persistence
#pragma parameter DO_PPERSISTENCE "★ Persistence of phosphors enable? (ppe) ==>" 0.0 0.0 1.0 1.0
#pragma parameter PPERSISTENCE_START " Early decay" 0.9 0.0 1.0 0.05
#pragma parameter PPERSISTENCE_END " Late Persistence" 0.5 0.0 2.0 0.05
#pragma parameter LABEL0009 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0009 " " 0.0 0.0 0.0 0.0
//Deconvergence
#pragma parameter DO_SHIFT_RGB "★ Deconvergence enable? (de) ==>" 0.0 0.0 1.0 1.0
@ -360,26 +368,27 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter SHIFT_R " Red offset" -40.0 -210.0 189.0 1
#pragma parameter SHIFT_G " Green offset" 2.0 -210.0 189.0 1
#pragma parameter SHIFT_B " Blue offset" 40.0 -210.0 189.0 1
#pragma parameter LABEL0010 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0010 " " 0.0 0.0 0.0 0.0
// Input Blur / light glowing
#pragma parameter DO_IN_GLOW "★ Glow/Blur enable? (gl) ==>" 0.0 0.0 1.0 1.0
#pragma parameter IN_GLOW_BIAS " Glow to blur bias" 1.0 0.0 1.0 0.05
#pragma parameter IN_GLOW_SPREAD " Glow spread amount" 0.6 0.0 4.0 0.05
#pragma parameter IN_GLOW_BIAS " Glow to blur bias" 1.0 0.0 1.0 0.1
#pragma parameter IN_GLOW_SPREAD " Glow light gain" 0.6 0.0 4.0 0.05
#pragma parameter IN_GLOW_SPREAD_SHARPNESS " Glow light sharpness" 2.0 0.01 2.0 0.01
#pragma parameter IN_GLOW_W " Sharp X (neg=use BOX unsharp)" 2.5 -2.0 7.0 0.05
#pragma parameter IN_GLOW_H " Sharp Y (neg=use BOX unsharp)" 2.5 -2.0 7.0 0.05
#pragma parameter LABEL0011 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0011 " " 0.0 0.0 0.0 0.0
#pragma parameter TATE "★ Tate mode (0:disabled 1:auto 2:forced)" 1.0 0.0 2.0 1.0
#pragma parameter LABEL0012 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0012 " " 0.0 0.0 0.0 0.0
#pragma parameter RESSWITCH_GLITCH_SIZE "★ Glitch if vertical resolution changes" 0.1 0.0 0.5 0.05
#pragma parameter LABEL0013 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0013 " " 0.0 0.0 0.0 0.0
#pragma parameter LABEL_INTERLACE "★ Hi-resolution scanlines handling" 0.0 0.0 0.0 0.0
#pragma parameter LABEL_INTERLACE "★ Hi-resolution scanlines handling" 1.0 1.0 1.0 0.0
#pragma parameter MIN_LINES_INTERLACED " . Consider Hi-Resolution above # lines (0=never):" 380.0 0.0 1024 1.0
#pragma parameter PIXELGRID_INTR_DISABLE_Y " . Hi-Res scanlines type (read docs):" -1.0 -2.0 2.0 1.0
#pragma parameter LABEL0036 " (-2: Faker-Interlaced, -1: Fake-Interlaced)" 0.0 0.0 0.0 0.0
@ -387,21 +396,23 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter PIXELGRID_INTR_FLICK_MODE " . Scanlines flicker (0=off,1=on,2=if Hi-Res)" 2.0 0.0 2.0 1.0
#pragma parameter PIXELGRID_INTR_FLICK_POWR " . Flicker power" 0.25 0.0 8.0 0.01
#pragma parameter LABEL0014 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0014 " " 0.0 0.0 0.0 0.0
// pixel Grid
#pragma parameter DO_PIXELGRID "★ Low level Phosphor grid enable? (ph) ==>" 0.0 0.0 1.0 1.0
#pragma parameter PIXELGRID_OVERMASK " Overmask (1.0 = neutral)" 1.0 0.0 2.0 0.02
#pragma parameter LABEL0015 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0015 " " 0.0 0.0 0.0 0.0
#pragma parameter DO_PIXELGRID_H " ★ Scanlines (0 to disable)" 1.0 0.0 1.25 0.05
#pragma parameter PIXELGRID_DOUBLESCAN " . Double-scan low input resolutions" 0.0 0.0 1.0 1.0
#pragma parameter PIXELGRID_COREY_FAKE_SCAN " . Fake integer scanlines (-1=auto)" -1.0 -1.0 1.0 1.0
#pragma parameter PIXELGRID_MIN_H " . Phosphors height Min" 0.2 0.00 1.0 0.05
#pragma parameter PIXELGRID_MAX_H " . Phosphors height Max" 0.6 0.0 1.5 0.05
#pragma parameter PIXELGRID_MAX_H " . Phosphors height Max" 0.6 0.05 1.0 0.05
#pragma parameter PIXELGRID_INFLATION " . Inflation Strength" 0.75 0.0 2.0 0.01
#pragma parameter PIXELGRID_GAMMA_H " . Phosphors height min->max gamma:" 4.2 1.0 8.00 0.1
#pragma parameter PIXELGRID_NO_INTERBLEED_H " . Inter line extra steepness" 0.0 0.0 10.0 0.1
#pragma parameter PIXELGRID_NO_INTERBLEED_H " . Inter line extra steepness (1.0 to disable)" 1.0 1.0 11.0 0.1
#pragma parameter PIXELGRID_H_ANTIMOIRE " . Anti-moire sweet spot (disables Y deconvergence)" 0.0 0.0 1.0 0.01
#pragma parameter PIXELGRID_OFFSET_CORE " . Slotmask(fake) offset (not with anti-moire) " 0.0 0.0 1.0 0.01
#pragma parameter PIXELGRID_DECON_R_H " . Deconvergence Y: R phosphor" 0.0 -1.6 1.6 0.1
@ -409,7 +420,7 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter PIXELGRID_DECON_B_H " . Deconvergence Y: B phosphor" 0.0 -1.6 1.6 0.1
#pragma parameter PIXELGRID_H_DEDOT " . Dedot mask between scanlines (use only if needed!)" 0.0 0.0 2.0 0.1
#pragma parameter LABEL0016 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0016 " " 0.0 0.0 0.0 0.0
#pragma parameter DO_PIXELGRID_W " ★ Horizontal mask (0 to disable)" 1.0 0.0 1.0 0.05
@ -426,7 +437,7 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter PIXELGRID_GAMMA_W " . Phosphors width min->max gamma:" 4.2 1.0 8.00 0.1
#pragma parameter PIXELGRID_BASAL_GRID " . Black level of the unexcided phosphor grid" 0.0 0.0 10.0 0.01
#pragma parameter LABEL0017 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0017 " " 0.0 0.0 0.0 0.0
#pragma parameter PIXELGRID_Y_MASK " ★ Vertical cell Mask (aperturegrille/slotmask)" 0.5 0.0 1.0 0.05
#pragma parameter PIXELGRID_Y_MASK_COORDS " . Resolution: (core or screen)" 1.0 0.0 1.0 1.0
@ -437,14 +448,14 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter PIXELGRID_Y_MASK_ON_WHITE " . Fadeout under light" 0.5 0.0 2.0 0.01
#pragma parameter PIXELGRID_Y_SPARK " . Sparkling look punch" 0.0 0.0 8.0 0.1
#pragma parameter LABEL0018 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0018 " " 0.0 0.0 0.0 0.0
#pragma parameter PIXELGRID_DO_SHADOWMASK " ★ Shadowmask " 0.0 0.0 1.0 1.0
#pragma parameter PIXELGRID_SHADOWMASK_SHIFT " . X staggering " 1.0 0.5 4.0 0.5
#pragma parameter PIXELGRID_SHADOWMASK_H " . Phosphor height " 1.0 1.0 10.0 1.0
#pragma parameter LABEL0019 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0019 " " 0.0 0.0 0.0 0.0
// Dot matrix emulation
@ -458,7 +469,7 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter DOT_M_SHADOW_STR " Shadow strength (disables deconvergence)" 0.0 0.0 1.0 0.01
#pragma parameter DOT_M_SHADOW_OFF " . Shadow offset" 0.0 -1.0 1.0 0.01
#pragma parameter DOT_M_MULTIPLY " Multiply factor (debug)" 1.0 1.0 50.0 1.0
#pragma parameter LABEL0020 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0020 " " 0.0 0.0 0.0 0.0
@ -471,7 +482,7 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter HALO_GAMMA " Gamma in, the higher, the less the halo on dark colors" 2.0 1.0 10.0 0.05
#pragma parameter HALO_GAMMA_OUT " Gamma out" 1.0 0.25 4.0 0.1
#pragma parameter HALO_VS_SCAN " Light up scanline gaps and dot grid gaps too" 0.0 0.0 1.0 0.01
#pragma parameter LABEL0021 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0021 " " 0.0 0.0 0.0 0.0
@ -487,39 +498,43 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter BLOOM_EYE_INERTIA " Modulate: Time before eye adaption starts" 1500 10.0 10000 50.0
#pragma parameter BLOOM_OVER_WHITE " Modulate: Strength on bright areas (0 = aura)" 0.5 0.0 1.0 0.05
#pragma parameter BLOOM_BYPASS " Bypass/Solo (1=Unmodulated, 2=Modulated)" 0.0 0.0 2.0 1.0
#pragma parameter LABEL0022 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0022 " " 0.0 0.0 0.0 0.0
//Curvature parameters:
#pragma parameter DO_CURVATURE "★ Curvature/Border enable? (cu) ==>" 0.0 0.0 1.0 1.0
#pragma parameter DO_CURVATURE "★ Curvature enable? (cu) ==>" 0.0 0.0 1.0 1.0
#pragma parameter GEOM_WARP_X " Warp X" 0.28 0.0 6.0 0.01
#pragma parameter GEOM_WARP_Y " Warp Y" 0.32 0.0 6.0 0.01
#pragma parameter GEOM_CORNER_SIZE " Corner radius" 0.005 0.005 0.1 0.001
#pragma parameter GEOM_CORNER_SMOOTH " Corner sharpness" 350.0 15.0 1000.0 1.0
#pragma parameter LABEL0023 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0054 " " 0.0 0.0 0.0 0.0
#pragma parameter LABEL_0055 "★ Corners/Edges" 1.0 1.0 1.0 0.0
#pragma parameter GEOM_CORNER_SIZE " Corners radius" 0.005 0.002 0.1 0.001
#pragma parameter GEOM_CORNER_SMOOTH " Edges sharpness" 200.0 50.0 1000.0 10.0
#pragma parameter LABEL0023 " " 0.0 0.0 0.0 0.0
//Bezel related
#pragma parameter DO_BEZEL "★ Bezel enable? (be) ==>" 0.0 0.0 1.0 1.0
#pragma parameter BEZEL_USE_STRAIGHT " Straight" 0.0 0.0 1.0 1.0
#pragma parameter BEZEL_INNER_ZOOM " Inner zoom (ignored if integer scaled)" -0.18 -1.5 0.5 0.001
#pragma parameter BEZEL_FRAME_ZOOM " Frame zoom" 0.0 -1.5 0.5 0.001
#pragma parameter BEZEL_R " Color: Red" -0.3 -1.0 1.0 0.005
#pragma parameter BEZEL_G " Color: Green" -0.3 -1.0 1.0 0.005
#pragma parameter BEZEL_B " Color: Blue" -0.3 -1.0 1.0 0.005
#pragma parameter BEZEL_R " Color: Red" -0.35 -1.0 1.0 0.005
#pragma parameter BEZEL_G " Color: Green" -0.35 -1.0 1.0 0.005
#pragma parameter BEZEL_B " Color: Blue" -0.35 -1.0 1.0 0.005
#pragma parameter BEZEL_CON " Contrast" 1.3 0.0 10.0 0.01
#pragma parameter BEZEL_RFL_ZOOM " Reflections zoom" 0.0 -1.5 0.5 0.005
#pragma parameter BEZEL_REFL_STRENGTH " Reflections strength" 0.65 0.0 2.0 0.01
#pragma parameter BEZEL_RFL_BLR_SHD " Reflections sharpness" -0.2 -0.7 0.8 0.01
#pragma parameter BEZEL_RFL_ZOOM " Reflections zoom" 0.05 -1.5 0.5 0.01
#pragma parameter BEZEL_REFL_STRENGTH " Reflections strength" 0.5 0.0 2.0 0.01
#pragma parameter BEZEL_RFL_BLR_SHD " Reflections sharpness" -0.2 -1.5 0.8 0.01
#pragma parameter BEZEL_ROUGHNESS " Reflections roughness" 1.0 0.0 5.0 0.1
#pragma parameter BEZEL_DIFFUSION_STR " Diffusion strength" 0.0 0.0 1.0 0.01
#pragma parameter BEZEL_DIFFUSION_STR " Diffusion strength" 0.2 0.0 1.0 0.01
#pragma parameter BEZEL_SPCL_STRENGTH " Specularity strength" 0.5 0.0 3.0 0.05
#pragma parameter BEZEL_CORNER_DARK " Darken corners" 0.8 0.0 1.0 0.05
#pragma parameter BEZEL_LIGHT_NO_FADEOUT " Light fadeout distance" 0.5 0.0 1.0 0.01
#pragma parameter BEZEL_CORNER_DARK " Darken corners" 0.8 0.0 2.0 0.05
#pragma parameter LABEL0024 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0024 " " 0.0 0.0 0.0 0.0
@ -533,14 +548,14 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter BG_IMAGE_ROTATION " Rotate/flip (0=auto,1/-1=no change,<0 for rotated games)" 0.0 -8.0 8.0 1.0
#pragma parameter BG_IMAGE_NIGHTIFY " Nightify image" 0.0 0.0 1.0 0.1
#pragma parameter BG_IMAGE_WRAP_MODE " Wrap mode: default, clamp to border, edge, repeat" 0.0 0.0 3.0 1.0
#pragma parameter LABEL0025 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0025 " " 0.0 0.0 0.0 0.0
//Backdrop image
#pragma parameter DO_BACKDROP "★ Backdrop mirrored image enable? ==>" 0.0 0.0 1.0 1.0
#pragma parameter BACKDROP_OFFX " Shift backdrop over X axis" 0.0 -1.0 1.0 0.0005
#pragma parameter BACKDROP_OFFY " Shift backdrop over X axis" 0.0 -1.0 1.0 0.0005
#pragma parameter BACKDROP_ZOOM " Zoom backdrop" 1.0 -1.0 3.0 0.0005
#pragma parameter LABEL0026 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0026 " " 0.0 0.0 0.0 0.0
//Back leds
@ -553,14 +568,14 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter AMBI_INT_OFFSET " Internalness (Led position)" 0.07 -1.0 1.0 0.01
#pragma parameter AMBI_SMP_INT_OFFSET " Internalness (Sampling point) " 0.07 0.07 1.0 0.01
#pragma parameter AMBI_STRETCH " Widen lights (horizontal games)" 0.0 0.0 1.0 0.01
#pragma parameter AMBI_STRETCH_VERTICAL " Widen lights (vertical games)" 0.5 0.0 1.0 0.01
#pragma parameter AMBI_STRETCH_VERTICAL " Widen lights (vertical games)" 0.35 0.0 1.0 0.01
#pragma parameter AMBI_GAMMA " Output Gamma" 1.3 0.1 8.0 0.1
#pragma parameter AMBI_OVER_BEZEL " Bezel Colorization intensity" 0.2 0.0 5.0 0.05
#pragma parameter AMBI_OVER_BEZEL_SIZE " Bezel Colorization size" 0.15 0.001 0.5 0.001 ///hacky, but keep min to 0.001 plz.
#pragma parameter AMBI_BG_IMAGE_BLEND_MODE " Back/Foreground image alpha blend (0=mix, 1=add)" 0.0 0.0 1.0 1.0
#pragma parameter AMBI_ADD_ON_BLACK " Foggy (power on dark colors, add mode only) " 1.0 0.0 1.0 0.05
#pragma parameter AMBI_BG_IMAGE_FORCE " Always colorize Back/Foreground image (add mode only) " 0.0 0.0 1.0 0.1
#pragma parameter LABEL0027 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0027 " " 0.0 0.0 0.0 0.0
@ -572,8 +587,8 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter DO_SPOT "★ Spot enable? (sp) ==>" 0.0 0.0 1.0 1.0
#pragma parameter S_POSITION_X " X Position" -0.5 -2.0 2.0 0.05
#pragma parameter S_POSITION_Y " Y Position" 0.5 -2.0 2.0 0.05
#pragma parameter S_SIZE " Size" 0.4 0.0 3.0 0.01
#pragma parameter S_POWER " Power" 0.1 0.01 1.0 0.01
#pragma parameter S_SIZE " Size" 0.36 0.0 3.0 0.01
#pragma parameter S_POWER " Power" 0.11 0.01 1.0 0.01
#pragma parameter LABEL0028 " " 0.0 0.0 1.0 1.0
@ -588,10 +603,10 @@ layout(std140, set = 0, binding = 0) uniform UBO {
//Aspect Ratio
#pragma parameter label_ar "★ Aspect Ratio (as) " 0.0 0.0 0.0 1.0
#pragma parameter label_ar "★ Aspect Ratio (as) " 1.0 1.0 1.0 0.0
#pragma parameter ASPECT_X " Aspect Ratio Numerator (<=0 for a preset)" 0.0 -6.0 256. 1.0
#pragma parameter ASPECT_Y " Aspect Ratio Denominator" 3.0 0.0 256. 1.0
#pragma parameter LABEL0042 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0042 " " 0.0 0.0 0.0 0.0
#pragma parameter LABEL0043 " Presets reference list:" 0.0 0.0 0.0 1.0
#pragma parameter LABEL0044 " (0 = MAME 1.33)" 0.0 0.0 0.0 1.0
#pragma parameter LABEL0045 " (-1 = NTSC 1.5)" 0.0 0.0 0.0 1.0
@ -600,39 +615,47 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter LABEL0048 " (-4 = Megadrive 10/7)" 0.0 0.0 0.0 1.0
#pragma parameter LABEL0049 " (-5 = Uncorrected)" 0.0 0.0 0.0 1.0
#pragma parameter LABEL0050 " (-6 = MAME rotated/TATE 0.75)" 0.0 0.0 0.0 1.0
#pragma parameter LABEL0051 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0051 " " 0.0 0.0 0.0 0.0
//Modulate the image zooming depending on the image luminosity.
#pragma parameter DO_DYNZOOM "★ Luminosity tied zoom (!!OBSTRUCTS integer scale!!) ==>" 0.015 0.0 1.0 0.005
#pragma parameter LABEL0032 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0032 " " 0.0 0.0 0.0 0.0
//Autocrop
#pragma parameter AUTOCROP_MAX "★ Autocrop: maximum amount (!!OBSTRUCTS integer scale!!) ==>" 0.0 0.0 0.5 0.01
#pragma parameter AUTOCROP_MIN " Number of mandatory lines to crop" 1.0 0.0 10.0 1.0
#pragma parameter AUTOCROP_SAMPLES " Samples per frame (faster response, higher gpu use)" 20.0 0.0 300.0 1.0
#pragma parameter AUTOCROP_SAMPLE_SIZE " Sample size (big speedup, less accurate)" 2.0 0.0 5.0 1.0
#pragma parameter AUTOCROP_STEADINESS " Scene change treshold (0 = continuous cropping)" 0.2 0.0 0.5 0.01
#pragma parameter AUTOCROP_TRANSITION_SPEED " Transition speed" 0.1 0.05 1.0 0.05
#pragma parameter LABEL0033 " " 0.0 0.0 0.0 0.0
//Content geomerty overrides
#pragma parameter DO_GAME_GEOM_OVERRIDE "★ Override content geometry enable? (ov)==>" 0.0 0.0 1.0 1.0
#pragma parameter GAME_GEOM_INT_SCALE " Integer scale (disables inner zoom) 2=No keep aspect" 0.0 0.0 2.0 1.0
#pragma parameter GAME_GEOM_INT_SCALE_MAX " . Maximum integer scale" 10.0 1.0 100.0 1.0
#pragma parameter GAME_GEOM_INT_SCALE_OVR " . Permit integer overscale by" 1.04 1.00 1.1 0.01
#pragma parameter LABEL0041 " !! Switch off luminosity tied zoom to use integer scaling" 1.0 1.0 1.0 1.0
#pragma parameter LABEL0052 " !! The following will override integer scale" 1.0 1.0 1.0 1.0
#pragma parameter GAME_GEOM_ASPECT " Aspect (0 = unchanged)" 0.0 0.0 3.0 0.005
#pragma parameter GAME_GEOM_VSHIFT " Vertical position" 0.0 -10.0 10.0 0.01
#pragma parameter GAME_GEOM_HSHIFT " Horizontal position" 0.0 -10.0 10.0 0.01
#pragma parameter GAME_GEOM_ZOOM " Zoom" 1.0 0.0 2.0 0.01
#pragma parameter GAME_GEOM_OFF_FIX " Sharp hack through offset (0.0=disable)" 0.0 0.0 100.0 1
#pragma parameter LABEL0033 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0034 " " 0.0 0.0 0.0 0.0
//Tilt
#pragma parameter DO_TILT "★ Tilt enable? (ti) ==>" 0.0 0.0 1.0 1.0
#pragma parameter TILT_X " Tilt along X axis" 0.0 -0.5 0.5 0.01
#pragma parameter TILT_FOV " Fov" 0.7 0.1 1.5 0.05
#pragma parameter TILT_BEZEL_K " Bezel multiplier" 1.0 0.0 1.5 0.01
#pragma parameter LABEL0034 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0035 " " 0.0 0.0 0.0 0.0
//Delta render
#pragma parameter LABEL0053 " !THE FOLLOWING FEATURES ARE STATIC, SEE docs-ng.md TO ENABLE" 0.0 0.0 0.0 1.0
#pragma parameter LABEL0053 " !THE FOLLOWING FEATURES ARE STATIC, SEE docs-ng.md TO ENABLE" 1.0 1.0 1.0 1.0
#pragma parameter DELTA_RENDER_FORCE_REFRESH "★ Delta render force refresh interval ? ==>" 4.0 1.0 3600.0 1.0
#pragma parameter DELTA_RENDER_CHECK_AREA " Delta render area size" 1.0 0.0 10.0 1.0
#pragma parameter LABEL0035 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0041 " " 0.0 0.0 1.0 1.0
#pragma parameter SERVICE1 "Don't use me, for debug purposes only" 0.5 0.0 1.0 0.01

View File

@ -27,32 +27,25 @@ layout(location = 0) out vec2 vTexCoord;
layout(location = 1) out vec2 vOutputCoord;
layout(location = 2) out vec2 vBg_img_coords;
layout(location = 3) out float vIsRotated;
//Scanlines:
layout(location = 4) out float vScanlinePeriod;
layout(location = 5) out float vOffset;
layout(location = 6) out float vMax_inLum;
//Vignette, spot:
layout(location = 7) out float vIn_aspect;
//
layout(location = 8) out float vDynamicSeed;
layout(location = 9) out float vBEZEL_INNER_ZOOM_adapted;
layout(location = 10) out float vDo_Tate;
layout(location = 11) out vec3 vDotMat_Grid_Color;
layout(location = 12) out vec4 vPG_offsets_and_size;
layout(location = 13) out vec2 vPG_freq_base_screen;
layout(location = 14) out vec2 vPG_freq_base_screen_unfloored;
layout(location = 15) out float vPG_period_multiplier_x;
layout(location = 16) out vec2 vPG_OriginalSize_tated_mul_pi;
layout(location = 17) out vec2 vPG_OutputSize_tated;
layout(location = 18) out vec2 vPG_OutputCoord_tated;
layout(location = 19) out float vDotMat_Grid_Sharpness;
layout(location = 20) out float vPG_mask_height;
layout(location = 21) out float vDeltaRenderOk;
layout(location = 22) out float vDo_pixelgrid_h;
layout(location = 23) out float vDo_Curvature;
layout(location = 24) out float vFake_scanline_period;
layout(location = 25) out float vPG_y_shift;
layout(location = 5) out float vInterlace_offset;
layout(location = 6) out float vIn_aspect;
layout(location = 7) out float vBEZEL_INNER_ZOOM_adapted;
layout(location = 8) out float vDo_Tate;
layout(location = 9) out vec3 vDotMat_Grid_Color;
layout(location = 10) out vec4 vPG_offsets_and_size;
layout(location = 11) out vec2 vPG_freq_base_screen;
layout(location = 12) out vec2 vPG_freq_base_screen_unfloored;
layout(location = 13) out float vPG_period_multiplier_x;
layout(location = 14) out vec2 vPG_OriginalSize_tated_mul_pi;
layout(location = 15) out vec2 vPG_OutputSize_tated;
layout(location = 16) out vec2 vPG_OutputCoord_tated;
layout(location = 17) out float vDotMat_Grid_Sharpness;
layout(location = 18) out float vPG_mask_height;
layout(location = 19) out float vDeltaRenderOk;
layout(location = 20) out float vDo_pixelgrid_h;
layout(location = 21) out float vFake_scanline_period;
layout(location = 22) out float vPG_y_shift;
#ifdef DEBUG_PRINT_VALUE
layout(location = 31) out float vfprintvalue;
@ -158,8 +151,8 @@ vec2 get_zooms_modifier(float do_tate, bool bNeed_NO_integer_scale, bool isrotat
co_scaled_max = zoomout_coords(co_scaled_max, -vBEZEL_INNER_ZOOM_adapted);
}
if (DO_GAME_GEOM_OVERRIDE == 1.0) {
co_scaled_min = content_geom_override(co_scaled_min, GAME_GEOM_ASPECT, vIn_aspect, GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM);
co_scaled_max = content_geom_override(co_scaled_max, GAME_GEOM_ASPECT, vIn_aspect, GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM);
co_scaled_min = content_geom_override_zoom(co_scaled_min, GAME_GEOM_ASPECT, vIn_aspect, GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM);
co_scaled_max = content_geom_override_zoom(co_scaled_max, GAME_GEOM_ASPECT, vIn_aspect, GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM);
}
//vfprintvalue = 1/(co_scaled_max.y - co_scaled_min.y);
@ -207,26 +200,16 @@ void main() {
//Scanline period:
vScanlinePeriod = 1.0; //Base 1x period
vOffset = 0.0; //No interlace
vInterlace_offset = 0.0; //No interlace
if (bIs_Interlaced && PIXELGRID_INTR_DISABLE_Y != 2.0) {
//Halve the scanline period, since they will interlace:
vScanlinePeriod = 0.5;
//Alternate scanlines on even/odd frames
if (params.FrameCount % 2 == 0.0)
vOffset = PI_15;
vInterlace_offset = PI_15;
}
//Calculate the maximum possible brightness of the input color by taking glow,
//contrast and brightness into account. This is needed so that scanline generation
//can map the proper input range and strictly obey scanline thickness constraints.
vMax_inLum = max( 1.0, DO_CCORRECTION * apply_contrast_brightness(1.0, CONTRAST, BRIGHTNESS)) *
max( 1.0, mix(1.0, IN_GLOW_POWER, DO_CCORRECTION));
//Generate a seed that changes over time for temporal random noise
vDynamicSeed = mod(params.FrameCount, 30.0001);
//Calc dotmat grid color
vDotMat_Grid_Color = vec3(DOT_M_G_BRT);
@ -298,8 +281,6 @@ void main() {
vDo_pixelgrid_h = float( pixelgrid_h_needed() );
vDo_Curvature = DO_CURVATURE * (GEOM_WARP_X + GEOM_WARP_Y);
//Dot matrix: measure the final picture size to choose a right sharpness level
//For simplicity and (my) mental health, take only y into account.
vDotMat_Grid_Sharpness = DOT_M_G_SHARP;
@ -315,10 +296,8 @@ void main() {
vDotMat_Grid_Sharpness = clamp(vDotMat_Grid_Sharpness, 0.1, 20.0);
//vfprintvalue = vDotMat_Grid_Sharpness;
}
// Delta render, mandatory conditions:
vDeltaRenderOk = float( ( params.FrameCount % int(DELTA_RENDER_FORCE_REFRESH) != 0.0 ) && // - We are in a frame that is not forced for full refresh
( (! bIs_Interlaced) || PIXELGRID_INTR_DISABLE_Y >= 1.0 || DO_PIXELGRID_H == 0.0) // - screen is not interlaced or we disabled scanlines on interlaced content
);
vDeltaRenderOk = is_deltarender_allowed(bIs_Interlaced); //carries DR mandatory conditions, including forced refreshed frames
// Fake or Faker integer scanlines:
// We are going to compute an amount of lines that is integer multiple of the screen lines and that
@ -330,7 +309,7 @@ void main() {
// fake integer scanlines will be used.
// (Logic is skipped if integer scaling is requested.)
bool very_lowres_y = false;
#define MIN_SCREEN_CORE_RATIO 4.0 //We want at least that screen lines per single scanline.
#define MIN_SCREEN_CORE_RATIO 3.5 //We want at least that screen lines per single scanline.
if ( bNeed_NO_integer_scale ) {
vec4 out_size = params.OutputSize;
vec4 ori_size = params.OriginalSize;
@ -341,7 +320,7 @@ void main() {
zoom_modifier.xy = zoom_modifier.yx;
}
float OutputHeightZoomed = out_size.y*zoom_modifier.y;
float screen_core_ratio = OutputHeightZoomed / params.OriginalSize.y;
float screen_core_ratio = OutputHeightZoomed / ori_size.y;
if (screen_core_ratio < MIN_SCREEN_CORE_RATIO)
very_lowres_y = true;
}
@ -394,7 +373,7 @@ void main() {
vFake_scanline_period = pi * fake_scanlines_numlines * out_coord.y;
//This somehow aligns better the scanline to the screen line:
vOffset+=1.0;
vInterlace_offset+=1.0;
}
@ -407,29 +386,26 @@ layout(location = 0) in vec2 vTexCoord;
layout(location = 1) in vec2 vOutputCoord;
layout(location = 2) in vec2 vBg_img_coords;
layout(location = 3) in float vIsRotated;
layout(location = 4) in float vScanlinePeriod;
layout(location = 5) in float vOffset;
layout(location = 6) in float vMax_inLum;
layout(location = 7) in float vIn_aspect;
layout(location = 8) in float vDynamicSeed;
layout(location = 9) in float vBEZEL_INNER_ZOOM_adapted;
layout(location = 10) in float vDo_Tate;
layout(location = 11) in vec3 vDotMat_Grid_Color;
layout(location = 12) in vec4 vPG_offsets_and_size;
layout(location = 13) in vec2 vPG_freq_base_screen;
layout(location = 14) in vec2 vPG_freq_base_screen_unfloored;
layout(location = 15) in float vPG_period_multiplier_x;
layout(location = 16) in vec2 vPG_OriginalSize_tated_mul_pi;
layout(location = 17) in vec2 vPG_OutputSize_tated;
layout(location = 18) in vec2 vPG_OutputCoord_tated;
layout(location = 19) in float vDotMat_Grid_Sharpness;
layout(location = 20) in float vPG_mask_height;
layout(location = 21) in float vDeltaRenderOk;
layout(location = 22) in float vDo_pixelgrid_h;
layout(location = 23) in float vDo_Curvature;
layout(location = 24) in float vFake_scanline_period;
layout(location = 25) in float vPG_y_shift;
layout(location = 5) in float vInterlace_offset;
layout(location = 6) in float vIn_aspect;
layout(location = 7) in float vBEZEL_INNER_ZOOM_adapted;
layout(location = 8) in float vDo_Tate;
layout(location = 9) in vec3 vDotMat_Grid_Color;
layout(location = 10) in vec4 vPG_offsets_and_size;
layout(location = 11) in vec2 vPG_freq_base_screen;
layout(location = 12) in vec2 vPG_freq_base_screen_unfloored;
layout(location = 13) in float vPG_period_multiplier_x;
layout(location = 14) in vec2 vPG_OriginalSize_tated_mul_pi;
layout(location = 15) in vec2 vPG_OutputSize_tated;
layout(location = 16) in vec2 vPG_OutputCoord_tated;
layout(location = 17) in float vDotMat_Grid_Sharpness;
layout(location = 18) in float vPG_mask_height;
layout(location = 19) in float vDeltaRenderOk;
layout(location = 20) in float vDo_pixelgrid_h;
layout(location = 21) in float vFake_scanline_period;
layout(location = 22) in float vPG_y_shift;
#ifdef DEBUG_PRINT_VALUE
layout(location = 31) in float vfprintvalue;
@ -498,38 +474,20 @@ vec3 fn_pixel_nightify(vec3 color_in, float strength, vec3 ambilight) {
}
float morph_shape_full(float shape, float power, float steep ) {
float lum_scaled = power;
float l = lum_scaled; // (already clamped)
if (lum_scaled <= 0.5+steep) {
float l1 = pow(l, 4) * 15;
shape = pow(shape, 1/sqrt(l1));
} else {
float l2 = (l-0.5)*2.0;
shape = mix(shape, 1.0, l2); //shape = shape * (1-l2) + l2;
}
return shape;
}
vec3 morph_shape_full_vec3(vec3 shape, vec3 l, float steep, float gamma ) {
float steep_plus_1 = 1+steep;
vec3 l_pow = pow(l,vec3(gamma));
vec3 l2 = min(l_pow * 16, 1+steep);
//vec3 s1 = pow(shape, 1/sqrt(l2));
vec3 l2 = min(l_pow * 16, steep);
vec3 s1 = pow(shape, inversesqrt(l2));
//vec3 s2 = (1-s1) * l_pow;
//== lpow - lpow * s1;
//== -lpow * s1 + lpow;
vec3 s2 = fma(-l_pow, s1, l_pow); //ASM PROOF, faster.
return (s2/(1+steep)) + s1;
return (s2/(steep)) + s1;
}
vec3 morph_shape_full_no_steepness_vec3(vec3 shape, vec3 l, float gamma ) {
vec3 l_pow = pow(l,vec3(gamma));
vec3 l2 = min(l_pow * 16, 1);
//vec3 s1 = pow(shape, 1/sqrt(l2));
vec3 s1 = pow(shape, inversesqrt(l2));
vec3 s2 = (1-s1) * l_pow;
// == 1*l_pow - s1*l_pow
@ -538,52 +496,11 @@ vec3 morph_shape_full_no_steepness_vec3(vec3 shape, vec3 l, float gamma ) {
return s2 + s1;
}
/*vec3 morph_shape_full_vec3(vec3 shape, vec3 l, float steep ) {
vec3 l_pow = pow(l,vec3(4.2));
vec3 l2 = l_pow * 16;
l2 = clamp(l2, 0.0, 1+steep);
vec3 s1 = pow(shape, 1/sqrt(l2));
vec3 s2 = (1-s1) * l_pow;
return s1+(s2/(l+steep));
}*/
/*vec3 morph_shape_full_vec3(vec3 shape, vec3 l, float steep ) {
vec3 l_pow = pow(l,vec3(4.1));
vec3 l2 = l_pow * 16;
l2 = clamp(l2, 0.0,1.0);
vec3 s1 = pow(shape, 1/sqrt(l2));
vec3 s2 = (1-s1) * l_pow * (l*l);
return s1+(s2/(1+steep));
}*/
vec3 morph_shape(vec3 shape, vec3 power, float steep, float gamma ) {
return morph_shape_full_vec3(shape, power, steep, gamma);
return vec3(
morph_shape_full(shape.x, power.x, steep),
morph_shape_full(shape.y, power.y, steep),
morph_shape_full(shape.z, power.z, steep)
);
//Use this to compare different methods
if (params.FrameCount % 2 == 0.0)
return morph_shape_full_vec3(shape, power, steep, gamma);
else
return vec3(
morph_shape_full(shape.x, power.x, steep),
morph_shape_full(shape.y, power.y, steep),
morph_shape_full(shape.z, power.z, steep)
);
}
/*float morph_shape(float shape, float power, float steep ) {
return morph_shape_full(shape, power, steep);
}*/
vec3 downsample( sampler2D tex, vec2 uv, vec4 sourcesize, float sharpness_add ) {
vec2 sharpness = vec2(1.0)+sharpness_add;
vec2 scale = sourcesize.xy * sharpness;
@ -632,24 +549,10 @@ vec3 downsample_x( sampler2D tex, vec2 uv, vec4 sourcesize, float sharpness_add
}
vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inLum ) {
/*
This would provide an additional method to alter scanlines "inertia", but has a cost of 4fps
when using smoothstep_fast and 13fps(!) when using standard smoothstep.
It could replace glow_x for tight blurs.
*/
//vec3 lum_h = downsample(in_glow_pass, in_coords, global.flick_and_noise_passSize, 0.0).rgb;
//vec3 lum_h = downsample_x(in_glow_pass, in_coords, global.flick_and_noise_passSize, 0.0).rgb;
//lum_h *= smoothstep_fast( vec3(SERVICE1-0.1) ,vec3(SERVICE1), lum_h);
//pixel_in = max(pixel_in, lum_h);
//pixel_in = blur9_x_box1tap(in_glow_pass, in_coords, params.OriginalSize.xy, abs(IN_GLOW_W)*2.0) ; //102.4
vec4 fn_pixel_grid(vec2 in_coords, vec4 pixel_in, float min_inLum, float max_inLum ) {
//Scanlines: compute each phosphor height according to input luminance, puttin it here helps parallelism a bit.
float extragain_h = max(PIXELGRID_MAX_H, 1.0);
vec3 phosphor_height = map_range(pixel_in*extragain_h, min_inLum, max_inLum, PIXELGRID_MIN_H, clamp(PIXELGRID_MAX_H, PIXELGRID_MIN_H, 1.0));
vec3 phosphor_height = map_range(pixel_in.rgb, min_inLum, max_inLum, PIXELGRID_MIN_H, clamp(PIXELGRID_MAX_H, PIXELGRID_MIN_H, 1.0));
//Tate ? (other outputsize,originalsize and outputcoords "tated" in vertex shader.)
if (vDo_Tate == 1.0) in_coords.xy = in_coords.yx;
@ -706,6 +609,7 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
//Moving it up there provides a small speed up due to
//increased parallalism, I guess.
float sin_check_offset = sin(freq_base_unfloored.x);
float is_even = step(sin_check_offset, 0.0);
@ -717,24 +621,28 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
//Pixelgrid: do horizontal if enabled, but skip it if user doesn't want it on interlaced content.
//if (DO_PIXELGRID_H > 0.0 && !(PIXELGRID_INTR_DISABLE_Y==1.0 && vIsInterlaced==1.0)) { //103.1
if (vDo_pixelgrid_h > 0.5) {
//Scanline Inflation:
#define inflation pixel_in.a
freq_base_core.y += inflation;
//Since we emulate scanlines, take into account current scanline phase:
float interlacing_adapt_period = vScanlinePeriod;
//We can offset trias to emulate fake core level slotmask by applying the optional offset to emulate the slotmask on even cells
float triad_stagger_offset = is_even * PIXELGRID_OFFSET_CORE * pi;
float fakeslot_stagger_offset = is_even * PIXELGRID_OFFSET_CORE * pi;
//get 3 sines with applied the optional staggered offset for slotmask, and single phosphors staggering for y deconvergence.
vec3 decon_stagger = vec3( PIXELGRID_DECON_R_H, PIXELGRID_DECON_G_H, PIXELGRID_DECON_B_H);
//Antimoire experiments:
vec3 rgb_h_sin = vec3(1.0);
float anti_inflation = 1-clamp(abs(pixel_in.a), 0.0,1.0); //<- counteract: deconvergence does not depend on inflaction
if (PIXELGRID_H_ANTIMOIRE > 0.0) {
float anti_moire_freq = sin(vPG_freq_base_screen_unfloored.x * vPG_offsets_and_size.a );
float anti_moire_amp = PIXELGRID_H_ANTIMOIRE;
rgb_h_sin = sin( (freq_base_core.yyy * interlacing_adapt_period) + ( anti_moire_freq * anti_moire_amp ) + vOffset);
rgb_h_sin = sin( (freq_base_core.yyy * interlacing_adapt_period) + ( anti_moire_freq * anti_moire_amp ) + vInterlace_offset);
} else {
rgb_h_sin = sin( (freq_base_core.y * interlacing_adapt_period) + triad_stagger_offset - decon_stagger + vOffset);
rgb_h_sin = sin( (freq_base_core.y * interlacing_adapt_period) + fakeslot_stagger_offset - decon_stagger*anti_inflation + vInterlace_offset );
}
//make it positve with doubled frequency:
@ -743,12 +651,12 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
//Compute dedot mix here for use in h mask and vmask2 later
//dedot_mix = vec3( PIXELGRID_H_DEDOT - PIXELGRID_H_DEDOT * rgb_h_sin.x);
dedot_mix = vec3( fma( -PIXELGRID_H_DEDOT, rgb_h_sin.x, PIXELGRID_H_DEDOT)); //ASM PROOF: SAME
dedot_mix = dedot_mix *(pixel_in/max_inLum);
dedot_mix = dedot_mix *(pixel_in.rgb/max_inLum);
// Compute each phosphor height according to input luminance,
// Moved outside the branch to help parallelism a bit
//float extragain_h = max(PIXELGRID_MAX_H, 1.0); //Handle
//vec3 phosphor_height = map_range(pixel_in*extragain_h, min_inLum, max_inLum, PIXELGRID_MIN_H, clamp(PIXELGRID_MAX_H, PIXELGRID_MIN_H, 1.0));
//vec3 phosphor_height = map_range(pixel_in.rgb*extragain_h, min_inLum, max_inLum, PIXELGRID_MIN_H, clamp(PIXELGRID_MAX_H, PIXELGRID_MIN_H, 1.0));
//Finally get 3 sines out of the previous one by applying height modifiers
@ -771,7 +679,7 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
//make them always positive and double frequency:
rgb_w = (rgb_w * rgb_w);
//Scale Max width according to pre-gains:
vec3 phosphor_width = map_range(pixel_in, min_inLum, max_inLum, PIXELGRID_MIN_W, PIXELGRID_MAX_W);
vec3 phosphor_width = map_range(pixel_in.rgb, min_inLum, max_inLum, PIXELGRID_MIN_W, PIXELGRID_MAX_W);
//Get final phosphor width:
//rgb_w = morph_shape(rgb_w, phosphor_width, PIXELGRID_NO_INTERBLEED_W, PIXELGRID_GAMMA_W); //2%
rgb_w = morph_shape_full_no_steepness_vec3(rgb_w, phosphor_width, PIXELGRID_GAMMA_W); //2%
@ -795,7 +703,7 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
// can be used for slotmask,aperturegrille ... or scanlines, but they would have a boxed shape.
vec3 darklines_mask=vec3(1.0);
vec3 pixel_in_unsparkled = pixel_in;
vec3 pixel_in_unsparkled = pixel_in.rgb;
if (PIXELGRID_Y_MASK > 0.0) {
//Compute phosphors height mask with the right reference coords.
float ph_mask_height;
@ -826,7 +734,7 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
// return vec4(mask_shape);
//Get per channel input luminance by clamping pixel_in and applying hmask
vec3 lum = clamp(pixel_in * rgb_w, 0.0, 1.0);
vec3 lum = clamp(pixel_in.rgb * rgb_w, 0.0, 1.0);
//Adapt the luminance effect via input parameter
vec3 lum_adapted = (1-lum*PIXELGRID_Y_MASK_ON_WHITE);
//Calc final mask visibility as the minimum between tha configured visibility and luminosity effect
@ -848,11 +756,11 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
//Apply Overmask:
if (TEST_OVERMASK_NEW == 1.0) {
vec3 mask_overmask = PIXELGRID_OVERMASK * (mask - 0.5) + 0.5;
vec3 pixel_in_overmask = mix(pixel_in, pixel_in * PIXELGRID_OVERMASK, PIXELGRID_OVERMASK);
vec3 pixel_in_overmask = mix(pixel_in.rgb, pixel_in.rgb * PIXELGRID_OVERMASK, PIXELGRID_OVERMASK);
//Adaptive overmask experiment
//different mix levels:
mask = mix(mask, mask_overmask, abs(mask - vec3(0.5)) );
pixel_in = mix(pixel_in, pixel_in_overmask, abs( pixel_in - vec3(0.5) ) );
pixel_in.rgb = mix(pixel_in.rgb, pixel_in_overmask, abs( pixel_in.rgb - vec3(0.5) ) );
//Same mix levels:
//mask = mix(mask_overmask, mask, pow( abs( pixel_in - vec3(0.5))*2.0, vec3(1.0)) );
//pixel_in = mix(pixel_in_overmask, pixel_in, pow(abs( pixel_in - vec3(0.5))*2.0, vec3(1.0)) );
@ -862,10 +770,10 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
//pixel_in = mix(pixel_in, pixel_in * overmask_adapted, overmask_adapted);
} else {
mask = PIXELGRID_OVERMASK * (mask - 0.5) + 0.5;
pixel_in = mix(pixel_in, pixel_in * PIXELGRID_OVERMASK, PIXELGRID_OVERMASK);
pixel_in.rgb = mix(pixel_in.rgb, pixel_in.rgb * PIXELGRID_OVERMASK, PIXELGRID_OVERMASK);
}
//Apply the mask to pixel_in and clamp the minimum to the unexcited grille.
vec3 mask_and_grille = max(mask * pixel_in, rgb_grille_basal);
vec3 mask_and_grille = max(mask * pixel_in.rgb, rgb_grille_basal);
//return it with alpha channel containing the mask itself, so that halo can selectively light it.
return vec4( mask_and_grille , dot(rgb_h, vec3(0.3333)));
@ -1157,23 +1065,24 @@ float gaussian_coefficient(float x, float sigma) {
vec3 fn_pixel_content(vec2 coords) {
vec3 pixel_out;
vec3 pixel_glowed;
vec4 pixel_glowed;
float dot_mat_or_pixelgrid = 1.0; //init dot grid or scanline mask to 1.0
//#define USE_QUILEZ
#ifdef USE_QUILEZ
pixel_glowed = texture(in_glow_pass, coords_QULEZ(coords, global.flick_and_noise_passSize)).rgb;
pixel_out = pixel_glowed;
pixel_glowed = texture(in_glow_pass, coords_QULEZ(coords, global.flick_and_noise_passSize));
pixel_out = pixel_glowed.rgb;
#else
pixel_glowed = texture(in_glow_pass, coords).rgb;
pixel_out = pixel_glowed;
pixel_glowed = texture(in_glow_pass, coords);
pixel_out = pixel_glowed.rgb;
#endif
//Pixel grid
if (DO_PIXELGRID == 1.0) {
vec4 pixel_grid = fn_pixel_grid(coords, pixel_out, 0.0, vMax_inLum);
float vMax_inLum = max( 1.0, DO_CCORRECTION * apply_contrast_brightness(1.0, CONTRAST, BRIGHTNESS)) *
max( 1.0, mix(1.0, IN_GLOW_POWER, DO_CCORRECTION));
vec4 pixel_grid = fn_pixel_grid(coords, pixel_glowed, 0.0, vMax_inLum);
//grid mask only is needed by halo to selectively light the grid.
dot_mat_or_pixelgrid = pixel_grid.a;
pixel_out = pixel_grid.rgb;
@ -1335,10 +1244,6 @@ vec4 fn_pixel_bezel(vec2 coords_for_bezel, vec2 coords_for_mirror, float nightif
void main() {
vec3 pixel_out = vec3(0.0);
float canvas_busy = 0.0; //<-- this allow for paint over not painted areas (spares gpu cycles)
//Initial content coords
vec2 co_content = vTexCoord;
@ -1358,7 +1263,7 @@ void main() {
//Curvature
//Curvature has to come after inner zoom or bezel curved border will not match content
//curved border when inner zoom changes.
if (vDo_Curvature > 0.0) {
if ( curvature_needed() > 0.0 ) {
co_content = Warp_koko(co_content, vec2(GEOM_WARP_X, GEOM_WARP_Y), 0.5);
}
@ -1366,41 +1271,57 @@ void main() {
//It is still not perfect but a reasonable tradeoff by now.
vec2 co_mirror = zoom(co_content, 1/BEZEL_REFL_ZOOMOUT_ROOM);
//Apply other content coords modifiers
if (DO_GAME_GEOM_OVERRIDE == 1.0)
co_content = content_geom_override(co_content, GAME_GEOM_ASPECT, vIn_aspect, GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM);
//Dynamic lum dependant full screen zoom?
#ifndef D3D_WORKAROUND
if (DO_DYNZOOM > 0.0)
co_content = zoom(co_content, get_dyn_zoom(avglum_pass) );
#endif
/* float anaborderstart = 0.5;
float anabordersize = anaborderstart + SERVICE1;
float side_zoom = 1-smoothstep_fast(anaborderstart-0.5, anabordersize-0.5,abs(co_content.x-0.5)) ;
co_content.x = zoom1D(co_content.x, 1/side_zoom);
//FragColor = vec4(side_zoom) ; return;
*/
float canvas_busy = 0.0; //<-- this allow for paint over not painted areas (spares gpu cycles)
//Create an alpha mask to write content into, it holds opacity info that will be used to compose:
if (DO_CURVATURE == 1.0) {
canvas_busy = fn_border(co_content);
} else {
canvas_busy = float(is_first_inside_rect(co_content, RECT01)); //FIXME: is step() faster?
}
//Apply other content coords modifiers
if (DO_GAME_GEOM_OVERRIDE == 1.0)
co_content = content_geom_override_zoom(co_content, GAME_GEOM_ASPECT, vIn_aspect, GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM);
#ifndef D3D_WORKAROUND
if (DELTA_RENDER == 1.0) {
bool reuse_old = bool( texture(in_glow_pass, co_content).a * canvas_busy * vDeltaRenderOk ) ;
bool reuse_old = bool( float(texture(in_glow_pass, co_content).a > 3.0) * canvas_busy * vDeltaRenderOk ) ;
// ^^ We have to check if alpha is > 3.0 because till 3.0 it means it is carrying the scanline
// ^^ inflation information from glow_y pass.
if (reuse_old) {
FragColor = texture(final_passFeedback, vOutputCoord) ;
FragColor = texture(final_passFeedback, vOutputCoord);// * vec4(1,0,0,0);
return;
}
}
#endif
//Dynamic lum dependant full screen zoom?
#ifndef D3D_WORKAROUND
if (DO_DYNZOOM > 0.0)
co_content = zoom(co_content, get_dyn_zoom(avglum_pass) );
if (AUTOCROP_MAX > 0.0)
co_content = zoom(co_content, get_autocrop_zoom(avglum_pass) );
#endif
vec3 pixel_ambi = vec3(0.0);
vec3 pixel_under_content = vec3(0.0);
// pixel_ambi = texture(ambi_temporal_pass, vOutputCoord).rgb ;
// FragColor = pixel_ambi.rgbr; return;
vec3 pixel_out = vec3(0.0);
//Draw content only over the alpha mask, and sample ambientlight outside it to spare gpu cycles.
if (canvas_busy > 0.5) {
@ -1435,7 +1356,8 @@ void main() {
if (DO_BG_IMAGE != 1.0) {
const float noise_power = NOISEPOWER * NOISEPOWER_AMBI_MUL;
float anoise1 = random_fast(vTexCoord * vDynamicSeed);
float dynamicseed = mod(params.FrameCount, 30.0001);
float anoise1 = random_fast(vTexCoord*dynamicseed);
anoise1 = scale_to_range(anoise1, -noise_power, noise_power);
// anoise1 *= (1 - pixel_ambi.g);
//anoise1 = (anoise1 - anoise1 * pixel_ambi.g); //ASM PROOF FASTER
@ -1486,10 +1408,8 @@ void main() {
if (DO_VIGNETTE == 1.0) {
float spot_vignette_noise = random_fast(vTexCoord);
spot_vignette_noise = scale_to_range(spot_vignette_noise, -NOISEPOWER, NOISEPOWER);
pixel_out += spot_vignette_noise;
vec2 sinco = (co_content-0.5) / V_SIZE ;
float vignette = cos(sinco.x) * cos(sinco.y) * V_POWER;
pixel_out = (pixel_out*vignette);
vec2 sinco = cos((co_content-0.5) / V_SIZE) ;
pixel_out = (pixel_out * V_POWER) * (sinco.y * sinco.x) + spot_vignette_noise;
}
//Spot
@ -1498,7 +1418,8 @@ void main() {
vec2( S_POSITION_X * vIn_aspect, S_POSITION_Y) );
//pixel_out += smoothstep_fast(S_SIZE,0.0,dist) * (S_POWER * canvas_bezel_screen); //ASM PROOF FASTER
//pixel_out += smoothstep_cos(S_SIZE,0.0,dist) * (S_POWER * canvas_bezel_screen); //ASM PROOF MORE INSTRUCTIONS, LESS CYCLES
pixel_out += smoothstep(S_SIZE,0.0,dist) * (S_POWER * canvas_bezel_screen);
//pixel_out += smoothstep(S_SIZE,0.0,dist) * (S_POWER * canvas_bezel_screen);
pixel_out += smoothstep_fast(S_SIZE * 0.90 ,0.0,dist) * (S_POWER * 1.125 * canvas_bezel_screen);
//pixel_out = mix(pixel_out, vec3(1.0), smoothstep(S_SIZE,0.0,dist) * S_POWER * canvas_bezel_screen); //<-- this is a bit slower, but more realistic.
}
}
@ -1602,12 +1523,39 @@ void main() {
pixel_out = 1-pixel_out;//;-clip;
#endif
//pixel_out = pixel_out -diff;
FragColor = vec4(pixel_out, 1.0);
/*
float m = 1.0;
vec2 d = global.flick_and_noise_passSize.zw*m;
vec2 sharpness = d*SERVICE1/m;
vec3 gx = texture(in_glow_pass, vec2(vTexCoord.x + d.x, vTexCoord.y)).rgb -
texture(in_glow_pass, vec2(vTexCoord.x - d.x, vTexCoord.y)).rgb;
vec3 gy = texture(in_glow_pass, vec2(vTexCoord.x, vTexCoord.y + d.y)).rgb -
texture(in_glow_pass, vec2(vTexCoord.x, vTexCoord.y - d.y)).rgb;
float fgx = +(gx.x+gx.y+gx.z)/3.0;
float fgy = +(gy.x+gy.y+gy.z)/3.0;
// fgx = clamp(fgx, -SERVICE1, SERVICE1);
// fgy = clamp(fgy, -SERVICE1, SERVICE1);
vec2 warp = vec2(fgx, fgy) * sharpness;
vec2 warpedTexCoord = vTexCoord + warp;
vec4 warpedColor = texture(in_glow_pass, warpedTexCoord);
FragColor = vec4(fgx*fgy);
FragColor = warpedColor;
*/
//FragColor = texture(halo_pass, vOutputCoord);
}

View File

@ -79,8 +79,8 @@ vec4 pixel_flickering() {
* to see the effect (the lcd panel would just mix the pixels by itself (meh).
*/
vec4 pixel_cur = texture(Source,vTexCoord);
vec3 flickline = texture(Source,vFlickerCoords).rgb;
vec4 pixel_cur = texture_NEAREST(Source,vTexCoord, params.OriginalSize);
vec3 flickline = texture_NEAREST(Source,vFlickerCoords, params.OriginalSize).rgb;
//float lumdiff = abs( flickline.r + flickline.g + flickline.b - pixel_cur.r - pixel_cur.g - pixel_cur.b);
//float lumdiff = abs( (flickline.r + flickline.g) + (flickline.b - pixel_cur.r) - (pixel_cur.g + pixel_cur.b) ); //1687 1754 2946 ASM PROOF: FASTER
@ -99,7 +99,7 @@ void main() {
if (vDo_flickering==1.0)
pixel_out = pixel_flickering(); //<-alpha carries ntsc artifacts mask
else
pixel_out = texture(Source, vTexCoord); //<-alpha carries ntsc artifacts mask
pixel_out = texture_NEAREST(Source, vTexCoord, params.OriginalSize); //<-alpha carries ntsc artifacts mask
if (DO_RF_NOISE > 0.0) {
float anoise = random_fast(vTexCoord * vDynamicSeed);

View File

@ -8,6 +8,7 @@ layout(location = 1) in vec2 TexCoord;
layout(location = 0) out vec2 vTexCoord;
layout(location = 1) out vec2 vHALO_SHARPNESS;
layout(location = 2) out float vHALO_POWER;
layout(location = 3) out float vDeltaRenderOk;
vec2 radius_blur_adapt(vec2 bsize, vec4 sourcesize){
vec2 r;
@ -39,22 +40,36 @@ void main() {
vHALO_POWER = HALO_POWER;
else
vHALO_POWER = -HALO_POWER/10.0;
bool bIs_Interlaced = is_interlaced();
vDeltaRenderOk = is_deltarender_allowed(bIs_Interlaced);
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 1) in vec2 vHALO_SHARPNESS;
layout(location = 2) in float vHALO_POWER;
layout(location = 3) in float vDeltaRenderOk;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 4) uniform sampler2D Source;
layout(set = 0, binding = 5) uniform sampler2D in_glow_pass;
void main() {
if (DO_HALO == 0.0 ) return;
if (DELTA_RENDER == 1.0) {
if (vDeltaRenderOk == 1.0) {
//No need to process halo if we're using deltarender and content did not change.
if (texture(in_glow_pass, vTexCoord).a > 3.0)
return;
}
}
//Pass the right texture unchanged for tighter blurs:
if (HALO_SHARPNESS >= GLOW_SHARP_MAX) {
FragColor = vec4( pow(texture(Source, vTexCoord).rgb * vHALO_POWER, vec3(HALO_GAMMA_OUT)), 1.0) ;

View File

@ -11,6 +11,7 @@ layout(location = 3) out float vHALO_UNGAIN_FACTOR;
layout(location = 4) out float vDo_pixelgrid_h;
layout(location = 5) out float vTexCoord_mul_sourcesizey;
layout(location = 6) out float vScanline_gap;
layout(location = 7) out float vDeltaRenderOk;
void main() {
gl_Position = global.MVP * Position;
@ -28,6 +29,10 @@ void main() {
vHALO_GAMMA = vec3(HALO_GAMMA);
vHALO_UNGAIN_FACTOR = get_halo_ungain_factor();
bool bIs_Interlaced = is_interlaced();
vDeltaRenderOk = is_deltarender_allowed(bIs_Interlaced);
}
#pragma stage fragment
@ -37,6 +42,7 @@ layout(location = 3) in float vHALO_UNGAIN_FACTOR;
layout(location = 4) in float vDo_pixelgrid_h;
layout(location = 5) in float vTexCoord_mul_sourcesizey;
layout(location = 6) in float vScanline_gap;
layout(location = 7) in float vDeltaRenderOk;
layout(location = 0) out vec4 FragColor;
@ -45,17 +51,28 @@ layout(set = 0, binding = 4) uniform sampler2D in_glow_pass;
void main() {
if (DO_HALO == 0.0 ) return;
vec3 pixel_haloed = texture(in_glow_pass, vTexCoord).rgb;
if (HALO_NO_PREGAIN == 1.0) pixel_haloed/= vHALO_UNGAIN_FACTOR;
pixel_haloed = pow(pixel_haloed, vHALO_GAMMA);
vec4 pixel_haloed = texture(in_glow_pass, vTexCoord);
/* if (DELTA_RENDER == 1.0) {
if (vDeltaRenderOk == 1.0) {
//No need to process halo if we're using deltarender and content did not change.
//Produces glitches; disable by now.
if (pixel_haloed.a > 3.0)
return;
}
}
*/
if (HALO_NO_PREGAIN == 1.0) pixel_haloed.rgb/= vHALO_UNGAIN_FACTOR;
pixel_haloed.rgb = pow(pixel_haloed.rgb, vHALO_GAMMA);
//Prepaint scanlines gaps?
if (HALO_PRE_SCANLINE_GAP == 1.0) {
if (vDo_pixelgrid_h == 1.0) {
if (mod( vTexCoord_mul_sourcesizey, 2.0) < 1.0) {
//Scanline gap fades away for high luminosity pixels
pixel_haloed = pixel_haloed * vScanline_gap;
pixel_haloed.rgb = pixel_haloed.rgb * vScanline_gap;
}
}
}

View File

@ -4,6 +4,8 @@
//Dumbify glow under this treshold.
#define GLOW_SHARP_MAX_ALTERNATE -2.0
#include "includes/functions.include.slang"
#pragma stage vertex
layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord;
@ -12,6 +14,7 @@ layout(location = 1) out float glow_h_and_w_outside_interval;
layout(location = 2) out float glow_w_inside_interval;
layout(location = 3) out float vSharp_sub;
layout(location = 4) out float vShowArtifactsMask;
layout(location = 5) out float vDeltaRenderOk;
void main() {
gl_Position = global.MVP * Position;
@ -37,6 +40,10 @@ void main() {
//}
vShowArtifactsMask = float(DO_NTSC_ARTIFACTS + NTSC_SHOW_ARTF_MASK > 1.5);
bool bIs_Interlaced = is_interlaced();
vDeltaRenderOk = is_deltarender_allowed(bIs_Interlaced); //carries DR mandatory conditions, including forced refreshed frames
}
@ -47,16 +54,13 @@ layout(location = 1) in float glow_h_and_w_outside_interval;
layout(location = 2) in float glow_w_inside_interval;
layout(location = 3) in float vSharp_sub;
layout(location = 4) in float vShowArtifactsMask;
layout(location = 5) in float vDeltaRenderOk;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 5) uniform sampler2D shift_and_bleed_pass;
layout(set = 0, binding = 6) uniform sampler2D shift_and_bleed_passFeedback;
#include "includes/functions.include.slang"
layout(set = 0, binding = 5) uniform sampler2D colortools_and_ntsc_pass;
layout(set = 0, binding = 6) uniform sampler2D colortools_and_ntsc_passFeedback;
layout(set = 0, binding = 7) uniform sampler2D shift_and_bleed_pass;
vec3 blur_select_wrap(sampler2D texture_in, vec2 co, vec4 sourcesize, float sharpness, bool use_gauss) {
@ -67,19 +71,24 @@ vec3 blur_select_wrap(sampler2D texture_in, vec2 co, vec4 sourcesize, float shar
}
void main() {
if (DO_IN_GLOW == 0.0) {
//Delta render?
if (DELTA_RENDER == 1.0) {
float DR_unchanged = float( textureLod(shift_and_bleed_pass, vTexCoord, DELTA_RENDER_CHECK_AREA).rgb ==
textureLod(shift_and_bleed_passFeedback, vTexCoord, DELTA_RENDER_CHECK_AREA).rgb);
if (vDeltaRenderOk == 1.0) {
float DR_unchanged = delta_render_unchanged(colortools_and_ntsc_passFeedback, colortools_and_ntsc_pass,
vTexCoord, DELTA_RENDER_CHECK_AREA);
if (DR_unchanged > 0.0) {
FragColor = vec4(0.0,0.0,0.0,DR_unchanged);
return;
}
};
}
}
//Modulate glow power via ntsc artifact mask:
float ntsc_artifacts = texture(shift_and_bleed_pass, vTexCoord).a;
float ntsc_artifacts = texture(shift_and_bleed_pass, vTexCoord).a; //compiler is smart enough to reuse this lookup, no need to branch.
//To debug ntsc artifacts mask:
if (vShowArtifactsMask == 1.0) {
@ -92,12 +101,6 @@ void main() {
if ( glow_h_and_w_outside_interval == 1.0) {
vec4 passthrough = texture(shift_and_bleed_pass, vTexCoord);
//Delta render?
if (DELTA_RENDER == 1.0) {
float DR_unchanged = float( textureLod(shift_and_bleed_pass, vTexCoord, DELTA_RENDER_CHECK_AREA).rgb ==
textureLod(shift_and_bleed_passFeedback, vTexCoord, DELTA_RENDER_CHECK_AREA).rgb);
FragColor = vec4(passthrough.rgb, DR_unchanged);
return;
}
FragColor = passthrough;
return;
}
@ -128,21 +131,12 @@ void main() {
in_glow_w_adapted = in_glow_w_adapted / NEW_SCALEMOD_X;
//Delta render?
float DR_unchanged = 0.0;
if (DELTA_RENDER == 1.0) {
//Keep track of changed pixels to speedup rendering in final pass
DR_unchanged = float( textureLod(shift_and_bleed_pass, vTexCoord, DELTA_RENDER_CHECK_AREA).rgb ==
textureLod(shift_and_bleed_passFeedback, vTexCoord, DELTA_RENDER_CHECK_AREA).rgb);
}
//Finally blur horizontally
if (glow_w_inside_interval == 1.0) {
FragColor = vec4(blur_select_wrap(shift_and_bleed_pass, vTexCoord, global.flick_and_noise_passSize, in_glow_w_adapted, (IN_GLOW_W >= 0.0) ),
DR_unchanged);
0.0);
} else {
FragColor = vec4(texture(shift_and_bleed_pass, vTexCoord).rgb, DR_unchanged);
FragColor = vec4(texture(shift_and_bleed_pass, vTexCoord).rgb, 0.0);
}

View File

@ -1,5 +1,6 @@
#version 450
#include "config.inc"
#include "includes/functions.include.slang"
//Dumbify glow under this treshold.
#define GLOW_SHARP_MAX_ALTERNATE -2.0
@ -12,6 +13,8 @@ layout(location = 1) out float glow_h_inside_interval;
layout(location = 2) out float vDoInGlowBias;
layout(location = 3) out float vGlow_Gain;
layout(location = 4) out float vSharp_sub;
layout(location = 11) out float vDeltaRenderOk;
void main() {
gl_Position = global.MVP * Position;
@ -40,6 +43,10 @@ void main() {
vSharp_sub = clamp(sharp_sub, 0.0,1.0);
vSharp_sub = -2*vSharp_sub+1;
//}
bool bIs_Interlaced = is_interlaced();
vDeltaRenderOk = is_deltarender_allowed(bIs_Interlaced); //carries DR mandatory conditions, including forced refreshed frames
}
@ -50,26 +57,88 @@ layout(location = 1) in float glow_h_inside_interval;
layout(location = 2) in float vDoInGlowBias;
layout(location = 3) in float vGlow_Gain;
layout(location = 4) in float vSharp_sub;
layout(location = 11) in float vDeltaRenderOk;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 5) uniform sampler2D shift_and_bleed_pass;
layout(set = 0, binding = 6) uniform sampler2D Source;
#include "includes/functions.include.slang"
layout(set = 0, binding = 7) uniform sampler2D in_glow_passFeedback;
vec3 glow_blur_bias(sampler2D source_tex, vec2 co, vec3 pixel_glowed, float bias){
vec3 pixel_source = texture(source_tex, co).rgb;
pixel_source = pixel_source * vGlow_Gain;
/*
//Take originale
vec3 glow_light = pixel_glowed - pixel_source;
glow_light = clamp(glow_light * IN_GLOW_SPREAD, 0.0, 1.0);
//glow_light = pow(glow_light, vec3(SERVICE1));
vec3 proper_glow = glow_light * glow_light + pixel_source;
return mix(proper_glow, pixel_glowed, max(0.0, bias));
*/
//Take 2: come originale, ma permetti di poware a piacere, //Buono, per ora la scelta safe.
//Sembra funzionare nalogamente a Take4, forse più semplice da impostare.
//buono con sx,sx=1.3; light gain 2.7, light sharpness 1.1
vec3 glow_light = pixel_glowed - pixel_source;
glow_light = clamp(glow_light * IN_GLOW_SPREAD, 0.0, 1.0);
glow_light = pow(glow_light, vec3(IN_GLOW_SPREAD_SHARPNESS));
vec3 proper_glow = glow_light + pixel_source;
return mix(proper_glow, pixel_glowed, max(0.0, bias));
//Take 2.5: come Take 2, ma usiamo smoothstep al posto di pow.
//melio take 2.
/*vec3 glow_light = pixel_glowed - pixel_source;
glow_light = smoothstep(vec3(0.0), vec3(SERVICE1*2), glow_light);
glow_light = clamp(glow_light * IN_GLOW_SPREAD, 0.0, 1.0);
vec3 proper_glow = glow_light + pixel_source;
return mix(proper_glow, pixel_glowed, max(0.0, bias));
*/
//Take 2: come Take2, ma facciamo anche smoothstep prevenfivo su glow light
//Sembra funzionare nalogamente a Take4, forse più semplice da impostare.
/*vec3 glow_light = pixel_glowed - pixel_source;
glow_light = clamp(glow_light * IN_GLOW_SPREAD, 0.0, 1.0);
glow_light = pow(glow_light, vec3(SERVICE1*2));
glow_light = smoothstep(vec3(0.7), vec3(1.0), glow_light);
vec3 proper_glow = glow_light + pixel_source;
return mix(proper_glow, pixel_glowed, max(0.0, bias));
*/
//Take 3: come take 2 ma con smoothstep finale //Non saprei se è utile oppure no.
/*vec3 glow_light = pixel_glowed - pixel_source;
glow_light = clamp(glow_light * IN_GLOW_SPREAD, 0.0, 1.0);
glow_light = pow(glow_light, vec3(SERVICE1*2));
glow_light = smoothstep(vec3(0.4), vec3(0.8), glow_light);
vec3 proper_glow = glow_light + pixel_source;
return mix(proper_glow, pixel_glowed, max(0.0, bias));
*/
//Take4: Il gain viene dato alla luce glow che poi diventa il valore di mix tra pixel sharp e il glow originale.
//Da meno problemi di pixel scuri che diventano troppo chiari, ma è anche più sfocato in generale.
//Bene con gamma service1 a 0.001, sharpx,y = 2, light 3.6
/*vec3 pixel_glowed_ori = pixel_glowed;
vec3 glow_light = pixel_glowed - pixel_source ;
glow_light = max(glow_light, 0.0);
pixel_glowed = pow(pixel_glowed, vec3(SERVICE1)) * IN_GLOW_SPREAD;
vec3 proper_glow = mix(pixel_source, pixel_glowed, glow_light);
proper_glow = mix(proper_glow, pixel_glowed_ori, max(0.0, bias));
return proper_glow;*/
//Take5: Come take4, speriamo di riuscire a fare uno sharp tramite smoothstep.
//..no.
/*vec3 pixel_glowed_ori = pixel_glowed;
vec3 glow_light = pixel_glowed - pixel_source ;
glow_light = max(glow_light, 0.0);
pixel_glowed = pow(pixel_glowed, vec3(SERVICE1)) * IN_GLOW_SPREAD;
pixel_glowed = smoothstep(vec3(0.3), vec3(0.7), pixel_glowed);
//return pixel_glowed;
vec3 proper_glow = mix(pixel_source, pixel_glowed, glow_light);
proper_glow = mix(proper_glow, pixel_glowed_ori, max(0.0, bias));
return proper_glow;*/
}
vec3 blur_select_wrap(sampler2D texture_in, vec2 co, vec4 sourcesize, float sharpness, bool use_gauss) {
@ -112,15 +181,76 @@ vec3 antialias_blur_bias(sampler2D source_tex, vec2 co, vec3 pixel_glowed, float
}
*/
void main() {
if (DO_IN_GLOW == 0.0) {
/* warpsharp experiment
vec2 d = params.OriginalSize.zw*2.0;
vec2 sharpness = d*SERVICE1;
vec3 gx = texture(Original, vec2(vTexCoord.x + d.x, vTexCoord.y)).rgb -
texture(Original, vec2(vTexCoord.x - d.x, vTexCoord.y)).rgb;
vec3 gy = texture(Original, vec2(vTexCoord.x, vTexCoord.y + d.y)).rgb -
texture(Original, vec2(vTexCoord.x, vTexCoord.y - d.y)).rgb;
vec3 color = texture(Original, vTexCoord).rgb;
float fgx = +(gx.x+gx.y+gx.z)/3.0;
float fgy = +(gy.x+gy.y+gy.z)/3.0;
fgx = clamp(fgx, -SERVICE1, SERVICE1);
fgy = clamp(fgy, -SERVICE1, SERVICE1);
vec2 warp = vec2(fgx, fgy) * sharpness;
vec2 warpedTexCoord = vTexCoord + warp;
vec4 warpedColor = texture(Original, warpedTexCoord);
FragColor = vec4(fgx*fgy);
//FragColor = warpedColor;
return;
*/
//Delta render?
if (DELTA_RENDER == 1.0) {
float original_unchanged = texture(Source,vTexCoord).a;
vec3 color = texture(shift_and_bleed_pass, vTexCoord).rgb * vGlow_Gain;
FragColor = vec4(color, original_unchanged);
if (vDeltaRenderOk == 1.0) {
float DR_unchanged = texture(Source,vTexCoord).a;
if (DR_unchanged > 0.0) {
FragColor = vec4( texture(in_glow_passFeedback, vTexCoord).rgb,DR_unchanged);
return;
}
FragColor = vec4(texture(shift_and_bleed_pass, vTexCoord).rgb * vGlow_Gain, 1.0);
}
}
float max_inLum = max( 1.0, DO_CCORRECTION * apply_contrast_brightness(1.0, CONTRAST, BRIGHTNESS));
//Scanlines (over)inflation.
//The result will be stored in the alpha channel to be consumed by final pass.
float dy = global.flick_and_noise_passSize.w;
float inflation = PIXELGRID_INFLATION * 0.25 * dy * PIXELGRID_MAX_H;
vec3 gy = texture(Source, vec2(vTexCoord.x, vTexCoord.y + dy)).rgb
- texture(Source, vec2(vTexCoord.x, vTexCoord.y - dy)).rgb;
gy /=max_inLum;
float scanline_inflation = (gy.x+gy.y+gy.z) * (inflation*global.FinalViewportSize.y);
if (DO_IN_GLOW == 0.0) {
FragColor = vec4(texture(shift_and_bleed_pass, vTexCoord).rgb * vGlow_Gain, scanline_inflation);
return;
}
@ -144,10 +274,10 @@ void main() {
//It over the max sharp, then just passthrough, else do the blur.
if (glow_h_inside_interval == 1.0) {
pixel_glowed = blur_select_wrap(Source, vTexCoord, global.flick_and_noise_passSize, IN_GLOW_H_ADAPTED, (IN_GLOW_H >= 0.0) ) * vGlow_Gain;
//pixel_glowed = blur9_y(Source, vTexCoord, params.SourceSize.xy, IN_GLOW_H_ADAPTED) * vGlow_Gain;
pixel_glowed = blur_select_wrap(Source, vTexCoord, global.flick_and_noise_passSize, IN_GLOW_H_ADAPTED, (IN_GLOW_H >= 0.0) );
//pixel_glowed = blur9_y(Source, vTexCoord, params.SourceSize.xy, IN_GLOW_H_ADAPTED);
} else {
pixel_glowed = texture(Source, vTexCoord).rgb * vGlow_Gain;
pixel_glowed = texture(Source, vTexCoord).rgb;
}
@ -157,16 +287,8 @@ void main() {
//pixel_glowed = antialias_blur_bias(shift_and_bleed_pass, vTexCoord, pixel_glowed, IN_GLOW_BIAS);
}
//Previous pass compared previous and current source frame and exported that info in the alpha.
//Pass it through when we need delta rended.
if ( DELTA_RENDER == 1.0) {
float original_unchanged = texture(Source,vTexCoord).a;
FragColor = vec4(pixel_glowed, original_unchanged);
return;
}
FragColor = vec4(pixel_glowed,1.0);
FragColor = vec4(pixel_glowed * vGlow_Gain, scanline_inflation);
}

View File

@ -28,6 +28,9 @@ vec2 smoothstep_fast(vec2 edge0, vec2 edge1, vec2 x) {
return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
}
vec2 smoothstep_fast(float edge0, float edge1, vec2 x) {
return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
}
float smoothstep_cos(float edge0, float edge1, float x) {
float t = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
@ -210,7 +213,7 @@ vec3 PrintValueVec3( vec2 vStringCoords, vec2 FragCoord, float fValue, float fM
float circle_smooth(vec2 coords, vec2 middle, float f_radius, float FALLOFF) {
//Draw a circle with smoothed borders:
float fdistance=distance(middle, vec2(coords.x, coords.y));
float circle = (1-smoothstep(f_radius-FALLOFF, f_radius+FALLOFF, fdistance));
float circle = (1-smoothstep(f_radius, f_radius+FALLOFF, fdistance));
return circle;
}
@ -222,26 +225,29 @@ vec3 PrintValueVec3( vec2 vStringCoords, vec2 FragCoord, float fValue, float fM
}
float corners_shade(vec2 co, float size_multiplier){
//Draws 4 smooth squares or circles in the corners.
//They are intended to modulate the blur radius and the strength of the reflection.
//Draw 4 smooth squares or circles in the corners.
/*
vec4 circles;
float circle_radius = size; //0.13?
float circle_falloff = smoothsize; //0.05?
float circle_power =2.0;
circles.x = circle_smooth(co, vec2(0.0,0.0), circle_radius, circle_falloff) * circle_power;
circles.y = circle_smooth(co, vec2(0.0,1.0), circle_radius, circle_falloff) * circle_power;
circles.z = circle_smooth(co, vec2(1.0,0.0), circle_radius, circle_falloff) * circle_power;
circles.w = circle_smooth(co, vec2(1.0,1.0), circle_radius, circle_falloff) * circle_power;
#define GRAD_START (BEZEL_REFL_CORNER_BLANK_SIZE*size_multiplier)
#define GRAD_END (GRAD_START+BEZEL_REFL_CORNER_BLANK_SHADE*size_multiplier)
float gradient_start = (1-GRAD_END);
float gradient_end = (1-GRAD_START);
vec2 gradients = smoothstep_fast(gradient_start-0.5, gradient_end-0.5,abs(co-0.5));
float squares = gradients.x * gradients.y;
return squares;
float circle = max(max(max(circles.x, circles.y), circles.z), circles.w);
circle = min(circle, 1.0);
circle = 1-circle;
/*vec4 circles;
float circle_radius = BEZEL_REFL_CORNER_BLANK_SIZE * size_multiplier;
float circle_falloff = BEZEL_REFL_CORNER_BLANK_SHADE * size_multiplier;
circles.x = circle_smooth(co, vec2(0.0,0.0), circle_radius, circle_falloff) ;
circles.y = circle_smooth(co, vec2(0.0,1.0), circle_radius, circle_falloff) ;
circles.z = circle_smooth(co, vec2(1.0,0.0), circle_radius, circle_falloff) ;
circles.w = circle_smooth(co, vec2(1.0,1.0), circle_radius, circle_falloff) ;
float circle = dot(circles, vec4(1.0));
return circle;
*/
vec4 squares;
/*vec4 squares;
float squaresize = BEZEL_REFL_CORNER_BLANK_SIZE * size_multiplier;
float squarefade = BEZEL_REFL_CORNER_BLANK_SHADE * size_multiplier;
//(vec2 co, vec2 corner, float size, float smoothshade) {
@ -250,6 +256,7 @@ vec3 PrintValueVec3( vec2 vStringCoords, vec2 FragCoord, float fValue, float fM
squares.z = square_smooth(co, vec2(0.0, 1-squaresize), squaresize, squarefade);
squares.w = square_smooth(co, vec2(1-squaresize, 1-squaresize), squaresize, squarefade);
return max(max(max(squares.x, squares.y), squares.z), squares.w);
*/
}
//REFLECTION RELATED ENDS
@ -352,6 +359,53 @@ vec2 apply_fuzzy_main_pass_stage_1() {
return vec2(color_out/color_in, gamma_out );
}
vec2 apply_fuzzy_main_pass_stage_1_no_gamma_in() {
//This simulates the final pass pixel processing so that previous passes like
//reflections, full screen luminance zoom and ambient light
//can react accordingly without doing the same thing twice.
//For speed reasons, this lives in vertex shader and will output
//a vec2(mul factor, pow factor)
//in fragment shader one will pow(pow factor)*multiply factor;
float color_in = 1.0;
float color_out = 1.0;
float gamma_out = 1.0;
float halo_power_adapted;
halo_power_adapted = HALO_POWER;
if (HALO_NO_PREGAIN == 1.0) {
halo_power_adapted /= get_halo_ungain_factor();
}
if (HALO_POWER < 0.0)
halo_power_adapted = -halo_power_adapted/10.0;
if (DO_CCORRECTION == 1.0) {
color_out = pow(color_in, GAMMA_OUT); //<- nonsense
gamma_out = gamma_out * GAMMA_OUT;
color_out = color_out * IN_GLOW_POWER;
}
if (DO_PIXELGRID == 1.0) {
color_out *= 1- DO_PIXELGRID_H * 0.5 ; //Half color if scanline.
color_out *= 1- DO_PIXELGRID_W * 0.5 ; //Half color if Hmask.
color_out *= 1- PIXELGRID_Y_MASK * 0.2 ; //Strip at most 20% if level 2 ymask.
}
if (DO_HALO == 1.0) {
color_out += color_in*halo_power_adapted / HALO_GAMMA;
gamma_out = gamma_out * mix(1.0, HALO_GAMMA_OUT, halo_power_adapted*0.25) ;
}
if (DO_VIGNETTE == 1.0)
color_out *= 0.8 * (V_POWER);
return vec2(color_out/color_in, gamma_out );
}
@ -500,8 +554,12 @@ float apply_contrast_brightness(float c, float contrast, float brightness) {
return scale_to_range(c, -contrast, 1+contrast) + brightness;
}
float round_step(float f, float p) {
return floor(f*p)/p;
float round_step(float x, float p) {
return round(x*p)/p;
}
vec2 round_step(vec2 x, vec2 p) {
return round(x*p)/p;
}
#define VEC2_RND_A_B vec2(12.9898, 78.233)
@ -551,14 +609,18 @@ float random_fast(vec2 seed) {
//CURVATURE
float curvature_needed() {
return DO_CURVATURE * (GEOM_WARP_X + GEOM_WARP_Y);
}
#define corner_aspect vec2(1.0, 0.75)
float fn_border(vec2 coord) {
coord = (coord - vec2(0.5)) + vec2(0.5, 0.5);
coord = min(coord, vec2(1.0) - coord) * corner_aspect;
vec2 cdist = vec2(GEOM_CORNER_SIZE);
coord = (cdist - min(coord, cdist));
float dist = sqrt(dot(coord, coord));
return clamp((cdist.x - dist)*GEOM_CORNER_SMOOTH, 0.0, 1.0);
coord = min(coord, vec2(1.0) - coord) ; //* corner_aspect;
coord = GEOM_CORNER_SIZE - min(coord, GEOM_CORNER_SIZE);
float dist = length(coord);
return clamp( ((GEOM_CORNER_SIZE - dist) + 0.75/GEOM_CORNER_SMOOTH ) * GEOM_CORNER_SMOOTH, 0.0, 1.0);
}
float border(vec2 coord) {
@ -814,32 +876,50 @@ float random_fast(vec2 seed) {
return BEZEL_INNER_ZOOM * float( !need_integer_scale() );
}
vec2 content_geom_override(vec2 co, float aspect, float in_aspect, float vshift, float hshift, float out_zoom){
//cheap cardboard emulation:
//co = co*2.0 - vec2(0.0,0.5);
//if (co.x > 1.0) co.x -= 1;
vec2 content_geom_override_shift(vec2 co, float aspect, float in_aspect, float vshift, float hshift, float out_zoom){
//Aspect (ASM PROOF: IFTHEN is better)
//shift
vec2 shift = round_step(vec2(hshift, vshift)*0.1, params.OriginalSize.xy);
co -= shift;
return co;
}
vec2 content_geom_override_zoom(vec2 co, float aspect, float in_aspect, float vshift, float hshift, float out_zoom){
// see next (**)
float scale_y;
if (aspect > 0.01)
scale_y = aspect/in_aspect;
else
scale_y = 1.0;
//Unbranched previous:
//float bUse_custom_aspect = float(aspect > 0.01);
//float bUse_custom_aspect = step(0.01, aspect);
//scale_y = mix_step(1.0, aspect/in_aspect, bUse_custom_aspect );
float offset_y = (0.5 * scale_y ) - 0.5 ;
co.y = co.y*scale_y - offset_y;
//zoom
return zoom(co, out_zoom);
}
vec2 content_geom_override_zoom_inv(vec2 co, float aspect, float in_aspect, float vshift, float hshift, float out_zoom){
// (**) This has to be exactly has the not _inv version, it returns the same but with zoom counteracted, inverted.
float scale_y;
if (aspect > 0.01)
scale_y = aspect/in_aspect;
else
scale_y = 1.0;
float offset_y = (0.5 * scale_y ) - 0.5 ;
co.y = co.y*scale_y - offset_y;
//shift
co.y -= vshift/10.0;
co.x -= hshift/10.0;
//zoom
return zoom(co, out_zoom);
return zoom(co, 1/out_zoom);
}
vec2 content_geom_override(vec2 co, float aspect, float in_aspect, float vshift, float hshift, float out_zoom){
//cheap cardboard emulation:
//co = co*2.0 - vec2(0.0,0.5);
//if (co.x > 1.0) co.x -= 1;
vec2 co_shifted = content_geom_override_shift( co, aspect, in_aspect, vshift, hshift, out_zoom);
vec2 co_shifted_zoomed = content_geom_override_zoom( co_shifted, aspect, in_aspect, vshift, hshift, out_zoom);
return co_shifted_zoomed;
}
//Blur/Glow
@ -1116,8 +1196,27 @@ vec3 rgb2hsv(vec3 c){
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + eps10)), d / (q.x + eps10), q.x);
}
vec2 rgb2hv(vec3 c) {
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
return vec2(abs(q.z + (q.w - q.y) / (6.0 * d + 0.0001)), q.x);
}
float get_dyn_zoom(sampler2D tex) {
if (DELTA_RENDER == 0.0)
return texture(tex, vec2(0.75,0.75)).a * DO_DYNZOOM + 1.0 ;
else
return 1.0;
}
float get_autocrop_zoom(sampler2D tex) {
if (DELTA_RENDER == 0.0)
return texture(tex, AUTOCROP_SAMPLING_POINT).a;
else
return 1.0;
}
@ -1468,4 +1567,33 @@ vec3 adaptive_strobe_checkerboard(vec3 pixel_out, vec2 co, vec2 outputsize) {
}
vec2 r2(vec2 p0, int n) {
//return fract(p0 + float(n)*vec2(0.754877669, 0.569840296));
return fract(p0 + vec2(n*12664745, n*9560333)/exp2(24.)); // integer mul to avoid round-off
}
float lodmax(vec2 texsize) {
//lod needed to average all texture points.
return log2(max(texsize.x, texsize.y));
}
float is_deltarender_allowed(bool is_interlaced) {
// Delta render, mandatory conditions:
return float( ( params.FrameCount % int(DELTA_RENDER_FORCE_REFRESH) != 0.0 ) && // - We are in a frame that is not forced for full refresh
( (! is_interlaced) || PIXELGRID_INTR_DISABLE_Y >= 1.0 || DO_PIXELGRID_H == 0.0)); // - screen is not interlaced or we disabled scanlines on interlaced content
}
float delta_render_unchanged(sampler2D mip_past, sampler2D mip_now, vec2 co, float lod) {
vec3 p1 = textureLod(mip_now, co, lod).rgb;
vec3 p2 = textureLod(mip_past, co, lod).rgb;
return float(p1 == p2)*1000.0;
// ^^ we mul by 1000 because glow_y will sample this alpha and will multiplex it with the
// inflation/warp_y value.
// multiplying by 1000 will allow the final pass to understand if is a deltarender value or an inflation one.
// The number has to be high, to avoid lerp issues.
}
float max3(vec3 v){
return max((v.x,v.y),v.z);
}

View File

@ -0,0 +1,138 @@
#version 450
#include "config.inc"
#define eps 1e-8
#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 vec2 vTexCoord_zoom;
#include "functions.include.slang"
void main()
{
gl_Position = global.MVP * Position;
vTexCoord = TexCoord;
vTexCoord_zoom = TexCoord;
if (DO_BEZEL==1.0 && BEZEL_INNER_ZOOM !=0.0) vTexCoord_zoom = zoomout_coords(TexCoord, -BEZEL_INNER_ZOOM , 1.0);
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 1) in vec2 vTexCoord_zoom;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Original;
layout(set = 0, binding = 3) uniform sampler2D main_pass;
layout(set = 0, binding = 4) uniform sampler2D isrotated_pass;
bool border_updown(){
//Return if black bars are up and down or left and right.
//Why this one work?
return ((params.OriginalSize.x > params.OriginalSize.y) && (global.main_passSize.x < global.main_passSize.y )) ||
(params.OriginalSize.x < params.OriginalSize.y) && (global.main_passSize.x > global.main_passSize.y ) ;
}
vec3 main_wrap(){
float myborder = 0.025; //20% border to be displaced
vec2 newcoords = vTexCoord_zoom;
vec3 pixel_out;
float mydiv;
float myoffset;
if (!border_updown()) {
mydiv = vTexCoord.x / myborder;
myoffset = (1.0-myborder) * floor(mydiv);
if (vTexCoord.x < 0.5)
newcoords.x = newcoords.x - ( myborder * floor(mydiv) ) ;
else
newcoords.x = (1 - myborder) + ( newcoords.x - (myborder*floor(mydiv)) ) ;
return texture(Original, newcoords).rgb;
}
//Is rotated
mydiv = vTexCoord.y / myborder;
myoffset = (1.0-myborder) * floor(mydiv);
if (vTexCoord.y < 0.5)
newcoords.y = newcoords.y - ( myborder * floor(mydiv) ) ;
else
newcoords.y = (1 - myborder) + ( newcoords.y - (myborder*floor(mydiv)) ) ;
return texture(Original, newcoords).rgb;
}
#include "functions.include.slang"
float mborder(vec2 coord,float aspect,float corner_size, float corner_smooth) {
coord = (coord - vec2(0.5)) + vec2(0.5, 0.5);
coord = min(coord, vec2(1.0) - coord) * aspect;
vec2 cdist = vec2(corner_size);
coord = (cdist - min(coord, cdist));
float dist = sqrt(dot(coord, coord));
return clamp((cdist.x - dist)*corner_smooth, 0.0, 1.0);
}
vec2 bget_scaled_coords(vec2 pTexCoord, vec4 destsize){
if (!border_needed()) return pTexCoord;
//else
float scale_x = 1.0;
float scale_y = 1.0;
float offset_x = 0.0 ;
float offset_y = 0.0 ;
float in_aspect = get_in_aspect();
if (is_rotated()) {
//scale_y = params.OutputSize.y/(params.OutputSize.x / in_aspect );
//scale_y = global.FinalViewportSize.y/(global.FinalViewportSize.x / in_aspect );
scale_y = destsize.y/(destsize.x / in_aspect );
offset_y = (0.5 * scale_y ) - 0.5 ;
} else {
//scale_x = params.OutputSize.x/(params.OutputSize.y * in_aspect);
//scale_x = global.FinalViewportSize.x/(global.FinalViewportSize.y * in_aspect);
scale_x = destsize.x/(destsize.y * in_aspect);
offset_x = (0.5 * scale_x ) - 0.5 ;
}
vec2 scale_coord=vec2(pTexCoord.x*scale_x - offset_x , pTexCoord.y*scale_y - offset_y);
return scale_coord;
}
void main() {
if (DO_AMBILIGHT != 1.0) return;
//bool is_rotated = texture(isrotated_pass,vec2(0.5,0.5)).r > 0.5;
//Disegna un rettangolo sul gioco.
//samplo main_pass per riferimento.
vec4 pixel_Original = texture(Original,vTexCoord);
FragColor = pixel_Original;
/*
float dist = 1-length(vTexCoord-0.5);
FragColor = vec4(main_wrap(),1.0);
float corner_size = 0.25;
float corner_smooth = 4.0;
float zoom = 0.4;
vec2 co = get_scaled_coords(zoomout_coords(vTexCoord, -zoom , 1.0),global.FinalViewportSize);
float ss=pow(mborder(co,1.0,corner_size, corner_smooth),2.0);
//ss = ss * smoothstep(shade_end,shade_start, vTexCoord.x);
FragColor = vec4(ss);
vec2 ccords = get_scaled_coords(vTexCoord,global.FinalViewportSize);
ccords = zoomout_coords(ccords,-BEZEL_INNER_ZOOM,1.0);
//FragColor = texture(Original,ccords)*ss;
*/
}

View File

@ -0,0 +1,61 @@
#version 450
#include "config.inc"
#define eps 1e-8
#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 vec2 vOutputCoord;
#include "functions.include"
void main() {
gl_Position = global.MVP * Position;
vTexCoord = get_scaled_coords(TexCoord);
vOutputCoord = TexCoord;
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 1) in vec2 vOutputCoord;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D final_pass;
layout(set = 0, binding = 4) uniform sampler2D ambi_temporal_pass;
#include "functions.include"
vec4 pixel_border() {
vec3 ambi = texture(ambi_temporal_pass, vOutputCoord).rgb;
float l = length(ambi);
float sat = 1.25;
float bright = 1.25;
ambi = normalize( pow(ambi.rgb + vec3(eps), vec3(sat)))*l * bright ;
ambi*=bright;
return vec4(ambi,0.0);
}
vec3 ambi_noised() {
return pixel_border().rgb + random();
}
void main() {
vec4 psample = texture(final_pass, vOutputCoord);
if (DO_AMBILIGHT == 1) {
vec3 ambinoised = ambi_noised();
if (is_outer_frame(psample)) {
FragColor = mark_outer_frame(ambi_noised());
} else {
FragColor = vec4(mix(ambinoised.rgb,psample.rgb,min(psample.a*1.5,1.0)),psample.a);
}
} else {
FragColor = psample ;
}
//FragColor = vec4(ambi_noised(), 1.0);
}

View File

@ -0,0 +1,28 @@
#version 450
#include "config.inc"
#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() {
if (DO_AMBILIGHT == 1.0)
FragColor = texture(Source, vTexCoord);
else
return;
}

View File

@ -0,0 +1,33 @@
#version 450
/* This pass apply an pre-gain to the leds on the rear of the virtual screen
* it is intended to produce a mipmap to be used by the next pass */
#include "config.inc"
#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 first_pass;
#include "includes/functions.include.slang"
void main() {
if (DO_AMBILIGHT != 1.0) return;
vec3 pixel_out = texture(first_pass, vTexCoord).rgb;
pixel_out = apply_fuzzy_main_pass(pixel_out);
pixel_out = pixel_push_luminance(pixel_out, AMBI_POWER-1);
FragColor = vec4(pixel_out, 1.0);
}

View File

@ -0,0 +1,36 @@
#version 450
#include "config.inc"
#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 main_pass;
void main() {
vec2 coords = vTexCoord;
if (DO_BLOOM == 1) {
if (DO_CURVATURE == 1.0) {
if ((GEOM_WARP_X > 0.0) || (GEOM_WARP_Y > 0.0))
coords = Warp(vTexCoord,GEOM_WARP_X,GEOM_WARP_Y);
}
FragColor = texture(main_pass,coords);
return;
} else {
//No bloom requested
return;
}
}

View File

@ -0,0 +1,12 @@
vec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction, float lod) {
vec4 color = vec4(0.0);
vec2 off1 = vec2(1.3846153846) * direction;
vec2 off2 = vec2(3.2307692308) * direction;
color += textureLod(image, uv, lod) * 0.2270270270;
color += textureLod(image, uv + (off1 / resolution), lod) * 0.3162162162;
color += textureLod(image, uv - (off1 / resolution), lod) * 0.3162162162;
color += textureLod(image, uv + (off2 / resolution), lod) * 0.0702702703;
color += textureLod(image, uv - (off2 / resolution), lod) * 0.0702702703;
return color;
}

View File

@ -0,0 +1,226 @@
#version 450
#include "config.inc"
/*
CRT Shader by EasyMode
License: GPL
Modified by kokoko3k, stripped to keep just curvature related code.
*/
#define FIX(c) max(abs(c), 1e-5)
#define PI 3.141592653589
#define TEX2D(c) texture(tex, c)
#define in_texture final_pass
#define in_textureSize final_passSize
//#define in_textureSize SourceSize
#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 vec2 vOutputCoord;
#include "functions.include"
void main() {
gl_Position = global.MVP * Position;
vTexCoord = get_scaled_coords(TexCoord);
vOutputCoord = TexCoord;
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 1) in vec2 vOutputCoord;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D in_texture;
float curve_distance(float x, float sharp)
{
float x_step = step(0.5, x);
float curve = 0.5 - sqrt(0.25 - (x - x_step) * (x - x_step)) * sign(0.5 - x);
return mix(x, curve, sharp);
}
mat4x4 get_color_matrix(sampler2D tex, vec2 co, vec2 dx)
{
return mat4x4(TEX2D(co - dx), TEX2D(co), TEX2D(co + dx), TEX2D(co + 2.0 * dx));
}
vec4 filter_lanczos(vec4 coeffs, mat4x4 color_matrix)
{
vec4 col = color_matrix * coeffs;
vec4 sample_min = min(color_matrix[1], color_matrix[2]);
vec4 sample_max = max(color_matrix[1], color_matrix[2]);
col = clamp(col, sample_min, sample_max);
return col;
}
vec2 curve_coordinate(vec2 co, float curvature_x, float curvature_y)
{
vec2 curve = vec2(curvature_x, curvature_y);
vec2 co2 = co + co * curve - curve / 2.0;
vec2 co_weight = vec2(co.y, co.x) * 2.0 - 1.0;
co = mix(co, co2, co_weight * co_weight);
return co;
}
float get_corner_weight(vec2 co, vec2 corner, float smoothfunc)
{
float corner_weight;
co = min(co, vec2(1.0) - co) * vec2(1.0, 0.75);
co = (corner - min(co, corner));
corner_weight = clamp((corner.x - sqrt(dot(co, co))) * smoothfunc, 0.0, 1.0);
corner_weight = mix(1.0, corner_weight, ceil(corner.x));
return corner_weight;
}
#define GEOM_ANTIALIAS 1.0
vec3 curve_antialias(vec2 xy,vec2 tex_size){
vec2 midpoint = vec2(0.5, 0.5);
vec2 co = vOutputCoord * tex_size * params.in_textureSize.zw;
vec2 co2 = vTexCoord * tex_size * params.in_textureSize.zw;
vec3 col;
float corner_weight = get_corner_weight(curve_coordinate(co2, GEOM_BORDER_WX, GEOM_BORDER_WY ), vec2(GEOM_CORNER_SIZE), GEOM_CORNER_SMOOTH);
if ( (GEOM_WARP_X > 0) || (GEOM_WARP_Y > 0) ) {
xy *= params.in_textureSize.xy / tex_size;
vec2 dx = vec2(1.0 / tex_size.x, 0.0);
vec2 dy = vec2(0.0, 1.0 / tex_size.y);
vec2 pix_co = xy * tex_size - midpoint;
vec2 tex_co = (floor(pix_co) + midpoint) / tex_size;
vec2 dist = fract(pix_co);
float curve_x, curve_y;
vec3 col2, diff;
curve_x = curve_distance(dist.x, SHARPNESS_H * SHARPNESS_H);
curve_y = curve_distance(dist.y, SHARPNESS_V * SHARPNESS_V);
vec4 coeffs_x = PI * vec4(1.0 + curve_x, curve_x, 1.0 - curve_x, 2.0 - curve_x);
vec4 coeffs_y = PI * vec4(1.0 + curve_y, curve_y, 1.0 - curve_y, 2.0 - curve_y);
coeffs_x = FIX(coeffs_x);
coeffs_x = 2.0 * sin(coeffs_x) * sin(coeffs_x / 2.0) / (coeffs_x * coeffs_x);
coeffs_x /= dot(coeffs_x, vec4(1.0));
coeffs_y = FIX(coeffs_y);
coeffs_y = 2.0 * sin(coeffs_y) * sin(coeffs_y / 2.0) / (coeffs_y * coeffs_y);
coeffs_y /= dot(coeffs_y, vec4(1.0));
mat4x4 color_matrix;
color_matrix[0] = filter_lanczos(coeffs_x, get_color_matrix(in_texture, tex_co - dy, dx));
color_matrix[1] = filter_lanczos(coeffs_x, get_color_matrix(in_texture, tex_co, dx));
color_matrix[2] = filter_lanczos(coeffs_x, get_color_matrix(in_texture, tex_co + dy, dx));
color_matrix[3] = filter_lanczos(coeffs_x, get_color_matrix(in_texture, tex_co + 2.0 * dy, dx));
col = filter_lanczos(coeffs_y, color_matrix).rgb;
} else {
col = texture(in_texture, vOutputCoord).rgb;
}
col *= vec3(corner_weight);
return col;
}
vec2 Warp2(vec2 texCoord){
vec2 curvedCoords = texCoord * 2.0 - 1.0;
vec2 CRT_Distortion = vec2(GEOM_WARP_X, GEOM_WARP_Y) * 15.;
float curvedCoordsDistance = sqrt(curvedCoords.x*curvedCoords.x+curvedCoords.y*curvedCoords.y);
curvedCoords = curvedCoords / curvedCoordsDistance;
curvedCoords = curvedCoords * (1.0-pow(vec2(1.0-(curvedCoordsDistance/1.4142135623730950488016887242097)),(1.0/(1.0+CRT_Distortion*0.2))));
curvedCoords = curvedCoords / (1.0-pow(vec2(0.29289321881345247559915563789515),(1.0/(vec2(1.0)+CRT_Distortion*0.2))));
curvedCoords = curvedCoords * 0.5 + 0.5;
return curvedCoords;
}
vec3 do_curvature_antialias(){
vec2 tex_size = params.in_textureSize.xy ;
vec2 co = vOutputCoord * tex_size * params.in_textureSize.zw;
vec2 co2 = vTexCoord * tex_size * params.in_textureSize.zw;
vec2 curved_xy = curve_coordinate(co, GEOM_WARP_X,GEOM_WARP_Y );
vec3 col;
//float corner_weight = get_corner_weight(curve_coordinate(co2, GEOM_BORDER_WX, GEOM_BORDER_WY ), vec2(GEOM_CORNER_SIZE), GEOM_CORNER_SMOOTH);
float corner_weight = get_corner_weight(Warp2(co), vec2(GEOM_CORNER_SIZE), GEOM_CORNER_SMOOTH);
if ( (GEOM_WARP_X > 0) || (GEOM_WARP_Y > 0) ) {
if (GEOM_ANTIALIAS == 1.0)
col = curve_antialias(curved_xy,tex_size);
else
col = texture(in_texture,curved_xy).rgb;
} else {
col = texture(in_texture, vOutputCoord).rgb;
}
col *= vec3(corner_weight) ;
return col;
}
const vec2 corner_aspect = vec2(1.0, 0.75);
float corner2(vec2 coord)
{
coord = (coord - vec2(0.5)) + vec2(0.5, 0.5);
coord = min(coord, vec2(1.0) - coord) * corner_aspect;
vec2 cdist = vec2(GEOM_CORNER_SIZE);
coord = (cdist - min(coord, cdist));
float dist = sqrt(dot(coord, coord));
return clamp((cdist.x - dist)*GEOM_CORNER_SMOOTH, 0.0, 1.0);
}
vec3 do_curvature_alias(){
vec2 curved_xy = Warp2(vOutputCoord);
return texture(in_texture,curved_xy ).rgb * corner2(curved_xy);
}
vec4 main_wrap()
{
if (DO_CURVATURE == 1.0) {
return vec4(do_curvature_antialias(), 1.0);
} else {
return texture(in_texture, vOutputCoord);
}
}
#include "functions.include"
void main() {
vec4 psample = texture(in_texture, vOutputCoord);
if ( border_needed() ) {
if (is_outer_frame(psample))
FragColor = mark_outer_frame(vec3(0.0));
else
FragColor = main_wrap();
} else {
FragColor = main_wrap();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,59 @@
#version 450
#include "config.inc"
#define pi 3.141592654
// Blur sizes must not depend on input resolution
#define scalemod_x (global.in_glow_passSize.x/360.0)
#define scalemod_y (global.in_glow_passSize.y/270.0)
#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 vec2 vOutputCoord;
void main() {
gl_Position = global.MVP * Position;
//vTexCoord = get_scaled_coords(TexCoord);
vTexCoord = TexCoord;
vOutputCoord = TexCoord;
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 1) in vec2 vOutputCoord;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D FXAA_pass;
layout(set = 0, binding = 3) uniform sampler2D first_pass;
layout(set = 0, binding = 4) uniform sampler2D in_glow_pass;
layout(set = 0, binding = 5) uniform sampler2D shift_and_bleed_pass;
#include "includes/pixel_glows.include.slang"
vec4 main_wrap(void) {
//Halo
vec3 pixel_haloed;
vec2 halo_coords = vTexCoord;
if (DO_IN_GLOW == 1.0)
pixel_haloed = pixel_glow(in_glow_pass, HALO_W, HALO_H, HALO_POWER, HALO_GAMMA, halo_coords, global.FXAA_passSize, global.FXAA_passSize).rgb;
else if ( DO_SHIFT_RGB + DO_SAT_BLEED > 0.0)
pixel_haloed = pixel_glow(shift_and_bleed_pass, HALO_W, HALO_H, HALO_POWER, HALO_GAMMA, halo_coords, global.FXAA_passSize, global.FXAA_passSize).rgb;
else if (DO_FXAA > 0.0)
pixel_haloed = pixel_glow(FXAA_pass, HALO_W, HALO_H, HALO_POWER, HALO_GAMMA, halo_coords, global.FXAA_passSize, global.FXAA_passSize).rgb;
else
pixel_haloed = pixel_glow(first_pass, HALO_W, HALO_H, HALO_POWER, HALO_GAMMA, halo_coords, global.FXAA_passSize, global.FXAA_passSize).rgb;
return vec4(pixel_haloed.rgb,1.0);
}
void main() {
if (DO_HALO == 0.0 ) return;
FragColor = main_wrap();
}

View File

@ -0,0 +1,126 @@
#version 450
#include "config.inc"
#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 = 3) uniform sampler2D FXAA_pass;
layout(set = 0, binding = 4) uniform sampler2D first_pass;
layout(set = 0, binding = 5) uniform sampler2D shift_and_bleed_pass;
// Blur sizes must not depend on input resolution
#define scalemod_x (params.OutputSize.x/360.0)
#define scalemod_y (params.OutputSize.y/270.0)
#include "includes/pixel_glows.include.slang"
vec3 glow_blur_bias_smother_bloomer(sampler2D source_tex, vec2 co, vec3 pixel_glowed, float bias) {
//Modulates the mix of the blurred version over the sharp one
//by the luminosity difference of the blurred version and the original
vec3 pixel_original = texture(source_tex,vTexCoord).rgb;
vec3 pixel_sharp = pow(pixel_original,vec3(IN_GLOW_GAMMA)) * IN_GLOW_POWER;
vec3 pixel_glowed_c = clamp(pixel_glowed, 0.0, 1.0);
vec3 pixel_sharp_c = clamp(pixel_sharp, 0.0, 1.0);
vec3 vmix = vec3( pixel_glowed_c.r - pixel_original.r,
pixel_glowed_c.g - pixel_original.g,
pixel_glowed_c.b - pixel_original.b);
vmix += IN_GLOW_BIAS;
vmix = clamp(vmix, 0.0, 1.0);
vmix *= vmix;
return mix(pixel_sharp, pixel_glowed, vmix );
//return mix(pixel_sharp, pixel_glowed, clamp( (vmix+0.01 * vInGlowBias) , 0.0,1.0) );
//return pixel_sharp + pixel_glowed*clamp( (vmix+0.01 * vInGlowBias) , 0.0,1.0);
}
vec3 glow_blur_bias_sharper_AA(sampler2D source_tex, vec2 co, vec3 pixel_glowed, float bias) {
//from latitude. with pow.
vec3 pixel_source = texture(source_tex, co).rgb;
pixel_source = pow(pixel_source,vec3(IN_GLOW_GAMMA)) * IN_GLOW_POWER;
float glowlum = max(max(pixel_glowed.r, pixel_glowed.g), pixel_glowed.b);
float orilum = max(max(pixel_source.r, pixel_source.g), pixel_source.b);
glowlum = clamp(glowlum, 0.0, 1.0);
orilum = clamp(orilum, 0.0, 1.0);
float g_mix = (glowlum - orilum);
g_mix += IN_GLOW_BIAS;
g_mix = clamp(g_mix, 0.0, 1.0);
g_mix *= g_mix ;
return mix(pixel_source, pixel_glowed, g_mix);
}
vec3 glow_blur_bias(sampler2D source_tex, vec2 co, vec3 pixel_glowed, float bias){
vec3 pixel_source = texture(source_tex, co).rgb;
pixel_source = pow(pixel_source,vec3(IN_GLOW_GAMMA)) * IN_GLOW_POWER;
vec3 glow_light = clamp((pixel_glowed - pixel_source) * IN_GLOW_SPREAD, 0.0, 1.0);
/* powering glow_light is fine when not dealing with scanline minimum thickness,
* but then the scanline shape gets smaller, it kinda produces a visive
* pow(x,2) by its own; in that case powering glow_light make things worse.
* It makes sense, because we are emulating the light spread twice.
* FIXME: How to deal with this?
*/
vec3 proper_glow = glow_light * glow_light + pixel_source;
return mix(proper_glow, pixel_glowed, max(0.0, bias));
/*if (IN_GLOW_W < 0.99)
return glow_blur_bias_sharper_AA( source_tex, co, pixel_glowed, bias);
else
return glow_blur_bias_smother_bloomer( source_tex, co, pixel_glowed, bias);
*/
}
void main() {
if (DO_IN_GLOW == 0.0) return;
vec3 pixel_glowed;
if ( DO_SHIFT_RGB + DO_SAT_BLEED > 0.0) {
pixel_glowed = pixel_glow(shift_and_bleed_pass, IN_GLOW_W, IN_GLOW_H, IN_GLOW_POWER, IN_GLOW_GAMMA, vTexCoord, params.OutputSize, params.OutputSize).rgb;
if (IN_GLOW_BIAS < IN_GLOW_BIAS_MAX && (IN_GLOW_W < GLOW_SHARP_MAX || IN_GLOW_H < GLOW_SHARP_MAX) )
pixel_glowed = glow_blur_bias(shift_and_bleed_pass, vTexCoord, pixel_glowed, IN_GLOW_BIAS);
}
else if (DO_FXAA > 0.0) {
pixel_glowed = pixel_glow(FXAA_pass, IN_GLOW_W, IN_GLOW_H, IN_GLOW_POWER, IN_GLOW_GAMMA, vTexCoord, params.OutputSize, params.OutputSize).rgb;
if (IN_GLOW_BIAS < IN_GLOW_BIAS_MAX && (IN_GLOW_W < GLOW_SHARP_MAX || IN_GLOW_H < GLOW_SHARP_MAX) )
pixel_glowed = glow_blur_bias(FXAA_pass, vTexCoord, pixel_glowed, IN_GLOW_BIAS);
}
else {
pixel_glowed = pixel_glow(first_pass, IN_GLOW_W, IN_GLOW_H, IN_GLOW_POWER, IN_GLOW_GAMMA, vTexCoord, params.OutputSize, params.OutputSize).rgb;
if (IN_GLOW_BIAS < IN_GLOW_BIAS_MAX && (IN_GLOW_W < GLOW_SHARP_MAX || IN_GLOW_H < GLOW_SHARP_MAX) )
pixel_glowed = glow_blur_bias(first_pass, vTexCoord, pixel_glowed, IN_GLOW_BIAS);
}
FragColor = vec4((pixel_glowed),1.0);
}

View File

@ -0,0 +1,33 @@
#version 450
#include "config.inc"
#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 float mark_color_rotated;
#include "includes/functions.include.slang"
void main()
{
gl_Position = global.MVP * Position;
vTexCoord = TexCoord;
if (is_rotated())
mark_color_rotated = 1.0;
else
mark_color_rotated = 0.0;
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 1) in float mark_color_rotated;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source;
void main() {
FragColor.r = mark_color_rotated;
}

View File

@ -0,0 +1,323 @@
#version 450
#include "config.inc"
#define half_pi 1.5707963267949
// RGB mask: R G B
#define m1 vec3 ( 1.0 , 0.0 , 0.0 ) //col 1
#define m2 vec3 ( 0.0 , 1.0 , 0.0 ) //col 2
#define m3 vec3 ( 0.0 , 0.0 , 1.0 ) //col 3
// RGB mask low dpi (green-magenta, exploiting native rgb subpixels)
#define m1gm vec3 ( 0.0 , 1.0 , 0.0 ) //col 1
#define m2gm vec3 ( 1.0 , 0.0 , 1.0 ) //col 2
// Blur sizes must not depend on input resolution
#define scalemod_x (global.in_glow_passSize.x/360.0)
#define scalemod_y (global.in_glow_passSize.y/270.0)
#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 vec2 vOutputCoord;
#include "includes/functions.include.slang"
void main() {
gl_Position = global.MVP * Position;
vTexCoord = get_scaled_coords(TexCoord,global.FinalViewportSize, is_rotated());
vOutputCoord = TexCoord;
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 1) in vec2 vOutputCoord;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 3) uniform sampler2D FXAA_pass;
layout(set = 0, binding = 4) uniform sampler2D in_glow_pass;
layout(set = 0, binding = 5) uniform sampler2D halo_pass;
layout(set = 0, binding = 6) uniform sampler2D first_pass;
layout(set = 0, binding = 7) uniform sampler2D avglum_passFeedback;
#include "includes/functions.include.slang"
vec3 pixel_vmask(vec3 source, vec3 white_reference, float over_white) {
int col = int( vOutputCoord.x * params.OutputSize.x );
vec3 pixel_out;
vec3 vmasked;
vec4 vec_mod=(vec4(3,1,2,3) + vec4(VMASK_GAP,0.0,0.0,0.0))* VMASK_DARKLINE_SCALE ;
float mask_lightness = 1.0 - RGB_MASK_STRENGTH;
if ( mod(col, vec_mod.x) < vec_mod.y) vmasked = min(m1 + mask_lightness,vec3(1.0)) * source;
else if (mod(col, vec_mod.x) < vec_mod.z) vmasked = min(m2 + mask_lightness,vec3(1.0)) * source;
else if (mod(col, vec_mod.x) < vec_mod.w) vmasked = min(m3 + mask_lightness,vec3(1.0)) * source;
else vmasked = min(vec3(0.0) + mask_lightness,vec3(1.0)) * source;
if (over_white == 1.0) pixel_out = vmasked;
else {
float whiteness=(white_reference.r+white_reference.g+white_reference.b)/3.0;
whiteness-= over_white;
whiteness= clamp(whiteness,0.0,1.0);
pixel_out= mix(vmasked,source,whiteness);
}
return pixel_out;
}
vec3 pixel_vmask_gm(vec3 source, vec3 white_reference, float over_white) {
int col = int( vOutputCoord.x * params.OutputSize.x );
vec3 pixel_out;
vec3 vmasked;
vec3 vec_mod=(vec3(2,1,2) + vec3(VMASK_GAP,0.0,0.0))* VMASK_DARKLINE_SCALE ;
float mask_lightness = 1.0 - RGB_MASK_STRENGTH;
if (mod(col, vec_mod.x) < vec_mod.y) vmasked = min(m1gm + mask_lightness,vec3(1.0)) * source;
else if (mod(col, vec_mod.x) < vec_mod.z) vmasked = min(m2gm + mask_lightness,vec3(1.0)) * source;
else vmasked = min(vec3(0.0) + mask_lightness,vec3(1.0)) * source;
if (over_white == 1.0) pixel_out = vmasked;
else {
float whiteness=(white_reference.r+white_reference.g+white_reference.b)/3.0;
whiteness-= over_white;
whiteness= clamp(whiteness,0.0,1.0);
pixel_out= mix(vmasked,source,whiteness);
}
return pixel_out;
}
vec3 pixel_darklines(vec3 source,float darkline_every, float darkline_trans,
float do_offset, vec3 white_reference,float over_white) {
float Darkline_part_w = (3.0 - VMASK_USE_GM + VMASK_GAP) * VMASK_DARKLINE_SCALE;
float Darkline_part_w_x2 = Darkline_part_w*2;
//vec3 pixel_out=source;
float col_2 = vOutputCoord.x * params.OutputSize.x;
float line_2 = vOutputCoord.y * params.OutputSize.y;
darkline_every *= VMASK_DARKLINE_SCALE;
if (over_white != 1.0) {
//less effect on bright colors.
float whiteness=(white_reference.r+white_reference.g+white_reference.b)/3.0;
darkline_trans+=(whiteness-over_white);
darkline_trans=clamp(darkline_trans,0.0,1.0);
}
if (do_offset == 1.0) {
if (int(mod(line_2, darkline_every)) < VMASK_DARKLINE_SCALE) {
if (int(mod(col_2, Darkline_part_w_x2)) < Darkline_part_w) return source * darkline_trans;
} else if (int(mod(line_2+(darkline_every/2), darkline_every)) < VMASK_DARKLINE_SCALE ) {
// DRAW WITH OFFSET:
col_2+=Darkline_part_w;
if ((int(mod(col_2, Darkline_part_w_x2))) < Darkline_part_w)
return source * darkline_trans;
}
} else {
if ( darkline_every >= 0.0)
if (int(mod(line_2, darkline_every)) < VMASK_DARKLINE_SCALE) return source * darkline_trans;
}
return source;
}
/*
float scanline_shape_static_in_lum(vec2 coords, float in_luminance) {
// Modulate scanline weight via in_luminance
float period = (params.OriginalSize.y > MIN_LINES_INTERLACED ) ? 2 : 1 ;
float angle = coords.y * pi * period * params.OriginalSize.y ;
float lines = abs(sin(angle));
lines=clamp(lines, SCANLINE_DARK,1.0);
lines = (lines*lines);
float w = (SCANLINES_BLEEDING * 9.0 * in_luminance +1 ); // + SCANLINES_BLEEDING;
lines = pow(lines,1.0/ w );
return lines;
}
*/
/*
float scanline_shape_dumb(vec2 coords, bool do_flicker) {
float source_dy = global.first_passSize.w ;
if ( mod(coords.y, source_dy*2) < source_dy ) {
return 1.0;
}
return 0.0;
}
*/
float scanline_shape(vec2 coords, bool do_flicker) {
bool alternate = false;
float period = 1.0;
int slow = 1;
if (do_flicker) {
if (params.FrameCount/slow % 2 == 0.0) alternate = true;
if (params.OriginalSize.y > MIN_LINES_INTERLACED ) period = 0.5;
}
float angle = coords.y * pi * params.OriginalSize.y * period;
float lines;
if (alternate)
lines = -sin(angle+half_pi); //lines = abs(cos(angle));
else
lines = sin(angle);
lines = (lines*lines);
if (SCANLINE_DARK >= 0.0) {
lines = lines * (1.0 - SCANLINE_DARK) + SCANLINE_DARK;
} else {
float deepness = -SCANLINE_DARK;
lines = lines * ((1-SCANLINE_DARK) ) + SCANLINE_DARK ;
}
return lines;
}
vec4 main_wrap(vec2 co) {
bool isinterlaced = is_interlaced();
bool flickering_scanlines = (DO_SCANLINES == 1.0) && scanline_have_to_flicker(isinterlaced) ;
vec3 pixel_in;
vec3 pixel_glowed;
//Get the first available pixel_in:
if (DO_IN_GLOW == 1.0) {
pixel_glowed = texture(in_glow_pass,co).rgb;
pixel_in = pixel_glowed;
}
else if (DO_FXAA == 1.0)
pixel_in = texture(FXAA_pass,co).rgb ;
else
pixel_in = texture(first_pass,co).rgb ;
vec3 pixel_out = pixel_in;
vec3 pixel_in_clamped = min(pixel_in,vec3(1.0)); //Clamp here for moth vmask and darklines.
//Mask and darklines:
if (DO_VMASK_AND_DARKLINES == 1.0 ) {
if (RGB_MASK_STRENGTH > 0.0) {
//Use RGB pattern or exploit RGB layout with green and magenta?
if (VMASK_USE_GM < 1.0) {
pixel_out = pixel_vmask(pixel_in, pixel_in_clamped, VMASK_OVERWHITE);
} else {
pixel_out = pixel_vmask_gm(pixel_in, pixel_in_clamped, VMASK_OVERWHITE);
}
}
//Screen lines
if (DARKLINES_STRENGTH > 0.0 ) {
float MYDARKLINES_TRANSPARENCY = 1.0 - DARKLINES_STRENGTH;
pixel_out = pixel_darklines(pixel_out,DARKLINES_PERIOD,MYDARKLINES_TRANSPARENCY,DO_DARKLINES_VOFFSET,pixel_in_clamped,DRKLN_OVERWHITE);
}
}
//Halo
vec3 pixel_haloed;
if (DO_HALO == 1.0 ) {
pixel_haloed = texture(halo_pass,co).rgb;
pixel_out += pixel_haloed;
pixel_out = clamp(pixel_out,0.0,HALO_CLAMP);
}
// Non flickering scanlines
if ( DO_SCANLINES == 1.0 ) {
vec3 pixel_bleed ;
if (! ( isinterlaced && (SCANLINE_DISABLE_ON_INTERLACE == 1.0)) ) {
if (DO_IN_GLOW + DO_HALO > 0.0) {
if (DO_HALO == 1.0) pixel_bleed = pixel_haloed;
else if (DO_IN_GLOW == 1.0) pixel_bleed = pixel_glowed;
else pixel_bleed = pixel_in;
}
float scanline_shape = scanline_shape(co, flickering_scanlines ) ;
vec3 pixel_scanlined = scanline_shape * pixel_out;
pixel_out = pixel_scanlined + (pixel_out * pixel_bleed * SCANLINES_BLEEDING * (1-scanline_shape));
}
}
if (DO_CCORRECTION == 1.0) pixel_out = pow(pixel_out,vec3(GAMMA_OUT));
//Out
return vec4(pixel_out,1.0) ; //* border(border_coords);
}
/*
//Test masks to be used with pixel_vmask_test()
// Actually slower than pixel_vmask(), but handy for quick test
//first element of the array is the useful size.
const vec3 oo = vec3(0); //padding
const vec3 mask_RGB[10] = vec3[]( vec3(3), vec3(1,0,0), vec3(0,1,0), vec3(0,0,1), oo, oo, oo, oo, oo, oo);
const vec3 mask_GM[10] = vec3[]( vec3(2), vec3(0,1,0), vec3(1,0,1), oo, oo, oo, oo, oo, oo, oo);
vec3 pixel_vmask_test(vec3 color_in, vec3[10] vmask, int multiplier, float gap, vec3 white_reference, float over_white) {
int col = int( vOutputCoord.x * params.OutputSize.x );
vec3 vmasked;
float size = (vmask[0].x + gap) * multiplier;
for (int i = multiplier ; i <= size * multiplier ; i+=multiplier) {
if (mod(col, size) < i) {
vmasked = min (vmask[i/multiplier] + 1.0 - RGB_MASK_STRENGTH, vec3(1.0)) * color_in;
break;
}
}
if (over_white == 1.0) return vmasked;
else {
float whiteness=(white_reference.r+white_reference.g+white_reference.b)/3.0;
whiteness-= over_white;
whiteness= clamp(whiteness,0.0,1.0);
return mix(vmasked, color_in, whiteness);
}
}
*/
void main() {
vec2 coords = vTexCoord;
if (DO_DYNZOOM == 1.0) {
float zoomin = 1.0 + (texture(avglum_passFeedback, vec2(0.25,0.25) ).a/ DYNZOOM_FACTOR);
coords = zoom(vTexCoord, zoomin);
}
vec2 coords_curved = coords;
//Curvature: set coords_curved coordinate: (global var)
if (DO_CURVATURE == 1.0) {
if ((GEOM_WARP_X > 0.0) || (GEOM_WARP_Y > 0.0))
coords_curved = Warp(coords_curved,GEOM_WARP_X,GEOM_WARP_Y);
}
if (DO_BEZEL == 1.0) {
coords_curved = zoomout_coords(coords_curved, -BEZEL_INNER_ZOOM , 1.0);
coords = zoomout_coords(coords, -BEZEL_INNER_ZOOM , 1.0);
}
//FIXME: bezel may need a wider border when zoomed in.
//But for performance reasons we can wide the border in relation to the desidered reflection area.
//by now, just wide by BEZEL_REFLECTION_AREA_SIZE defined in config.inc
bool is_border = false;
if (border_needed()) {
float WIDEN = DO_BEZEL * BEZEL_REFLECTION_AREA_SIZE;
bool b_is_rotated = is_rotated();
bool is_outside_x = ((coords.x > 1.0+WIDEN ) || (coords.x < 0.0 - WIDEN) );
bool is_outside_y = ((coords.y > 1.0+WIDEN ) || (coords.y < 0.0 - WIDEN) );
is_border = (b_is_rotated && is_outside_y) || (!b_is_rotated && is_outside_x);
}
if (is_border)
FragColor = mark_outer_frame(vec3(0.0));
else
FragColor = main_wrap(coords_curved);
}

View File

@ -0,0 +1,25 @@
#version 450
#include "../config.inc"
#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() {
FragColor = texture(Source, vTexCoord);
}

View File

@ -0,0 +1,36 @@
#version 450
#include "config.inc"
#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 Original;
void main() {
FragColor = vec4(texture(Original, vTexCoord).xyz,1.0);
/* //Use to debug:
vec4 pixel;
//pixel=vec4(abs(sin(params.FrameCount/3.14/20))); //white fade
//pixel=vec4(abs(sin(params.FrameCount/3.14/20)),0.0,0.0,0.0); //red fade
//pixel=vec4(0.2);
if (mod(params.FrameCount,100) == 0.0) {
pixel = vec4(0.6);
} else {
pixel = vec4(0.0);
}
FragColor = pixel;
*/
}

View File

@ -0,0 +1,59 @@
vec3 pow_2(vec3 v) {
return v*v*v;
}
vec3 pow_3(vec3 v) {
return v*v*v;
}
vec3 pow_4(vec3 v) {
vec3 v2 = v*v;
return v2*v2;
}
vec3 pow_5(vec3 v) {
vec3 v2 = v*v;
return v2*v2*v;
}
vec3 pow_6(vec3 v) {
vec3 v2 = v*v;
return v2*v2*v2;
}
vec3 pow_7(vec3 v) {
vec3 v2 = v*v;
return v2*v2*v2*v;
}
vec3 pow_8(vec3 v) {
vec3 v2 = v*v;
vec3 v4 = v2*v2;
return v4*v4;
}
vec3 pow_9(vec3 v) {
vec3 v2 = v*v;
vec3 v4 = v2*v2;
return v4*v4*v;
}
vec3 pow_10(vec3 v) {
vec3 v2 = v*v;
vec3 v4 = v2*v2;
return v4*v4*v2;
}
vec3 my_pow(vec3 c,float p) {
if (p == 1) return c;
else if (p == 2) return c * c ;
else if (p == 3) return pow_3(c);
else if (p == 4) return pow_4(c);
else if (p == 5) return pow_5(c);
else if (p == 6) return pow_6(c);
else if (p == 7) return pow_7(c);
else if (p == 8) return pow_8(c);
else if (p == 9) return pow_9(c);
else if (p == 10) return pow_10(c);
return pow(c,vec3(p));
}

View File

@ -0,0 +1,264 @@
#version 450
#include "config.inc"
#pragma stage vertex
layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord;
layout(location = 1) out vec2 vWarp_vexp;
layout(location = 2) out vec2 vWarp_arg2;
layout(location = 0) out vec2 vTexCoord;
#include "includes/functions.include.slang"
void main() {
gl_Position = global.MVP * Position;
vTexCoord = TexCoord;
//Precalc some Curvature/Warp values:
vWarp_vexp = 1.0/ (1 + (vec2(GEOM_WARP_X, GEOM_WARP_Y) * 0.2)) ;
vWarp_arg2 = 1.0 - pow(vec2(0.29289321881345247559915563789515), vWarp_vexp );
if (DO_BEZEL > 0.5)
vTexCoord = zoom(TexCoord, BEZEL_REFL_ZOOM + (BEZEL_REFL_ZOOM_STRAIGHT_OFFSET * BEZEL_USE_STRAIGHT) );
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 1) in vec2 vWarp_vexp;
layout(location = 2) in vec2 vWarp_arg2;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 1) uniform sampler2D first_pass;
layout(set = 0, binding = 2) uniform sampler2D avglum_pass;
#define SourceTexture first_pass
#define SourceTextureSize global.first_passSize
#include "includes/functions.include.slang"
#define c_tolerance 0.051
vec3 texture_clamp_to_border(sampler2D tex, vec2 coords, float lod) {
//This emulates clamp to border:
if (coords.x < 0.0 || coords.x > 1.0 || coords.y < 0.0 || coords.y > 1.0)
return vec3(0.0);
else
return textureLod( tex, coords, lod).rgb ;
}
vec3 blur_unroll_clamp_to_border(float Size, vec2 co, float lod) {
//Blur the image along x axis and emulate a clamp_to_border when outside the [0..1] range
Size = Size * NEW_SCALEMOD_X; //<- so that blur size doesn't depend on output resolution
vec3 color;
vec2 d = SourceTextureSize.zw * Size;
color = texture_clamp_to_border( SourceTexture, co + d * vec2(-1.0, 1.0 ) ,lod).rgb;
color += texture_clamp_to_border( SourceTexture, co + d * vec2( 1.0, 1.0 ) ,lod).rgb;
color += texture_clamp_to_border( SourceTexture, co + d * vec2(-1.0, -1.0 ) ,lod).rgb;
color += texture_clamp_to_border( SourceTexture, co + d * vec2( 1.0, -1.0 ) ,lod).rgb;
return color / 4.0;
}
vec3 blur_unroll(float Size, vec2 co, float lod) {
//Blurs the image along x axis
Size = Size * NEW_SCALEMOD_X; //<- so that blur size doesn't depend on output resolution
vec3 color;
vec2 d = SourceTextureSize.zw * Size;
color = textureLod( SourceTexture, co + d * vec2(-1.0, 1.0 ) ,lod).rgb;
color += textureLod( SourceTexture, co + d * vec2( 1.0, 1.0 ) ,lod).rgb;
color += textureLod( SourceTexture, co + d * vec2(-1.0, -1.0 ) ,lod).rgb;
color += textureLod( SourceTexture, co + d * vec2( 1.0, -1.0 ) ,lod).rgb;
return color / 4.0;
}
vec2 mirrored_repeat(vec2 co, vec2 crop) {
//Do a coords mirrored repeat with the mirror axis
//shifted by a "crop" amount.
//Don't try to unbranch me, it is a matter of 1/1000.
vec2 cmin = 0.0 + crop ;
vec2 cmax = 1.0 - crop ;
if (co.x < cmin.x )
co.x = 2*cmin.x - co.x;
if (co.y < cmin.y)
co.y = 2*cmin.y - co.y;
if (co.x > cmax.x )
co.x = 2*cmax.x - co.x;
if (co.y > cmax.y )
co.y = 2*cmax.y - co.y;
return co;
}
float circle_smooth(vec2 coords, vec2 middle, float f_radius, float FALLOFF) {
//Draw a circle with smoothed borders:
float fdistance=distance(middle, vec2(coords.x, coords.y));
float circle = (1-smoothstep(f_radius-FALLOFF, f_radius+FALLOFF, fdistance));
return circle;
}
float square_smooth(vec2 co, vec2 corner, float size, float smoothshade) {
//Draws a square with smooth borders:
vec4 rect = vec4(corner.x, corner.y, corner.x+size, corner.y+size);
vec2 hv = smoothstep(rect.xy - smoothshade, rect.xy, co) * smoothstep(co - smoothshade, co, rect.zw);
return hv.x * hv.y;
}
float corners_shade(vec2 co, float size, float smoothsize){
//Draws 4 smooth squares or circles in the corners.
//They are intended to modulate the blur radius and the strength of the reflection.
/*
vec4 circles;
float circle_radius = size; //0.13?
float circle_falloff = smoothsize; //0.05?
float circle_power =2.0;
circles.x = circle_smooth(co, vec2(0.0,0.0), circle_radius, circle_falloff) * circle_power;
circles.y = circle_smooth(co, vec2(0.0,1.0), circle_radius, circle_falloff) * circle_power;
circles.z = circle_smooth(co, vec2(1.0,0.0), circle_radius, circle_falloff) * circle_power;
circles.w = circle_smooth(co, vec2(1.0,1.0), circle_radius, circle_falloff) * circle_power;
float circle = max(max(max(circles.x, circles.y), circles.z), circles.w);
circle = min(circle, 1.0);
circle = 1-circle;
return circle;
*/
vec4 squares;
float squaresize = size;
float squarefade = smoothsize;
//(vec2 co, vec2 corner, float size, float smoothshade) {
squares.x = square_smooth(co, vec2(0.0,0.0), squaresize, squarefade);
squares.y = square_smooth(co, vec2(1.0 - squaresize, 0.0), squaresize, squarefade);
squares.z = square_smooth(co, vec2(0.0, 1-squaresize), squaresize, squarefade);
squares.w = square_smooth(co, vec2(1-squaresize, 1-squaresize), squaresize, squarefade);
return max(max(max(squares.x, squares.y), squares.z), squares.w);
}
float borders_gradient(vec2 co, vec2 foffset) {
// Create a b/w shade near the borders that will be used to
// Modulate from sharp reflections to blur reflections.
vec4 shades;
shades.x = abs( co.x - foffset.x );
shades.y = abs( 1 - co.x - foffset.x );
shades.z = abs( co.y - foffset.y );
shades.w = abs( 1 - co.y - foffset.y );
return min(min(min(shades.x, shades.y), shades.z), shades.w);
}
bool is_void_area(vec2 co, vec2 crop_point) {
// Given a coordinate and a negative crop_point,
// this returns if the point falls into an blank area
return (co.y < 0.0 && co.y > crop_point.y*2) || (co.y > 1.0 && co.y < 1 - crop_point.y*2) ||
(co.x < 0.0 && co.x > crop_point.x*2) || (co.x > 1.0 && co.x < 1 - crop_point.x*2);
}
void main() {
if (DO_BEZEL == 0.0) return;
//Zoom out the image coordinates by the bezel border size to make room for reflections:
vec2 coords = zoomout_coords(vTexCoord, BEZEL_BORDER_SIZE, 1.0);
vec2 coords_zoomedout = coords;
//This skip condition will be used to speed-up processing by discarding unuseful pixels.
//the c_tolerance parameter is a safe measure /FIXME: for what?
bool skip_condition = (coords.x < 1.0 - c_tolerance && coords.x > c_tolerance &&
coords.y < 1.0 - c_tolerance && coords.y > c_tolerance ) ;
//Mark the pixel as not useful, so that the next pass will be aware of it and skip rendering too:
if (skip_condition) {
FragColor = mark_useless(vec3(0.0));
return;
}
//If coords needs to be curved, do it now:
if (DO_CURVATURE == 1.0 && ( GEOM_WARP_X > 0.0 || GEOM_WARP_Y > 0.0) ) {
coords = Warp_fast(coords, vWarp_vexp, vWarp_arg2); //coords_curved = Warp(coords_curved,GEOM_WARP_X,GEOM_WARP_Y);
}
//Since we will use a mirrored_repeat trick to simulate reflections, we need to know
//where the mirror axis is.
//The mirror axis position may depend on the dynamic zoom level
//(the feature that zooms the image in when it is bright)
vec2 coords_crop_point = vec2(0.0);
if (DO_DYNZOOM == 1.0) {
//Crop coordinates to move the mirror axes
float dyn_zoom = get_dyn_zoom(avglum_pass);
coords_crop_point = vec2((dyn_zoom - 1.0) * 0.5);
//Zoom image coords to align it
coords = zoom(coords, dyn_zoom);
}
coords_crop_point += BEZEL_RFL_OFFSET; // <- Adding the user offset
//Mirror repeat the image by taking the crop point (mirror axis offset) into account:
vec2 coords_for_mirrored_repeat = coords;
/* float test_zoom_y = 0.5;
coords_for_mirrored_repeat = vec2(coords.x, zoom1D(coords.y, test_zoom_y));
if (test_zoom_y < 1.0)
coords_crop_point.y += - ( (1.0/(4*test_zoom_y) ) - (1.0/4.0) );
else
coords_crop_point.y += ( test_zoom_y - 1.0) * 0.5;
*/
coords = mirrored_repeat(coords_for_mirrored_repeat, coords_crop_point);
//Create gradients in the corners to fadeout reflections and to blur more near them:
float fcorners_shade = corners_shade(vTexCoord, BEZEL_REFL_CORNER_BLANK_SIZE, BEZEL_REFL_CORNER_BLANK_SHADE);
//Create a gradient near borders to modulate between blurrend and sharp refection.
//This also goes into output alpha channel to make the next pass aware of it.
float shade_sharp_blur = borders_gradient(coords, coords_crop_point);
shade_sharp_blur = shade_sharp_blur * 1/(BEZEL_BORDER_SIZE * 0.3) ;
shade_sharp_blur = shade_sharp_blur - BEZEL_RFL_BLR_SHD; //Modulates between sharp and blur via user parameter
//Also modulate in the corners via fcorners_shade (fcorners_shade
shade_sharp_blur = max(fcorners_shade, shade_sharp_blur);
//Clamp to min 0.01 because anything lower will cause the next pass to think the pixel is useless.
shade_sharp_blur = max(shade_sharp_blur, 0.01);
//shade_sharp_blur = clamp(shade_sharp_blur, 0.01, 1.0);
//blur the reflection along x axis:
vec3 pixel_out;
if ( !is_void_area(coords_for_mirrored_repeat, coords_crop_point) ) {
float lod0 = floor(shade_sharp_blur*3.0);
float lod1 = lod0 + 1;
vec3 s1 = textureLod( SourceTexture, coords, lod0).rgb;
vec3 s2 = textureLod( SourceTexture, coords, lod1).rgb;
float lodmix = fract(shade_sharp_blur*3.0);
pixel_out = mix(s1, s2, lodmix);
pixel_out = textureLod( SourceTexture, coords, shade_sharp_blur*3.0).rgb;
//pixel_out = blur_unroll(BEZEL_REFL_BLUR_MAX * shade_sharp_blur, coords, shade_sharp_blur*3.0 );
}
else
pixel_out = vec3(0.0);
// I tried, instead of simple blur_unroll() to take a black border into account ( blur_unroll_clamp_to_border() )
// to emulate the reflection of black border into the main content
// when it is smaller than the bezel, but due to the low resolution of this pass, the results are bad:
//pixel_out = blur_unroll_clamp_to_border(BEZEL_REFL_BLUR_MAX * shade_sharp_blur, coords, 2.0);
//multiply the blurred image by the corner shade so that reflections will not be visible in the corners.
pixel_out = pixel_out * (1 - fcorners_shade);
// Finally, output the blurred image and put the sharp to blurred gradient in the alpha channel
// to be used by the next blur-y pass too to modulate the blur radius.
FragColor = vec4(apply_fuzzy_main_pass(pixel_out), shade_sharp_blur);
}

View File

@ -0,0 +1,81 @@
#version 450
#include "config.inc"
#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;
#include "includes/functions.include.slang"
#define SourceTexture Source
#define SourceTextureSize params.SourceSize
#define b_offset_x -0.05
#define Pi2 6.28318530717959
vec3 blur(float Quality, float Directions, float Size, vec2 co) {
Size = Size * NEW_SCALEMOD_Y;
vec4 iResolution = SourceTextureSize;
vec2 Radius = Size/iResolution.xy ;
vec3 color = vec3(0.0,0.0,0.0);
vec3 lookup = vec3(0.0,0.0,0.0);
float steps=0.0;
for( float d=0.0; d<Pi2; d+=Pi2/Directions) {
for(float i=1.0/Quality; i<=1.0; i+=1.0/Quality) {
lookup = texture( SourceTexture, co + vec2(cos(d) + b_offset_x , sin(d))*Radius*i ).rgb ;
color +=lookup.rgb;
steps+=1.0;
}
}
color /= steps;
return color;
}
vec3 blur_unroll(float Size, vec2 co) {
Size = Size * NEW_SCALEMOD_Y;
vec3 color = vec3(0.0,0.0,0.0);
vec2 d = SourceTextureSize.zw * Size;
color = texture( SourceTexture, co + d * vec2(-1.0, 1.0 )).rgb ;
color += texture( SourceTexture, co + d * vec2( 1.0, 1.0 )).rgb ;
color += texture( SourceTexture, co + d * vec2(-1.0, -1.0 )).rgb ;
color += texture( SourceTexture, co + d * vec2( 1.0, -1.0 )).rgb ;
color /= 4.0;
return color;
}
void main() {
if (DO_BEZEL == 0.0) return;
vec2 coords = vTexCoord;
vec4 pixel_source = texture(Source, coords);
if (is_useless(pixel_source)) {
//FragColor = vec4(0.0);
return;
}
float blur_modulation = pixel_source.a;
vec3 pixel_out = blur_unroll(BEZEL_REFL_BLUR_MAX * blur_modulation, coords);
//pixel_out = mix(vec3(blur_modulation), pixel_out, 0.5);
FragColor = vec4(pixel_out, 1.0);
//FragColor = vec4(blur_modulation);
}

View File

@ -0,0 +1,103 @@
#version 450
#include "config.inc"
#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 in_glow_pass;
layout(set = 0, binding = 3) uniform sampler2D FXAA_pass;
layout(set = 0, binding = 4) uniform sampler2D doublesize_pass;
bool scanline_have_to_flicker(bool is_interlaced) {
return ((scanline_flickering == 1.0) || ((scanline_flickering==2.0) && is_interlaced ));
}
void main()
{
vec3 pixel_out = vec3(0.0);
//Use to debug:
//pixel_out=vec4(abs(sin(params.FrameCount/3.14/20))); //white fade
//pixel_out=vec4(abs(sin(params.FrameCount/3.14/20)),0.0,0.0,0.0); //red fade
//pixel_out=vec4(0.2);
if (DO_SCANLINES == 1.0) {
if (scanline_flickering != 0.0) {
bool is_interlaced = (params.OriginalSize.y > MIN_LINES_INTERLACED) ? true : false ;
if ( scanline_have_to_flicker(is_interlaced) ) {
//Choose the right source
if (DO_IN_GLOW == 1.0) {
pixel_out = texture(in_glow_pass, vTexCoord).rgb;
} else if (DO_FXAA == 1.0) {
pixel_out = texture(FXAA_pass, vTexCoord).rgb;
} else {
pixel_out = texture(doublesize_pass, vTexCoord).rgb;
}
int scanline_period;
int scanline_period_half;
/* Puae switches from lowres to sdres on interlaced screens
since we blindly double the h-resolution, because we need
to double y resolution on low resolution to simulate scanlines
and providing sd-res to fxaa, we can check if a screen is
interlaced by testing v-resolution of source image.
which could be at least 200*2(puae)*2(ourselves)=800px.
Rest assured that everything over 576,
(maximum pal overscanned) is interlaced.
*/
if (is_interlaced) {
scanline_period=4;
scanline_period_half=2;
} else {
scanline_period=2;
scanline_period_half=1;
}
//Skip scanlines on interlaced content?
if (! ( is_interlaced && (scanline_disable_on_interlace == 1.0)) ) {
float mymod = mod(vTexCoord.y * params.OutputSize.y , scanline_period);
//Do flickering based on user prefs.
//(blank odd lines on odd frames and even lines on even frames)
if ((scanline_flickering == 1.0) ||
((scanline_flickering==2.0) && is_interlaced )) {
if (int(mod(float(params.FrameCount),2 )) < 1.0 ) {
if (mymod >= scanline_period_half) { pixel_out *= SCANLINE_DARK; }
} else {
if (mymod < scanline_period_half) { pixel_out *= SCANLINE_DARK; }
}
}
}
}
}
}
FragColor = vec4(pixel_out,1.0);
}

View File

@ -0,0 +1,49 @@
#version 450
#include "config.inc"
#pragma stage vertex
layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord;
layout(location = 0) out vec2 vTexCoord;
#include "functions.include"
void main()
{
gl_Position = global.MVP * Position;
vTexCoord = TexCoord;
float aspect_prev = (params.SourceSize.y / params.SourceSize.x);
if (border_needed() ) {
vTexCoord.x = vTexCoord.x * aspect_prev - ((0.5 * aspect_prev) - 0.5);
float in_aspect = get_in_aspect();
vTexCoord.x = vTexCoord.x * in_aspect - ((0.5 * in_aspect) - 0.5);
} else {
vTexCoord.x = vTexCoord.x * aspect_prev - ((0.5 * aspect_prev) - 0.5);
float dasp = global.FinalViewportSize.x/global.FinalViewportSize.y;
vTexCoord.x = (vTexCoord.x* dasp - ((0.5 * dasp) - 0.5)) ;
}
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source;
#include "functions.include"
void main() {
if ((DO_VIGNETTE != 1.0) && (DO_SPOT != 1.0)) return;
vec3 pixel_out;
if (DO_VIGNETTE == 1.0)
pixel_out.r = gauss_xy(0.0, 0.0, v_size, v_power, 0.0, 1.0);
if (DO_SPOT == 1.0)
pixel_out.g = gauss_xy(s_center_x, s_center_y, s_size, s_power, 0.0, 10.0);
FragColor = vec4(pixel_out,1.0);
}

View File

@ -8,6 +8,7 @@ layout(location = 1) in vec2 TexCoord;
layout(location = 0) out vec2 vTexCoord;
layout(location = 1) out vec2 vFuzzy_main_pass_stage_1;
layout(location = 2) out vec2 vCoords_zoomout;
layout(location = 3) out float vDo_Curvature;
#include "includes/functions.include.slang"
#include "includes/blooms.include.slang"
@ -17,27 +18,37 @@ void main() {
vTexCoord = TexCoord;
//Get fuzzy mul and pow factor
vFuzzy_main_pass_stage_1 = apply_fuzzy_main_pass_stage_1();
vFuzzy_main_pass_stage_1 = apply_fuzzy_main_pass_stage_1_no_gamma_in();
//Zoom out the image coordinates by the bezel border size to make room for reflections:
vCoords_zoomout = zoom(vTexCoord, BEZEL_REFL_ZOOMOUT_ROOM);
vDo_Curvature = curvature_needed();
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 1) in vec2 vFuzzy_main_pass_stage_1;
layout(location = 2) in vec2 vCoords_zoomout;
layout(location = 3) in float vDo_Curvature;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 1) uniform sampler2D Source;
layout(set = 0, binding = 2) uniform sampler2D flick_and_noise_pass;
layout(set = 0, binding = 3) uniform sampler2D reflected_blurred_passFeedback;
layout(set = 0, binding = 4) uniform sampler2D shift_and_bleed_pass;
layout(set = 0, binding = 2) uniform sampler2D reflected_blurred_passFeedback;
layout(set = 0, binding = 3) uniform sampler2D colortools_and_ntsc_pass;
#include "includes/functions.include.slang"
#include "includes/blooms.include.slang"
float light_fadeout(vec2 co) {
const float shade_start = 1-BEZEL_REFL_FADEOUT_START ;
vec2 gradients = smoothstep_fast( vec2(BEZEL_LIGHT_NO_FADEOUT), vec2(0.5-(shade_start) ), abs(co-0.5));
return (gradients.x * gradients.y );
}
void main() {
if (DO_BEZEL == 0.0) return;
@ -67,17 +78,34 @@ void main() {
pixel_out *= BEZEL_REFL_STRENGTH;
//Next simulate a diffused light
vec3 pixel_diffused = textureLod( shift_and_bleed_pass, vCoords_zoomout, 6.0).rgb;
vec3 pixel_diffused = textureLod( colortools_and_ntsc_pass, vCoords_zoomout, 6.0).rgb;
pixel_diffused = pow(pixel_diffused.rgb, vec3(IN_GLOW_GAMMA));
pixel_out = mix( pixel_out, pixel_diffused, BEZEL_DIFFUSION_STR);
//Apply gamma out to reflections here to so that we don't need to do it in final pass (heavier).
//pixel_out = apply_fuzzy_main_pass_stage_2(pixel_out, vFuzzy_main_pass_stage_1);
//Border Reflection strength modulation
if (vDo_Curvature > 0.0) {
vec2 curvedco = Warp_koko(vTexCoord, vec2(-GEOM_WARP_X, -GEOM_WARP_Y), 0.5);
pixel_out *= vec3(light_fadeout(curvedco));
} else {
pixel_out *= vec3(light_fadeout(vTexCoord));
}
// vec3 pixel_out_fb = texture(reflected_blurred_passFeedback, vTexCoord).rgb;
// pixel_out = mix(pixel_out_fb.rgb, pixel_out, 0.5 );
pixel_out = apply_fuzzy_main_pass_stage_2(pixel_out, vFuzzy_main_pass_stage_1);
vec3 pixel_out_fb = texture(reflected_blurred_passFeedback, vTexCoord).rgb;
pixel_out = mix(pixel_out_fb.rgb, pixel_out, 0.5 );
FragColor = vec4(pixel_out, 1.0);
//FragColor = vec4(shade_sharp_blur);
}

View File

@ -17,9 +17,9 @@ void main() {
vCoordsAdapted = vTexCoord;
//override aspect?
if (DO_GAME_GEOM_OVERRIDE > 0.5)
vCoordsAdapted = content_geom_override(vCoordsAdapted, GAME_GEOM_ASPECT, get_in_aspect(), GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM);
vCoordsAdapted = content_geom_override_zoom(vCoordsAdapted, GAME_GEOM_ASPECT, get_in_aspect(), GAME_GEOM_VSHIFT, GAME_GEOM_HSHIFT, GAME_GEOM_ZOOM);
vCoordsAdapted = zoomout_coords( vCoordsAdapted, BEZEL_RFL_ZOOM);
vCoordsAdapted = zoomout_coords( vCoordsAdapted, BEZEL_RFL_ZOOM*0.1);
vCoords_shade = zoom(vTexCoord,1.05);
@ -32,17 +32,26 @@ layout(location = 2) in vec2 vCoords_shade;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 1) uniform sampler2D flick_and_noise_pass;
layout(set = 0, binding = 1) uniform sampler2D shift_and_bleed_pass;
layout(set = 0, binding = 2) uniform sampler2D avglum_pass;
#include "includes/functions.include.slang"
#include "includes/blooms.include.slang"
float borders_gradient(vec2 co, float smoothness) {
vec2 gradients = 1-smoothstep_fast( vec2(0.5-smoothness), vec2(0.5), abs(co-0.5));
return (gradients.x * gradients.y * 2.5 - 0.5 );
/*vec2 hv = smoothstep_fast( vec2(0.0), vec2(smoothness), co) *
(1-smoothstep_fast( vec2(1-smoothness), vec2(1.0), co));
return min(hv.x, hv.y)*4.0-1;
*/
//Draws a square with smooth borders:
vec4 rect = vec4(smoothness, smoothness, 1 - smoothness, 1 - smoothness);
/*vec4 rect = vec4(smoothness, smoothness, 1 - smoothness, 1 - smoothness);
vec2 hv = smoothstep(rect.xy - smoothness, rect.xy, co) * smoothstep(co - smoothness, co, rect.zw);
return hv.x * hv.y;
return hv.x * hv.y;*/
}
void main() {
@ -60,8 +69,14 @@ void main() {
if (DO_DYNZOOM > 0.0)
coords = zoom(coords, get_dyn_zoom(avglum_pass));
if (AUTOCROP_MAX > 0.0)
coords = zoom(coords, get_autocrop_zoom(avglum_pass));
//eventually return black pixel
if (coords.y < 0.0 || coords.y > 1.0 || coords.x < 0.0 || coords.x > 1.0) {
#define tol 0.001
#define RECT01 vec4( vec2(0.0-tol), vec2(1.0+tol) )
if (is_first_outside_rect(coords, RECT01)) {
//if (coords.y < 0.0-tol || coords.y > 1.0+tol || coords.x < 0.0-tol || coords.x > 1.0+tol) {
FragColor = vec4(0.0);
return;
}
@ -76,7 +91,7 @@ void main() {
shade_sharp_blur=clamp(shade_sharp_blur, 0.0,1.0);
float blur_radius=(shade_sharp_blur) * 2.0 ;
vec3 pixel_out = bloom(flick_and_noise_pass, coords, global.FinalViewportSize, vec2(blur_radius), 1.0, 0.0, 1.0) ;
vec3 pixel_out = bloom(shift_and_bleed_pass, coords, global.FinalViewportSize, vec2(blur_radius), 1.0, 0.0, 1.0) ;
FragColor = vec4(pixel_out,shade_sharp_blur );
//FragColor = vec4(shade_sharp_blur );

View File

@ -60,9 +60,8 @@ layout(location = 6) in float vShow_artifact_mask;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 3) uniform sampler2D FXAA_pass;
layout(set = 0, binding = 4) uniform sampler2D flick_and_noise_pass;
layout(set = 0, binding = 5) uniform sampler2D colortools_and_ntsc_pass;
layout(set = 0, binding = 1) uniform sampler2D FXAA_pass;
layout(set = 0, binding = 2) uniform sampler2D flick_and_noise_pass;
#define bandwidth_mhz_Y_ntsc 4.2
@ -203,7 +202,6 @@ vec4 pixel_bleed(vec4 pixel_in, vec2 co, sampler2D in_texture, vec4 sourcesize2)
}
void main() {
float pixel_alpha_ntsc_artifacts; // <- this carries ntsc artifacts needed by glow to modulate blur there.
vec4 pixel_out;
if ( DO_FXAA == 1.0) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 KiB