Koko-aio: Sync to NG-1.9.13

This commit is contained in:
Antonio Orefice 2024-03-05 09:38:54 +01:00
parent d668788a29
commit 25abcc54d9
38 changed files with 698 additions and 572 deletions

View file

@ -29,6 +29,6 @@ DO_SAT_BLEED = "0.0"
DO_NTSC_ARTIFACTS = "0.0"
DO_SPOT = "0.0"
DO_VIGNETTE = "0.0"
DO_DYNZOOM = "1.0"
DO_DYNZOOM = "0.015"
DO_BG_IMAGE = "0.0"
DO_SHIFT_RGB = "0.0"

View file

@ -74,9 +74,8 @@ DO_SPOT = "0.0"
S_POWER = "0.05"
DO_DYNZOOM = "1.0"
DYNZOOM_FACTOR = "80"
DO_CURVATURE = "1.000000"
DO_DYNZOOM = "0.015"
DO_CURVATURE = "1.000000"
DO_PIXELGRID = "1.000000"

View file

@ -33,7 +33,7 @@ DO_SPOT = "1.000000"
S_POSITION_X = "-0.5"
S_POSITION_Y = "0.5"
S_SIZE = "0.640000"
S_POWER = "0.125"
S_POWER = "0.07"
DO_BG_IMAGE = "1.0"
BG_IMAGE_OVER = "1.0"

View file

@ -86,8 +86,7 @@ DO_SPOT = "0.0"
S_SIZE = "0.4"
S_POWER = "0.05"
DO_DYNZOOM = "1.0"
DYNZOOM_FACTOR = "80"
DO_DYNZOOM = "0.015"
DO_PIXELGRID = "1.000000"
PIXELGRID_H_PRST = "2.000000"

View file

@ -3,7 +3,7 @@
NTSC_FILTER_WIDTH = "13.000000"
NTSC_FILTER_FC = "0.000000"
NTSC_ARTF_TRSH = "0.0"
NTSC_ARTF_TRSH = "0.05"
NTSC_ARTF_NOBLUR = "0.70000"
NTSC_ARTF_NOBLEED = "0.700000"

View file

@ -4,7 +4,7 @@ NTSC_FILTER_SCF = "4.57"
NTSC_FILTER_WIDTH = "13.000000"
NTSC_FILTER_FC = "0.000000"
NTSC_ARTF_TRSH = "0.0"
NTSC_ARTF_TRSH = "0.05"
NTSC_ARTF_NOBLUR = "0.70000"
NTSC_ARTF_NOBLEED = "0.700000"

View file

@ -34,3 +34,8 @@ RF_NOISE_STRENGTH = "0.025"
GEOM_CORNER_SIZE = 0.005
GEOM_CORNER_SMOOTH = "400"
BLOOM_GAMMA = "5.000000"
BLOOM_GAMMA_OUT = "1.800000"
BLOOM_EYE_ADPT_SRT = "0.300000"

View file

@ -60,7 +60,7 @@ DO_SPOT = "1.000000"
PIXELGRID_H_PRST = "2.000000"
DO_PIXELGRID_H = "0.000000"
PIXELGRID_INTR_FLICK_MODE = "1.000000"
PIXELGRID_INTR_FLICK_POWR = "0.400000"
PIXELGRID_INTR_FLICK_POWR = "0.200000"
PIXELGRID_Y_MASK = "0.700000"
PIXELGRID_Y_MASK_ON_WHITE = "0.000000"
PIXELGRID_Y_MASK_STEEP = "8.000000"

View file

@ -53,7 +53,7 @@ DO_PIXELGRID = "1.000000"
DO_HALO = "1.000000"
HALO_NO_PREGAIN = "1.000000"
HALO_POWER = "0.500000"
HALO_SHARPNESS = "6.50000"
HALO_SHARPNESS = "7.0"
HALO_GAMMA = "2.000000"
HALO_GAMMA_OUT = "1.00000"
HALO_VS_SCAN = "0.7"
@ -76,7 +76,7 @@ DO_CURVATURE = "1.000000"
DO_PIXELGRID = "1.0"
DO_DYNZOOM = "1.0"
DO_DYNZOOM = "0.015"
DO_SPOT = "1.0"
S_POSITION_X = "-0.5"

View file

@ -36,7 +36,7 @@ DO_PIXELGRID = "1.000000"
DO_HALO = "1.000000"
HALO_NO_PREGAIN = "1.000000"
HALO_POWER = "0.500000"
HALO_SHARPNESS = "6.500009"
HALO_SHARPNESS = "7.0"
HALO_GAMMA = "1.800000"
HALO_GAMMA_OUT = "1.300000"
HALO_VS_SCAN = "1.000000"

View file

@ -33,7 +33,7 @@ DO_PIXELGRID = "1.000000"
DO_HALO = "1.000000"
HALO_NO_PREGAIN = "1.000000"
HALO_POWER = "0.890003"
HALO_SHARPNESS = "5.999996"
HALO_SHARPNESS = "7.0"
HALO_GAMMA = "1.300000"
HALO_GAMMA_OUT = "2.000000"
HALO_VS_SCAN = "0.300000"

View file

@ -36,7 +36,7 @@ DO_PIXELGRID = "1.000000"
DO_HALO = "1.000000"
HALO_NO_PREGAIN = "1.000000"
HALO_POWER = "0.500000"
HALO_SHARPNESS = "6.500009"
HALO_SHARPNESS = "7.0"
HALO_GAMMA = "1.800000"
HALO_GAMMA_OUT = "1.300000"
HALO_VS_SCAN = "1.000000"

View file

@ -1,38 +1,55 @@
#reference "Base.slangp"
shaders = "17"
//IN_GLOW_POWER = "2.2"
IN_GLOW_POWER = "3.0"
LUMINANCE = "0.05000"
IN_GLOW_GAMMA = "1.900000"
GAMMA_OUT = "0.310000"
PIXELGRID_MIN_W = "0.300000"
PIXELGRID_MAX_W = "0.500000"
PIXELGRID_GAMMA_W = "4.2"
PIXELGRID_H_PRST = "5.000000"
PIXELGRID_MIN_H = "0.300000"
PIXELGRID_MAX_H = "1.0"
PIXELGRID_GAMMA_H = "5.2"
PIXELGRID_Y_MASK = "1.0"
PIXELGRID_Y_MASK_COORDS = "1.0"
PIXELGRID_Y_MASK_HEIGHT = "1.000000"
PIXELGRID_Y_MASK_STEEP = "1.000000"
PIXELGRID_Y_SPARK = "1.0"
PIXELGRID_Y_MASK_SHIFT = "0.350000"
PIXELGRID_Y_MASK_ON_WHITE = "0.500000"
PIXELGRID_BASAL_GRID = "0.02"
HALO_NO_PREGAIN = "1.0"
HALO_POWER = "0.4"
HALO_GAMMA = "2.500000"
HALO_GAMMA_OUT = "1.1"
HALO_VS_SCAN = "0.60"
#reference "../koko-aio-ng.slangp"
DO_CCORRECTION = "1.000000"
IN_GLOW_POWER = "1.600000"
TEMPERATURE = "7500.000000"
IN_GLOW_GAMMA = "2.200000"
GAMMA_OUT = "0.350000"
DO_SHIFT_RGB = "1.000000"
OFFSET_STRENGTH = "0.500000"
SHIFT_R = "-20.000000"
SHIFT_G = "1.000000"
SHIFT_B = "20.000000"
DO_IN_GLOW = "1.000000"
IN_GLOW_BIAS = "0.500000"
IN_GLOW_SPREAD = "1.500000"
IN_GLOW_W = "-0.800000"
IN_GLOW_H = "7.000000"
DO_PIXELGRID = "1.000000"
PIXELGRID_COREY_FAKE_SCAN = "0.000000"
PIXELGRID_MIN_H = "0.300000"
PIXELGRID_MAX_H = "1.000000"
PIXELGRID_GAMMA_H = "2.800000"
PIXELGRID_DECON_R_H = "-0.600000"
PIXELGRID_DECON_B_H = "0.600000"
PIXELGRID_H_DEDOT = "1.000000"
PIXELGRID_MIN_W = "0.200000"
PIXELGRID_MAX_W = "0.500000"
PIXELGRID_GAMMA_W = "2.600000"
PIXELGRID_BASAL_GRID = "0.040000"
PIXELGRID_Y_MASK_HEIGHT = "1.000000"
PIXELGRID_Y_MASK_ON_WHITE = "1.000000"
PIXELGRID_Y_SPARK = "8.000000"
DO_HALO = "1.000000"
HALO_NO_PREGAIN = "1.000000"
HALO_POWER = "0.200000"
HALO_SHARPNESS = "7.000000"
HALO_GAMMA_OUT = "1.700000"
HALO_VS_SCAN = "1.000000"
DO_BLOOM = "1.000000"
BLOOM_MIX = "0.200000"
BLOOM_GAMMA = "4.000000"
BLOOM_POWER = "1.999999"
BLOOM_EYE_ADPT_SRT = "3.999997"
BLOOM_EYE_INERTIA = "10.000000"
BLOOM_OVER_WHITE = "0.000000"
DO_CURVATURE = "1.000000"
GEOM_CORNER_SIZE = "0.010000"
GEOM_CORNER_SMOOTH = "200.000000"
DO_BEZEL = "1.000000"
BEZEL_INNER_ZOOM = "-0.010000"
BEZEL_FRAME_ZOOM = "0.170000"
DO_VIGNETTE = "1.000000"
V_SIZE = "1.000000"
DO_SPOT = "1.000000"
S_POWER = "0.050000"

View file

@ -1,87 +1,53 @@
#reference "Base.slangp"
IN_GLOW_POWER = "1.600000"
GAMMA_OUT = "0.500000"
LUMINANCE = "0.0"
DO_CCORRECTION = "1.000000"
IN_GLOW_POWER = "1.500000"
LUMINANCE = "0.2"
BRIGHTNESS = "0.0"
CONTRAST = "0.0"
IN_GLOW_GAMMA = "2.000000"
GAMMA_OUT = "0.450000"
COLOR_MONO_COLORIZE = "0.0"
SATURATION = "1.0"
DO_SHIFT_RGB = "0.0"
IN_GLOW_W = "-0.750000"
DO_PIXELGRID = "1.000000"
PIXELGRID_OVERMASK = "1.06"
DO_PIXELGRID_W = "1.0"
PIXELGRID_SIZE_W = "1.0"
PIXELGRID_MUL_X = "1.0"
PIXELGRID_H_PRST = "5.000000"
PIXELGRID_H_COUNT = "3.0"
PIXELGRID_R_SHIFT = "0.0"
PIXELGRID_G_SHIFT = "1.0"
PIXELGRID_B_SHIFT = "2.0"
PIXELGRID_MIN_W = "0.050000"
PIXELGRID_MAX_W = "0.5"
PIXELGRID_GAMMA_W = "2.000000"
DO_PIXELGRID_H = "0.750000"
PIXELGRID_MIN_H = "0.2"
PIXELGRID_MAX_H = "0.900000"
PIXELGRID_GAMMA_H = "4.2"
PIXELGRID_NO_INTERBLEED_H = "0.0"
PIXELGRID_H_ANTIMOIRE = "0.0"
PIXELGRID_OFFSET_CORE = "0.0"
PIXELGRID_DECON_R_H = "-0.600000"
PIXELGRID_DECON_G_H = "0.0"
PIXELGRID_DECON_B_H = "0.600000"
PIXELGRID_H_DEDOT = "0.8"
PIXELGRID_Y_MASK = "0.400000"
PIXELGRID_Y_MASK_COORDS = "1.0"
PIXELGRID_Y_MASK_HEIGHT = "0.5"
PIXELGRID_Y_MASK_OFFSET = "1.0"
PIXELGRID_Y_MASK_SHIFT = "-0.01"
PIXELGRID_Y_MASK_STEEP = "8.000000"
PIXELGRID_Y_MASK_ON_WHITE = "1.5"
PIXELGRID_Y_SPARK = "0.300000"
DO_SHIFT_RGB = "1.000000"
OFFSET_STRENGTH = "0.250000"
SHIFT_R = "-20.000000"
SHIFT_G = "1.000000"
SHIFT_B = "20.000000"
DO_IN_GLOW = "1.000000"
IN_GLOW_BIAS = "0.000000"
IN_GLOW_SPREAD = "1.7"
IN_GLOW_W = "-0.600000"
IN_GLOW_H = "-0.600000"
DO_PIXELGRID_H = "0.800000"
PIXELGRID_MIN_H = "0.300000"
PIXELGRID_MAX_H = "0.850000"
PIXELGRID_GAMMA_H = "3.0"
PIXELGRID_DECON_R_H = "-0.600000"
PIXELGRID_DECON_B_H = "0.600000"
PIXELGRID_H_PRST = "5.000000"
PIXELGRID_Y_MASK = "0.5"
PIXELGRID_Y_MASK_COORDS = "1.0"
PIXELGRID_Y_MASK_HEIGHT = "-2.000000"
PIXELGRID_Y_MASK_STEEP = "4.000000"
PIXELGRID_Y_MASK_SHIFT = "-0.01"
PIXELGRID_Y_SPARK = "0.0"
PIXELGRID_Y_MASK_ON_WHITE = "0.5"
PIXELGRID_MIN_W = "0.25"
PIXELGRID_MAX_W = "0.25"
PIXELGRID_GAMMA_W = "4.2"
DO_HALO = "1.000000"
HALO_NO_PREGAIN = "1.000000"
HALO_POWER = "0.200000"
HALO_SHARPNESS = "6.500000"
HALO_GAMMA = "1.400000"
HALO_GAMMA_OUT = "1.0"
HALO_VS_SCAN = "0.0"
HALO_POWER = "0.600000"
HALO_SHARPNESS = "7.000000"
HALO_GAMMA = "1.000000"
HALO_GAMMA_OUT = "1.300000"
HALO_VS_SCAN = "0.500000"
DO_BLOOM = "1.000000"
BLOOM_MIX = "0.250000"
BLOOM_SIZE = "4.0"
BLOOM_QUALITY = "1.0"
BLOOM_GAMMA = "8.0"
BLOOM_GAMMA_OUT = "1.0"
BLOOM_POWER = "1.600001"
BLOOM_EYE_ADPT_SRT = "0.45"
BLOOM_EYE_INERTIA = "1500"
BLOOM_OVER_WHITE = "0.500000"
BLOOM_BYPASS = "0.0"
V_SIZE = "1.0"
BLOOM_MIX = "0.400000"
BLOOM_GAMMA = "3.000000"
BLOOM_GAMMA_OUT = "2.200000"
BLOOM_POWER = "2.399999"
BLOOM_EYE_ADPT_SRT = "0.600000"
BLOOM_EYE_INERTIA = "750.000000"
BLOOM_OVER_WHITE = "0.000000"

View file

@ -41,7 +41,7 @@ DO_PIXELGRID = "1.000000"
DO_HALO = "1.000000"
HALO_POWER = "0.400000"
HALO_SHARPNESS = "6.500002"
HALO_SHARPNESS = "7.0"
HALO_GAMMA = "2.999998"
HALO_VS_SCAN = "1.000000"

View file

@ -5,6 +5,7 @@ IN_GLOW_POWER = "1.200000"
IN_GLOW_GAMMA = "2.000000"
GAMMA_OUT = "0.330000"
LUMINANCE = "0.0"
ADAPTIVE_BLACK = "0.0"
DO_SHIFT_RGB = "0.0"

View file

@ -11,7 +11,8 @@ DO_HALO = "1.000000"
DO_CCORRECTION = "1.000000"
GAMMA_OUT = "0.40000"
TEMPERATURE = "7200.000000"
ADAPTIVE_BLACK = "0.0"
DO_IN_GLOW = "1.000000"
IN_GLOW_POWER = "1.000001"
IN_GLOW_GAMMA = "2.000000"

View file

@ -8,6 +8,8 @@ DO_CCORRECTION = "1.000000"
GAMMA_OUT = "0.45000"
LUMINANCE = "0.100000"
IN_GLOW_POWER = "1.200001"
ADAPTIVE_BLACK = "0.0"
DO_IN_GLOW = "1.000000"
IN_GLOW_GAMMA = "2.000000"

View file

@ -13,12 +13,10 @@ DO_CCORRECTION = "1.000000"
GAMMA_OUT = "0.500000"
SATURATION = "0.850000"
GAMMA_OUT = "0.500000"
ADAPTIVE_BLACK = "0.0"
DO_SHIFT_RGB = "1.000000"
OFFSET_STRENGTH = "0.250000"
SHIFT_R = "42.000000"
SHIFT_G = "42.000000"
SHIFT_B = "42.000000"
DO_SHIFT_RGB = "0.000000"
DO_IN_GLOW = "1.000000"
IN_GLOW_GAMMA = "2.000000"

View file

@ -10,12 +10,9 @@ DO_CCORRECTION = "1.000000"
GAMMA_OUT = "0.500000"
SATURATION = "0.850000"
GAMMA_OUT = "0.500000"
ADAPTIVE_BLACK = "0.0"
DO_SHIFT_RGB = "1.000000"
OFFSET_STRENGTH = "0.250000"
SHIFT_R = "42.000000"
SHIFT_G = "42.000000"
SHIFT_B = "42.000000"
DO_SHIFT_RGB = "0.000000"
DO_IN_GLOW = "1.000000"
IN_GLOW_GAMMA = "2.000000"

View file

@ -2,7 +2,7 @@
DO_CCORRECTION = "1.000000"
GAMMA_OUT = "0.350000"
ADAPTIVE_BLACK = "0.0"
DO_IN_GLOW = "1.000000"
IN_GLOW_POWER = "1.000001"

View file

@ -13,16 +13,6 @@
// #define D3D_WORKAROUND
// PERFORMANCE SETTINGS /////////////////////////////////////////////////////////
//Renders only changed parts of screen, set to 1.0 to lower power consumption:
#define DELTA_RENDER 0.0
//Halve rendering refresh on bezel and ambilight set to 1.0 to spare gpu cycles:
#define HALVE_BORDER_UPDATE 0.0
// STATIC FEATURES ENABLE/DISABLE
// Allow texture wrapping as a shader parameter, prepend // to gain some performance:
@ -34,18 +24,10 @@
// APPEARANCE SETTINGS ////////////////////////////////////////////////////////
// Haloing happens on a scanlined/gapped image or not
#define HALO_PRE_SCANLINE_GAP 0.0
// The higher, the more the image will alter its size depending on the scene luminance.
#define DYNZOOM_FACTOR 80
// BEZEL STATIC CONFIG ////////////////////////////////////////////////////////
@ -64,19 +46,12 @@
//set it to minimum value that allows you to see reflection entirely
#define BEZEL_REFL_SKIP_SIZE 0.08
//This is the size (in 0..1 range) of the bezel texture that does
//not include the center tube, including reflection area, and the shadow.
//It is actually used to skip drawing game content under the bezel or
//over its shadow.
//Set it to the maximum size as long as you see the full game content
//in the bezel.
#define BEZEL_BORDER_SIZE vec2(0.07, 0.07)
//This is the blank area or shadow size (one side, in percent) at the sides of the bezel as defined by the bezel texture
//BEZEL_SHADOW_SIZE = max shadow or blank side size / bezel_texture_size.
//It is used to skip drawing bg/fg or ambient light over the tube, set it to a value that allow for them to be
//shown over the bezel blank/shadowed sides but not on the tube (ie: value too big)
#define BEZEL_SHADOW_SIZE 0.06
//This is the blank area (EXCLUDING any potential shadows) surrounding the bezel frame.
//Supposing a centered bezel:
// BEZEL_FRAME_SURROUND_MARGIN = (left margin in px*2) / bezel_texture_size width in px.
//It is used to skip drawing bg/fg or ambient light over the tube.
//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
//already know it is completely transparent.

View file

@ -45,6 +45,7 @@
// #define LUMINANCE 0.2
// #define BRIGHTNESS 0.0
// #define CONTRAST 0.0
// #define ADAPTIVE_BLACK 0.1
// #define TEMPERATURE 7700.000000
// #define IN_GLOW_GAMMA 2.000000
// #define GAMMA_OUT 0.4
@ -131,6 +132,7 @@
// #define DO_PIXELGRID_H 1.0
// #define PIXELGRID_COREY_FAKE_SCAN 0.0
// #define PIXELGRID_DOUBLESCAN 0.0
// #define PIXELGRID_MIN_H 0.300000
// #define PIXELGRID_MAX_H 0.700000
// #define PIXELGRID_GAMMA_H 5.2
@ -244,6 +246,7 @@
// #define AMBI_FALLOFF 0.40
// #define AMBI_POWER 1.8
// #define AMBI_INT_OFFSET 0.07
// #define AMBI_SMP_INT_OFFSET 0.07
// #define AMBI_STRETCH 0.0
// #define AMBI_STRETCH_VERTICAL 0.5
// #define AMBI_GAMMA 1.3
@ -275,7 +278,7 @@
// #define ASPECT_Y 3.0
// #define DO_DYNZOOM 1.0
// #define DO_DYNZOOM 0.015
// #define DO_GAME_GEOM_OVERRIDE 0.0
@ -301,6 +304,26 @@
// #define DELTA_RENDER_CHECK_AREA 1.0
////////////////////////////////////////////////////////////////////////////
//
// STATIC VALUES FOR PERFORMANCE SETTINGS
// The following are not Runtime configurable parameters
// But they are here because they are meant to push performance as well.
// They were previously defined in config-static.inc file.
//
////////////////////////////////////////////////////////////////////////////
//Renders only changed parts of screen, set to 1.0 to lower power consumption:
// #define DELTA_RENDER 1.0
//Halve rendering refresh on bezel and ambilight set to 1.0 to spare gpu cycles:
// #define HALVE_BORDER_UPDATE 1.0
//Skip random() function used for noise/debanding/bezel roughness,
//set to 1.0 to spare gpu cycles:
// #define SKIP_RANDOM 1.0
// Developer reminder: bash script to partially convert a shader preset
// edit: obsolete and incomplete since it does not recur references.
// for l in $(cat /koko/.config/retroarch/shaders/test.slangp |grep ^[A-Z] ) ; do p=$(echo $l|cut -d " " -f 1) ; v=$(echo $l | cut -d \" -f 2); echo \// #define $p $v; done

View file

@ -40,15 +40,27 @@
This is the image used to draw the bezel.
Read further for details.
Texture "sources", including the main gimp project file for the default curved and straight monitor frame
are on the following repo:
https://github.com/kokoko3k/koko-aio-slang-misc/tree/main
**Color corrections:**<br>
Modify luminance, saturation, contrast, brightness, color temperature and vibrance
of the signal, at "input" stage.<br>
Gamma in correction is applied at ti beginning of the chain,<br>
Gamma out correction is applied to the final processed picture.<br>
Input signal gain is applied in the chain just before the crt emulation stages.<br>
Modify signal color at "input" stage.<br>
Luminance, brightness, contrast and temperature:
self explanatory.
Input signal gain:
Gain applied in the chain just before the crt emulation stages.
Gamma in:
Gamma correction applied at the beginning of the chain.
Gamma out:
Gamma correction applied to the final processed picture.
Adaptive black level range:
On old CRTs the contrast was higher on high luminosity content,
and lower on low luminosity content.
This setting modulate the range of the effect; 0.0 disables it.
It is also possible to emulate a monochrome display with custom colors:
Monochrome screen colorization:
@ -314,9 +326,10 @@
...if you like slotmasks so much :-)
Vertical shift (neg = auto):
This parameter allows you to move the whole vertical mask along the Y axis.
* When used with screen resolution(*1), a negative value will auto-select a shift that gives the sharpest shape.
* When used with core resolution(*1) and integer divider/multiplier(*2), it is useful to mitigate
weird patterns from the screen when using slotmasks (*3) alongside scanline emulation (*4).
* The auto setting works with screen resolution(*1), and integer divider/multiplier(*2).
It will auto-select a shift that gives the sharpest result.
Steepness:
The more, the thinner they will be.
@ -534,10 +547,14 @@
How input gain is applied to a single led, affects light wideness.
Led saturation:
Leds saturation post gain.
Led internalness:
Internalness (Led position):
The distance between the virtual led strip and the content.
High values will move leds behind it, while lower values will move
leds around it.
Internalness (Sampling point):
Where the leds should take their color from, highering the value will make the color
follow the color of what is in the center of the screen, lowering the value will
color the leds as the edge of the screen.
Widen lights:
Dumb stretch of the visible texture, operates on the whole content, instead of the
single led.
@ -601,6 +618,7 @@
**Luminosity tied zoom:**<br>
On older CRT monitors, the picture gets bigger when the image was brighter.<br>
Please TURN THIS OFF if you want to use integer scaling, since this obstructs it.
The higher, the more prominent the effect.
**Override content geometry:**<br>
Contrary to the global aspect ratio control, this changes only the game geometry.<br>
@ -645,7 +663,7 @@
leading to a measurable power consumption reduction.<br>
This feature can, however, produce artifacts in some cases, so the feature<br>
is statically disabled by default by now.<br>
To use it, you have to manually switch, in file config-static.inc: <br>
To use it, you have to manually set to 1.0, in file config-user.txt: <br>
#define DELTA_RENDER 0.0 <br>
to <br>
#define DELTA_RENDER 1.0 <br>
@ -661,24 +679,3 @@
into account.
Power comsumption benefits will be lower.
**Alternate line blanking:**<br>
CRT monitors \*real\* refresh was amazing, today is just "meh" in most cases.<br>
This emulates the low pixel persistance of CRT monitors <br>
and reduces the motion blur, typical of LCD displays, by blanking even/odd<br>
screen lines on even/odd frames, by sacrificing image brightness, ofc.<br>
This feature is static, to use it
you have to manually enable it by removing the leading: "//"
from "//#define ALLOW_ALT_BLANK" in config-static.inc
Frame insertion strength:
How much the line will be blanked.
Dark lines period:
You can blank single line or a group of them at once.
See what performs better on your display.

View file

@ -101,6 +101,7 @@ float_framebuffer0 = true
scale_x1 = 2.0
scale_y1 = 2.0
wrap_mode1 = "mirrored_repeat"
float_framebuffer1 = true
@ -208,7 +209,7 @@ float_framebuffer7 = true
scale8 = 0.5
wrap_mode8 = "mirrored_repeat"
mipmap_input8 = false
float_framebuffer8 = "true"
# The following passes will blur the mirrored part of first_pass

View file

@ -7,7 +7,7 @@
#define PastSampler ambi_temporal_passFeedback
#define smp_internalness 0.07 //The distance between the screen border and the color sampling point
#define smp_internalness AMBI_SMP_INT_OFFSET //The distance between the screen border and the color sampling point
#define leds_per_strip 8 //How many leds per border
#define radius 0.001 //The base radius of the emitted light (tuned by user parameter later)
@ -85,7 +85,7 @@ void main() {
if (DO_BEZEL > 0.5)
pre_pass_coords = zoomout_coords(pre_pass_coords, -get_BEZEL_INNER_ZOOM() , 1.0);
pre_pass_coords = zoomout_coords(pre_pass_coords, -get_BEZEL_INNER_ZOOM());
//Every cycle counts!

View file

@ -37,7 +37,7 @@ void main() {
vReduced_sample_time_is_now = mod(params.FrameCount,AMBI_AVGLUM_DIVIDER);
vAvglum_needed = DO_AMBILIGHT + DO_BEZEL + DO_DYNZOOM + DO_BLOOM;
vAvglum_needed = DO_AMBILIGHT + DO_BEZEL + (DO_DYNZOOM*10.0) + DO_BLOOM + (RESSWITCH_GLITCH_SIZE*10.0) ;
vBezel_or_Bloom = DO_BEZEL + DO_BLOOM;
//RESSWITCH shaking:
@ -73,11 +73,15 @@ layout(set = 0, binding = 3) uniform sampler2D avglum_passFeedback;
#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;
mip = apply_fuzzy_main_pass_stage_2(mip, vFuzzy_main_pass_stage_1);
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;
return rgb_to_gray(mip);
}
//0.1 seems like a good tradeoff that works well with bloom exposire and fullscreen zoom
//...maybe bloom exposure works best at 0.05; you may consider another zone of smooth sampling.
@ -86,7 +90,8 @@ float get_avg_lum_from_mip() {
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
* 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
*
* anything else: continuous sampling
@ -94,7 +99,7 @@ float get_avglum() {
bool reduced_sampling_co = is_first_inside_rect(vTexCoord, vec4(0.24,0.24 , 0.26,0.26) );
bool smoothed_sampling_co = is_first_inside_rect(vTexCoord, vec4(0.74,0.74 , 0.76,0.76) );
bool smoothed_sampling_co_nocc = is_first_inside_rect(vTexCoord, vec4(0.49,0.49 , 0.51,0.51)) ;
#ifndef D3D_WORKAROUND
if (reduced_sampling_co) {
//in the reduced sampling zone, only update at right time; else return the previous frame.
@ -109,6 +114,10 @@ float get_avglum() {
if (smoothed_sampling_co) {
return mix(texture(avglum_passFeedback,vTexCoord).a, get_avg_lum_from_mip(), SMOOTHNESS_SPEED);
}
if (smoothed_sampling_co_nocc) {
return mix(texture(avglum_passFeedback,vTexCoord).a, get_avg_lum_from_mip_nocc(), SMOOTHNESS_SPEED);
}
#endif
//Outside specific areas, update continuously; this is used by bezel highlights.

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)
#define DEBUG_COLOR vec3(1,0,0)
#define DEBUG_BLINK_TIME 100
#define DEBUG_GRADIENT_STEPS 64
@ -20,11 +20,11 @@
//#define DEBUG
//#define DEBUG_COLOR_CALIB
//#define DEBUG_TIME_FADE
//#define DEBUG_SOLID_COLOR
#define DEBUG_SOLID_COLOR
//#define DEBUG_STEP_GRADIENT
//#define DEBUG_STEP_GRADIENT_V
//#define DEBUG_BLINK
#define DEBUG_BLINK_CIRCLE
//#define DEBUG_BLINK_CIRCLE
//#define DEBUG_WALKING_CIRCLE
//#define DEBUG_COLORWHEEL
@ -117,8 +117,9 @@ layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source;
layout(set = 0, binding = 3) uniform sampler2D colortools_and_ntsc_passFeedback;
#ifndef D3D_WORKAROUND
layout(set = 0, binding = 4) uniform sampler2D avglum_passFeedback;
#endif
vec3 colorwheel(vec2 uv){
float timeoffset = params.FrameCount / 120.0;
@ -217,7 +218,7 @@ vec3 debug() {
#elif defined DEBUG_BLINK_CIRCLE
vec2 center = vTexCoord - vec2(0.5,0.5);
float radius = 0.1;
float radius = 0.2;
pixel_debug = vec3(1 - step(radius, length(center)));
pixel_debug *= float( ( mod(params.FrameCount, DEBUG_BLINK_TIME * 2) < DEBUG_BLINK_TIME));
pixel_debug *= DEBUG_COLOR;
@ -259,10 +260,16 @@ vec3 debug() {
}
bool first_in_range(float a, float lo, float hi) {
return (a > lo) && (a < hi);
bool first_in_range_strict(float a, float lo, float hi) {
// return a inside ]lo...hi[ (lo and hi not included in range)
float bounded = clamp(a, lo+eps, hi-eps);
return a == bounded;
}
/*bool first_in_range_strict(float a, float lo, float hi) {
return (a >= lo) && (a <= hi);
}*/
vec3 pixel_dedither(sampler2D tex, vec2 coords, vec4 sourcesize, float tmin, float tmax, float strength1, float strength2) {
#define DX sourcesize.z
#define DY sourcesize.w
@ -281,7 +288,7 @@ vec3 pixel_dedither(sampler2D tex, vec2 coords, vec4 sourcesize, float tmin, flo
vec3 pxe = texture(tex, coords + vec2(+DX*2.0,0.0)).rgb; // oxoxO
float dx1= dot(abs(pxb-pxa), vec3(1.0));
if (first_in_range(dx1,tmin,tmax) && pxa == pxc && (pxb == pxd || pxb == pxe)) {
if (first_in_range_strict(dx1,tmin,tmax) && pxa == pxc && (pxb == pxd || pxb == pxe)) {
avg_x = (pxa+pxb) /2.0;
accum_div1 += 1.0;
}
@ -295,7 +302,7 @@ vec3 pixel_dedither(sampler2D tex, vec2 coords, vec4 sourcesize, float tmin, flo
vec3 pye = texture(tex, coords + vec2(0.0, +DY*2.0)).rgb;
float dy1= dot(abs(pya-pyb), vec3(1.0));
if (first_in_range(dy1,tmin,tmax) && pya == pyc && (pyb == pyd || pyb == pye)) {
if (first_in_range_strict(dy1,tmin,tmax) && pya == pyc && (pyb == pyd || pyb == pye)) {
avg_y = (pya+pyb) /2.0;
accum_div1 += 1.0;
}
@ -311,8 +318,9 @@ vec3 pixel_dedither(sampler2D tex, vec2 coords, vec4 sourcesize, float tmin, flo
vec3 pxye = texture(tex, coords + vec2(-DX*2.0, -DY*2.0)).rgb;
float dxy1= dot(abs(pxyb-pxya), vec3(1.0));
if (first_in_range(dxy1,tmin,tmax) && pxya == pxyc && (pxyb == pxyd || pxyb == pxye)) {
avg_xy = (pxya+pxyb) / 2.0;
if (first_in_range_strict(dxy1,tmin,tmax) && pxya == pxyc && (pxyb == pxyd || pxyb == pxye)) {
//avg_xy = (pxya+pxyb) / 2.0;
avg_xy = fma(pxya, vec3(0.5), pxyb*vec3(0.5));
accum_div2 += 1.0;
}
@ -324,8 +332,9 @@ vec3 pixel_dedither(sampler2D tex, vec2 coords, vec4 sourcesize, float tmin, flo
float dxy12= dot(abs(pxyb2-pxya2), vec3(1.0));
if (first_in_range(dxy12,tmin,tmax) && pxya2 == pxyc2 && (pxyb2 == pxyd2 || pxyb2 == pxye)) {
avg_yx = (pxya2+pxyb2) / 2.0;
if (first_in_range_strict(dxy12,tmin,tmax) && pxya2 == pxyc2 && (pxyb2 == pxyd2 || pxyb2 == pxye)) {
//avg_yx = (pxya2+pxyb2) / 2.0;
avg_yx = fma(pxya2, vec3(0.5), pxyb2*vec3(0.5));
accum_div2 += 1.0;
}
}
@ -336,11 +345,14 @@ vec3 pixel_dedither(sampler2D tex, vec2 coords, vec4 sourcesize, float tmin, flo
//pixel_out = mix(p0, (avg_x + avg_y + avg_xy + avg_yx) / accum_div, strength1);
//}
vec3 pixel_out = p0;
if (accum_div1 > 0.0)
pixel_out = mix(pixel_out, (avg_x + avg_y) / accum_div1, strength1);
if (accum_div2 > 0.0)
pixel_out = mix(pixel_out, (avg_xy + avg_yx) / accum_div2, strength2);
if (accum_div1 > 0.0) {
//pixel_out = mix(pixel_out, (avg_x + avg_y) / accum_div1, strength1);
pixel_out = mix(pixel_out, fma(avg_x, vec3(1.0)/accum_div1, avg_y / accum_div1) , strength1); //ASM PROOF FASTER
}
if (accum_div2 > 0.0) {
//pixel_out = mix(pixel_out, (avg_xy + avg_yx) / accum_div2, strength2);
pixel_out = mix(pixel_out, fma(avg_xy, vec3(1.0)/accum_div2, avg_yx / accum_div2 ) , strength2); //ASM PROOF FASTER
}
return pixel_out;
}
@ -386,12 +398,13 @@ vec3 persistence(vec3 feedback, vec3 pixel_now, float start_decay, float late_pe
vec3 diff=(feedback - pixel_now);
vec3 speed_fast = diff * start_decay;
vec3 speed_slow = diff / (late_persistence+eps);
vec3 speed_slow = diff / (late_persistence+eps); //fma() not usable pr slower.
vec3 fade_speed = mix(speed_slow, speed_fast, diff );
//higher speed is needed when composing over brighter colors to avoid motion blur
fade_speed = fade_speed + (pixel_now*motion_blur_cancel);
//fade_speed = fma(pixel_now, vec3(motion_blur_cancel), vec3(fade_speed)); //ASM PROOF: SLOWER
//Ensure a minimum speed to reach 0.0 and clamp to 1.0 to avoid funky effects
float min_speed = 0.05 ;
@ -412,7 +425,8 @@ void main() {
vec2 co = vTexCoord;
#ifndef D3D_WORKAROUND
float shake = texture(avglum_passFeedback, RESSWITCH_SAMPLING_POINT).a;
co.y += sin(shake * 2 * pi) * RESSWITCH_GLITCH_SIZE;
//co.y += sin(shake * 2 * pi) * RESSWITCH_GLITCH_SIZE;
co.y = co.y + (sin(shake * 2 * pi) * RESSWITCH_GLITCH_SIZE);
#endif
vec3 pixel_in = texture(Source, co).rgb;
@ -425,7 +439,8 @@ void main() {
//Get ntsc picture
vec4 ntsc_decoded = ntscdec(co, pixel_in);
//apply the minimum treshold to artifact mask
artifact_mask = smoothstep(NTSC_ARTF_TRSH, 1.0, ntsc_decoded.a);
artifact_mask = smoothstep_fast(NTSC_ARTF_TRSH , 1.0, ntsc_decoded.a);
ntsc_decoded = clamp(ntsc_decoded, vec4(0.0), vec4(1.0));
//Optionally completely cut-off artifacts under treshold:
@ -451,8 +466,15 @@ void main() {
#endif
if (DO_CCORRECTION == 1.0)
if (DO_CCORRECTION == 1.0) {
pixel_out = color_tools(pixel_out, vTemperature_rgb);
#ifndef D3D_WORKAROUND
if (ADAPTIVE_BLACK > 0.0) {
float avglum = texture(avglum_passFeedback, vec2(0.5,0.5)).a ;
pixel_out = adaptive_black(pixel_out, avglum, ADAPTIVE_BLACK);
}
#endif
}
if (DO_DOT_MATRIX + DOT_M_MBLUR_STR > 1.0) {
vec3 feedback = texture(colortools_and_ntsc_passFeedback, co).rgb;
@ -464,6 +486,7 @@ void main() {
vec3 adaption = mix_step (pixel_out - feedback,
feedback - pixel_out,
DOT_M_MBLUR_MODE -1);
//adaption = mix_step(adaption, -adaption, DOT_M_MBLUR_MODE -1);
m_blur_adapted *= clamp( adaption, 0.0, 1.0 );
m_blur_adapted = pow(m_blur_adapted, vec3(0.25));
@ -488,24 +511,13 @@ void main() {
pixel_out = persistence(feedback, pixel_out, PPERSISTENCE_START, PPERSISTENCE_END, motion_blur_cancel);
}
//TEST adaptive strobe:
/*float range = ALT_BLANK_STRENGTH;
float square_wave_time = float(mod(params.FrameCount, 2.0) == 1.0);
square_wave_time = square_wave_time*2-1;
vec3 square_wave_time_vec3 = vec3(square_wave_time);
square_wave_time_vec3 *= min( pixel_out, 1-pixel_out) * ALT_BLANK_STRENGTH;
if (mod(co.y * params.OriginalSize.y, ALT_BLANK_PERIOD) >= ALT_BLANK_PERIOD / 2.0) {;
pixel_out = pixel_out + square_wave_time_vec3;
} else {
pixel_out = pixel_out - square_wave_time_vec3;
}*/
//Clamp artifacts to 0..1
//Clamp RGB to 0..1000.0
pixel_out = max(pixel_out, vec3(0.0));
artifact_mask = clamp(artifact_mask, 0.0, 1.0);
FragColor = vec4(pixel_out, artifact_mask);
//FragColor = vec4(artifacts);
}

View file

@ -25,6 +25,10 @@
#define CONTRAST global.CONTRAST
#endif
#ifndef ADAPTIVE_BLACK
#define ADAPTIVE_BLACK global.ADAPTIVE_BLACK
#endif
#ifndef BRIGHTNESS
#define BRIGHTNESS global.BRIGHTNESS
#endif
@ -485,6 +489,10 @@
#define AMBI_INT_OFFSET params.AMBI_INT_OFFSET
#endif
#ifndef AMBI_SMP_INT_OFFSET
#define AMBI_SMP_INT_OFFSET params.AMBI_SMP_INT_OFFSET
#endif
#ifndef ASPECT_X
#define ASPECT_X global.ASPECT_X
#endif
@ -683,14 +691,6 @@
#define PIXELGRID_GAMMA_H global.PIXELGRID_GAMMA_H
#endif
#ifndef PIXELGRID_SMOOTH_W
#define PIXELGRID_SMOOTH_W global.PIXELGRID_SMOOTH_W
#endif
#ifndef PIXELGRID_SMOOTH_H
#define PIXELGRID_SMOOTH_H global.PIXELGRID_SMOOTH_H
#endif
#ifndef PIXELGRID_MUL_X
#define PIXELGRID_MUL_X global.PIXELGRID_MUL_X
#endif

View file

@ -11,7 +11,8 @@ layout(push_constant) uniform Push {
vec4 OutputSize;
vec4 avglum_passFeedbackSize;
uint FrameCount;
uint Rotation;
float HALO_SHARPNESS ;
float HALO_NO_PREGAIN;
float HALO_POWER ;
@ -24,6 +25,7 @@ layout(push_constant) uniform Push {
float AMBI_STRETCH;
float AMBI_STRETCH_VERTICAL;
float AMBI_INT_OFFSET ;
float AMBI_SMP_INT_OFFSET ;
} params;
@ -82,6 +84,7 @@ layout(std140, set = 0, binding = 0) uniform UBO {
float LUMINANCE;
float VIBRANCE;
float CONTRAST;
float ADAPTIVE_BLACK;
float BRIGHTNESS;
float TEMPERATURE;
@ -207,8 +210,9 @@ layout(std140, set = 0, binding = 0) uniform UBO {
float PIXELGRID_MAX_H;
float PIXELGRID_MAX_W;
float PIXELGRID_SIZE_W;
float PIXELGRID_SMOOTH_H;
float PIXELGRID_SMOOTH_W;
float PLACEHOLDER1; //2fps lost if deleted (!)
float PLACEHOLDER2; //2fps lost if deleted (!)
float PIXELGRID_MUL_X;
@ -276,16 +280,17 @@ layout(std140, set = 0, binding = 0) uniform UBO {
} global;
#pragma parameter PRETEXT2 "Read the documentation in docs-ng.md text file" 0.0 0.0 0.0 1.0
#pragma parameter PRETEXT3 "==================================================" 0.0 0.0 0.0 1.0
#pragma parameter PRETEXT4 " " 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 1.0
#pragma parameter LABEL0001 "==================================================" 0.0 0.0 0.0 1.0
#pragma parameter LABEL0002 " " 0.0 0.0 0.0 1.0
// Color correction
#pragma parameter DO_CCORRECTION "★ Color corrections enable? (co) ==>" 0.0 0.0 1.0 1.0
#pragma parameter IN_GLOW_POWER " Input signal gain (was in glow section):" 1.0 0.0 5.0 0.05
#pragma parameter IN_GLOW_POWER " Input signal gain" 1.0 0.0 5.0 0.05
#pragma parameter LUMINANCE " Luminance push (>1.0=clip)" 0.0 0.0 1.5 0.05
#pragma parameter BRIGHTNESS " Brightness in (0.0=off)" 0.0 -1.0 1.0 0.01
#pragma parameter CONTRAST " Contrast in (0.0=off)" 0.0 -1.0 1.0 0.01
#pragma parameter ADAPTIVE_BLACK " Adaptive black level range" 0.0 0.0 1.0 0.01
#pragma parameter TEMPERATURE " Temperature in (6500=off)" 6500.0 3000 14000.0 50.0
#pragma parameter IN_GLOW_GAMMA " Gamma In (applied at the beginning)" 1.0 1.0 10.0 0.1
#pragma parameter GAMMA_OUT " Gamma out (applied at the end)" 0.69 0.1 4.0 0.01
@ -295,19 +300,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 BLANK1 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0003 " " 0.0 0.0 1.0 1.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 BLANK2 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0004 " " 0.0 0.0 1.0 1.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 BLANK4 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0005 " " 0.0 0.0 1.0 1.0
// Dedithering
#pragma parameter DO_DEDITHER "★ Dedither enable? (not with NTSC artifacts) ==>" 0.0 0.0 1.0 1.0
@ -315,7 +320,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 BLANK_4 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0006 " " 0.0 0.0 1.0 1.0
// NTSC color artifacting
#pragma parameter DO_NTSC_ARTIFACTS "★ CVBS: NTSC color artifacts enable? (nt) ==>" 0.0 0.0 1.0 1.0
@ -331,7 +336,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 BLANK3 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0007 " " 0.0 0.0 1.0 1.0
// YIQ/YUV bandwidth limited chroma bleeding.
@ -340,14 +345,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 BLANK5 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0008 " " 0.0 0.0 1.0 1.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 BLANK5a " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0009 " " 0.0 0.0 1.0 1.0
//Deconvergence
#pragma parameter DO_SHIFT_RGB "★ Deconvergence enable? (de) ==>" 0.0 0.0 1.0 1.0
@ -355,7 +360,7 @@ 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 BLANK6 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0010 " " 0.0 0.0 1.0 1.0
@ -365,30 +370,30 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter IN_GLOW_SPREAD " Glow spread amount" 0.6 0.0 4.0 0.05
#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 BLANK7 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0011 " " 0.0 0.0 1.0 1.0
#pragma parameter TATE "★ Tate mode (0:disabled 1:auto 2:forced)" 1.0 0.0 2.0 1.0
#pragma parameter BLANK7a " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0012 " " 0.0 0.0 1.0 1.0
#pragma parameter RESSWITCH_GLITCH_SIZE "★ Glitch if vertical resolution changes" 0.1 0.0 0.5 0.05
#pragma parameter BLANK71aa " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0013 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL_INTERLACE "★ Hi-resolution scanlines handling" 0.0 0.0 0.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 LabelDescIntlScan1 " (-2: Faker-Interlaced, -1: Fake-Interlaced)" 0.0 0.0 0.0 0.0
#pragma parameter LabelDescIntlScan2 " ( 0: Interlaced, 1: No scanlines, 2: Don't interlace)" 0.0 0.0 0.0 0.0
#pragma parameter LABEL0036 " (-2: Faker-Interlaced, -1: Fake-Interlaced)" 0.0 0.0 0.0 0.0
#pragma parameter LABEL0037 " ( 0: Interlaced, 1: No scanlines, 2: Don't interlace)" 0.0 0.0 0.0 0.0
#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 BLANK12e " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0014 " " 0.0 0.0 1.0 1.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 BLANK12ff " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0015 " " 0.0 0.0 1.0 1.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
@ -404,14 +409,14 @@ 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 BLANK12f " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0016 " " 0.0 0.0 1.0 1.0
#pragma parameter DO_PIXELGRID_W " ★ Horizontal mask (0 to disable)" 1.0 0.0 1.0 0.05
#pragma parameter PIXELGRID_SIZE_W " . Resolution: (core or screen)" 1.0 0.0 1.0 1.0
#pragma parameter PIXELGRID_MUL_X " . Cell size multiplier x (neg=divider):" 1.0 -8.0 8.0 0.125
#pragma parameter PIXELGRID_H_PRST " . Mask type preset (0: for manual)" 3.0 0.0 7.0 1.0
#pragma parameter PG_LABEL1 " (1:gm 2:gmx 3:rgb 4:rgbx 5:rbg 6:rbgx 7:wx)" 0.0 0.0 0.0 0.0
#pragma parameter LABEL0038 " (1:gm 2:gmx 3:rgb 4:rgbx 5:rbg 6:rbgx 7:wx)" 0.0 0.0 0.0 0.0
#pragma parameter PIXELGRID_H_COUNT " . 0: Phosphors+gap count (mask size)" 3.0 1.0 4.0 1.0
#pragma parameter PIXELGRID_R_SHIFT " . 0: R phospor position" 0.0 0.0 4.0 0.1
#pragma parameter PIXELGRID_G_SHIFT " . 0: G phospor position" 1.0 0.0 4.0 0.1
@ -421,7 +426,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 BLANK12fs " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0017 " " 0.0 0.0 1.0 1.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
@ -432,14 +437,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 BLANK12d " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0018 " " 0.0 0.0 1.0 1.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 BLANK132d " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0019 " " 0.0 0.0 1.0 1.0
// Dot matrix emulation
@ -453,7 +458,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 BLANK12c " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0020 " " 0.0 0.0 1.0 1.0
@ -466,7 +471,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 BLANK10 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0021 " " 0.0 0.0 1.0 1.0
@ -482,7 +487,7 @@ 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 BLANK13 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0022 " " 0.0 0.0 1.0 1.0
@ -492,7 +497,7 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#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 BLANK14 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0023 " " 0.0 0.0 1.0 1.0
@ -514,13 +519,13 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter BEZEL_CORNER_DARK " Darken corners" 0.8 0.0 1.0 0.05
#pragma parameter BLANK15 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0024 " " 0.0 0.0 1.0 1.0
//Background Image
#pragma parameter DO_BG_IMAGE "★ Back/Foreground image enable? (ba) ==>" 0.0 0.0 1.0 1.0
#pragma parameter LABEL_WARNING1 " !! RetroArch aspect needs to be set to Full" 1.0 1.0 1.0 1.0
#pragma parameter LABEL0039 " !! RetroArch aspect needs to be set to Full" 1.0 1.0 1.0 1.0
#pragma parameter BG_IMAGE_OVER " Image over content (alpha channel driven)?" 0.0 0.0 1.0 1.0
#pragma parameter BG_IMAGE_OFFX " Shift Image over X axis" 0.0 -1.0 1.0 0.0005
#pragma parameter BG_IMAGE_OFFY " Shift Image over Y axis" 0.0 -1.0 1.0 0.0005
@ -528,24 +533,25 @@ 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 BLANK16 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0025 " " 0.0 0.0 1.0 1.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 BLANK161 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0026 " " 0.0 0.0 1.0 1.0
//Back leds
//Emulates leds under the monitor frame that slowly reacts to image contents
#pragma parameter DO_AMBILIGHT "★ Ambient light leds enable? (am) ==> " 1.0 0.0 1.0 1.0
#pragma parameter LABEL_WARNING3 " !! RetroArch aspect needs to be set to Full" 1.0 1.0 1.0 1.0
#pragma parameter LABEL0040 " !! RetroArch aspect needs to be set to Full" 1.0 1.0 1.0 1.0
#pragma parameter AMBI_STEPS " Slowness" 60.0 5.0 1000.0 5.0
#pragma parameter AMBI_FALLOFF " Led power/falloff" 0.4 0.1 3.0 0.01
#pragma parameter AMBI_POWER " Led Saturation" 1.8 0.0 100.0 0.05
#pragma parameter AMBI_INT_OFFSET " Led internalness" 0.07 -1.0 1.0 0.01
#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_GAMMA " Output Gamma" 1.3 0.1 8.0 0.1
@ -554,7 +560,7 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#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 BLANK17 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0027 " " 0.0 0.0 1.0 1.0
@ -566,9 +572,9 @@ 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 1.0 0.01
#pragma parameter S_POWER " Power" 0.1 0.05 2.0 0.01
#pragma parameter BLANK19 " " 0.0 0.0 1.0 1.0
#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 LABEL0028 " " 0.0 0.0 1.0 1.0
@ -577,7 +583,7 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter GLOBAL_OFFX " X axis shift " 0.0 -1.0 1.0 0.0005
#pragma parameter GLOBAL_OFFY " Y axis shift " 0.0 -1.0 1.0 0.0005
#pragma parameter GLOBAL_ZOOM " Zoom" 2.0 0.0 3.0 0.0005
#pragma parameter BLANK21 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0029 " " 0.0 0.0 1.0 1.0
@ -585,23 +591,20 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#pragma parameter label_ar "★ Aspect Ratio (as) " 0.0 0.0 0.0 1.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 BLANK22 " " 0.0 0.0 1.0 1.0
#pragma parameter label_aspect_presets " Presets reference list:" 0.0 0.0 0.0 1.0
#pragma parameter label_aspect_preset0 " (0 = MAME 1.33)" 0.0 0.0 0.0 1.0
#pragma parameter label_aspect_preset1 " (-1 = NTSC 1.5)" 0.0 0.0 0.0 1.0
#pragma parameter label_aspect_preset2 " (-2 = PAL 1.25)" 0.0 0.0 0.0 1.0
#pragma parameter label_aspect_preset3 " (-3 = Snes 8/7)" 0.0 0.0 0.0 1.0
#pragma parameter label_aspect_preset4 " (-4 = Megadrive 10/7)" 0.0 0.0 0.0 1.0
#pragma parameter label_aspect_preset5 " (-5 = Uncorrected)" 0.0 0.0 0.0 1.0
#pragma parameter label_aspect_preset6 " (-6 = MAME rotated/TATE 0.75)" 0.0 0.0 0.0 1.0
#pragma parameter BLANK23 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0042 " " 0.0 0.0 1.0 1.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
#pragma parameter LABEL0046 " (-2 = PAL 1.25)" 0.0 0.0 0.0 1.0
#pragma parameter LABEL0047 " (-3 = Snes 8/7)" 0.0 0.0 0.0 1.0
#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
//Modulate the image zooming depending on the image luminosity.
//You can lower the effect power through the DYNZOOM_FACTOR parameter.
#pragma parameter DO_DYNZOOM "★ Luminosity tied zoom (!!OBSTRUCTS integer scale!!) ==>" 1.0 0.0 1.0 1.0
//Ditched and hardcoded to 80 in config.globals.inc.
//#pragma parameter DYNZOOM_FACTOR " Narrowness" 80.0 15.0 120.0 0.5
#pragma parameter BLANK18 " " 0.0 0.0 1.0 1.0
#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
//Content geomerty overrides
@ -609,41 +612,55 @@ layout(std140, set = 0, binding = 0) uniform UBO {
#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 LABEL_WARNING44 " !! Switch off luminosity tied zoom to use integer scaling" 1.0 1.0 1.0 1.0
#pragma parameter LABEL_WARNING4 " !! The following will override integer scale" 1.0 1.0 1.0 1.0
#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 BLANK20 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0033 " " 0.0 0.0 1.0 1.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 BLANK_01 " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0034 " " 0.0 0.0 1.0 1.0
//Delta render
#pragma parameter label_dr11 " !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" 0.0 0.0 0.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 BLANK_DR " " 0.0 0.0 1.0 1.0
#pragma parameter LABEL0035 " " 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
//#pragma parameter SERVICE2 "Don't use me, for debug purposes only" 0.5 -1.0 1.0 0.01
//#pragma parameter SERVICE3 "Don't use me, for debug purposes only" 0.5 -1.0 1.0 0.01
// This is for a patched retroarch version I'm testing (24/03/04)
#pragma inject_preset_code DEFINES_FROM_PRESET
//User parameters goes here, they overrides almost everything:
#include "../config/config-user.txt"
//Following translates global.PARAMETER to PARAMETER
// The following translates global.PARAMETER to PARAMETER
#include "config.globals.inc"
// 2014-Jan-25
// Since we moved some mandatory defines from config-static.inc to config-user.txt
// It is possible that users overriding config-user.txt will run into errors
// if they don't check for updated config-user.
// Brave users don't deserve any headaches, so put some safety checks here.
#ifndef DELTA_RENDER
#define DELTA_RENDER 0.0
#endif
#ifndef HALVE_BORDER_UPDATE
#define HALVE_BORDER_UPDATE 0.0
#endif
#ifndef SKIP_RANDOM
#define SKIP_RANDOM 0.0
#endif

View file

@ -1,5 +1,6 @@
#version 450
/* This pass:
* Composes the previous passes
* Does masks, spot, bezel, vignette, background image (anything else?)
@ -70,7 +71,7 @@ layout(location = 25) out float vPG_y_shift;
#define PI_15 4.71238898038469 //pi*1.5
vec2 get_bg_image_coords(vec2 in_vOutputCoord) {
vec2 get_bg_image_coords(vec2 in_vOutputCoord, bool isrotated) {
vec2 bg_img_coords = in_vOutputCoord;
// 0 = auto
@ -79,7 +80,7 @@ vec2 get_bg_image_coords(vec2 in_vOutputCoord) {
// <-1 = manual rotation for rotated games
//Auto rotation, no user change allowed:
if (BG_IMAGE_ROTATION == 0.0 && bool(vIsRotated) ) {
if (BG_IMAGE_ROTATION == 0.0 && isrotated ) {
//handle automatic rotation of bg image for rotated games
bg_img_coords.xy = bg_img_coords.yx;
bg_img_coords.y = 1 - bg_img_coords.y;
@ -126,7 +127,7 @@ vec2 get_bg_image_coords(vec2 in_vOutputCoord) {
return bg_img_coords;
}
vec2 get_zooms_modifier(float do_tate, bool bNeed_NO_integer_scale) {
vec2 get_zooms_modifier(float do_tate, bool bNeed_NO_integer_scale, bool isrotated) {
// This function is meant to live in vertex shader; its purpose is to
// give the final scale factor by taking in consideration various zoom modifiers.
//It works by calculating the new 0.0 and 1.0 coords then measuring the new distance between them
@ -139,11 +140,11 @@ vec2 get_zooms_modifier(float do_tate, bool bNeed_NO_integer_scale) {
vec2 co_scaled_max = vec2(1.0);
if ( bNeed_NO_integer_scale ) {
co_scaled_min = get_scaled_coords_aspect(co_scaled_min, global.FinalViewportSize, vIn_aspect, bool(vIsRotated));
co_scaled_max = get_scaled_coords_aspect(co_scaled_max, global.FinalViewportSize, vIn_aspect, bool(vIsRotated));
co_scaled_min = get_scaled_coords_aspect(co_scaled_min, global.FinalViewportSize, vIn_aspect, isrotated);
co_scaled_max = get_scaled_coords_aspect(co_scaled_max, global.FinalViewportSize, vIn_aspect, isrotated);
} else {
co_scaled_min = integer_scale(co_scaled_min, vIn_aspect, bool(vIsRotated), do_tate, GAME_GEOM_INT_SCALE-1.0 );
co_scaled_max = integer_scale(co_scaled_max, vIn_aspect, bool(vIsRotated), do_tate, GAME_GEOM_INT_SCALE-1.0 );
co_scaled_min = integer_scale(co_scaled_min, vIn_aspect, isrotated, do_tate, GAME_GEOM_INT_SCALE-1.0 );
co_scaled_max = integer_scale(co_scaled_max, vIn_aspect, isrotated, do_tate, GAME_GEOM_INT_SCALE-1.0 );
}
@ -153,8 +154,8 @@ vec2 get_zooms_modifier(float do_tate, bool bNeed_NO_integer_scale) {
(co_scaled_max * (1-DO_GLOBAL_SHZO) );
if (DO_BEZEL == 1.0) {
co_scaled_min = zoomout_coords(co_scaled_min, -vBEZEL_INNER_ZOOM_adapted , 1.0);
co_scaled_max = zoomout_coords(co_scaled_max, -vBEZEL_INNER_ZOOM_adapted , 1.0);
co_scaled_min = zoomout_coords(co_scaled_min, -vBEZEL_INNER_ZOOM_adapted);
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);
@ -175,22 +176,19 @@ void main() {
vDo_Tate = need_tate(bIsRotated);
if ( (TATE == 1.0 && bIsRotated) || TATE == 2.0)
vDo_Tate = 1.0;
else
vDo_Tate = 0.0;
vIn_aspect = get_in_aspect();
//Calculate vTexcoord as fractional or integer scaled?
bool bNeed_NO_integer_scale = need_NO_integer_scale();
if ( bNeed_NO_integer_scale )
vTexCoord = get_scaled_coords_aspect(TexCoord,global.FinalViewportSize, vIn_aspect, bool(vIsRotated));
vTexCoord = get_scaled_coords_aspect(TexCoord,global.FinalViewportSize, vIn_aspect, bIsRotated);
else
vTexCoord = integer_scale(TexCoord, vIn_aspect, bool(vIsRotated), vDo_Tate, GAME_GEOM_INT_SCALE-1.0 ) + vec2( GAME_GEOM_OFF_FIX /10000);
vTexCoord = integer_scale(TexCoord, vIn_aspect, bIsRotated, vDo_Tate, GAME_GEOM_INT_SCALE-1.0 ) + vec2( GAME_GEOM_OFF_FIX /10000);
vTexCoord.y = vTexCoord.y + 0.00001;
vTexCoord += 0.00001;
//if (DO_GLOBAL_SHZO >0.5)
// vTexCoord = zoom(vTexCoord + vec2(-GLOBAL_OFFX, -GLOBAL_OFFY), GLOBAL_ZOOM );
@ -200,20 +198,12 @@ void main() {
vOutputCoord = TexCoord ;
vBg_img_coords = get_bg_image_coords(vOutputCoord);
vec2 vFragCoord = vec2( floor(vOutputCoord.x * params.OutputSize.x),
floor(vOutputCoord.y * params.OutputSize.y));
vBg_img_coords = get_bg_image_coords(vOutputCoord, bIsRotated);
vBEZEL_INNER_ZOOM_adapted = get_BEZEL_INNER_ZOOM() * DO_BEZEL;
//Help scanline/pixelgrid code too:
bool bIs_Interlaced = is_interlaced();
float fIsInterlaced = float(bIs_Interlaced);
//Scanline period:
vScanlinePeriod = 1.0; //Base 1x period
@ -261,24 +251,23 @@ void main() {
//Pixelgrid: Calc base freqs
//Tate ?
vPG_OutputSize_tated = params.OutputSize.xy;
vPG_OutputCoord_tated = vOutputCoord.xy + vec2(0.00001);
vPG_OriginalSize_tated_mul_pi = params.OriginalSize.xy;
if (vDo_Tate == 1.0) {
if (vDo_Tate == 0.0) {
vPG_OutputSize_tated = params.OutputSize.xy;
vPG_OutputCoord_tated = vOutputCoord.xy + vec2(0.00001);
vPG_OriginalSize_tated_mul_pi = params.OriginalSize.xy * pi;
} else {
vPG_OutputSize_tated = params.OutputSize.yx;
vPG_OutputCoord_tated = vOutputCoord.yx;
vPG_OriginalSize_tated_mul_pi = params.OriginalSize.yx;
vPG_OriginalSize_tated_mul_pi = params.OriginalSize.yx * pi;
}
vPG_OriginalSize_tated_mul_pi *= pi;
// screen coords needs flooring, but unfortunately floor() does not work well in vertex shader, so calc as much as possible without floor()
vPG_period_multiplier_x = 1/PIXELGRID_MUL_X;
vPG_freq_base_screen = pi * vec2(1/PG_H_COUNT, 0.5);
// screen coords needs flooring, but unfortunately floor() does not work well in vertex shader, so calc as much as possible without floor()
vPG_period_multiplier_x = 1/PIXELGRID_MUL_X;
vPG_freq_base_screen = pi * vec2(1/PG_H_COUNT, 0.5);
//the following unfloored coords are needed by sin/cos later to understand if we are on an even or odd mask
vPG_freq_base_screen_unfloored = pi * vec2(1/PG_H_COUNT, 0.5) * (vPG_OutputCoord_tated * vPG_OutputSize_tated);
//the following unfloored coords are needed by sin/cos later to understand if we are on an even or odd mask
vPG_freq_base_screen_unfloored = pi * vec2(1/PG_H_COUNT, 0.5) * (vPG_OutputCoord_tated * vPG_OutputSize_tated);
//pixelgrid: doublescan?
if (need_doublescan() )
@ -299,7 +288,7 @@ void main() {
(fract(1.0/vPG_mask_height) == 0.0); //only when the multiplier is integer
if (y_mask_align_to_screen_lines ) {
vPG_y_shift = vPG_mask_height * pi / 4.0;
vPG_y_shift = vPG_mask_height * (pi / 4.0);
} else {
vPG_y_shift = PIXELGRID_Y_MASK_SHIFT * pi ;
}
@ -315,7 +304,7 @@ void main() {
//For simplicity and (my) mental health, take only y into account.
vDotMat_Grid_Sharpness = DOT_M_G_SHARP;
if (DOT_M_G_SHARP == 0.0) {
float zooms_modifier = get_zooms_modifier(vDo_Tate, bNeed_NO_integer_scale).y;
float zooms_modifier = get_zooms_modifier(vDo_Tate, bNeed_NO_integer_scale, bIsRotated).y;
float dotmat_insize = global.flick_and_noise_passSize.y;
float dotmat_outsize = global.FinalViewportSize.y * zooms_modifier;
#ifdef DEBUG_PRINT_VALUE
@ -345,7 +334,7 @@ void main() {
if ( bNeed_NO_integer_scale ) {
vec4 out_size = params.OutputSize;
vec4 ori_size = params.OriginalSize;
vec2 zoom_modifier = get_zooms_modifier(vDo_Tate, bNeed_NO_integer_scale);
vec2 zoom_modifier = get_zooms_modifier(vDo_Tate, bNeed_NO_integer_scale,bIsRotated);
if (vDo_Tate == 1.0) {
out_size.xy = out_size.yx;
ori_size.xyzw = ori_size.yxwz;
@ -378,7 +367,7 @@ void main() {
vec4 out_size = params.OutputSize;
vec4 ori_size = params.OriginalSize;
vec2 out_coord = vOutputCoord;
vec2 zoom_modifier = get_zooms_modifier(vDo_Tate, bNeed_NO_integer_scale);
vec2 zoom_modifier = get_zooms_modifier(vDo_Tate, bNeed_NO_integer_scale,bIsRotated);
if (vDo_Tate == 1.0) {
out_size.xy = out_size.yx;
ori_size.xyzw = ori_size.yxwz;
@ -523,19 +512,29 @@ float morph_shape_full(float shape, float power, float steep ) {
return shape;
}
vec3 morph_shape_full_vec3(vec3 shape, vec3 l, float steep, float gamma ) {
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 s2 = (1-s1) * l_pow;
//vec3 s1 = pow(shape, 1/sqrt(l2));
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;
}
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, 1/sqrt(l2));
vec3 s1 = pow(shape, inversesqrt(l2));
vec3 s2 = (1-s1) * l_pow;
// == 1*l_pow - s1*l_pow
// == -l_pow*s1 + l_pow
//vec3 s2 = fma(s1, -l_pow, l_pow); //ASM PROOF, slower.
return s2 + s1;
}
@ -658,8 +657,7 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
//in_coords = in_coords - global.flick_and_noise_passSize.zw*0.5; //<-- needed if for whatever reason you want to draw scanlines and vgaps in first_pass
//Get preset masks on ".rgb" and mask size on ".a" , mask and period for every phosphor done in vertex shader.
float PG_h_count = vPG_offsets_and_size.a;
vec3 PG_offsets = vPG_offsets_and_size.rgb;
vec3 PG_offsets = vPG_offsets_and_size.rgb;
vec2 freq_base_core = in_coords * vPG_OriginalSize_tated_mul_pi ;
@ -689,8 +687,8 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
//works by staggering odd rows by 1.5X triad
PG_offsets = vPG_offsets_and_size.rgb + //base offsets staggered (+)
float(
PIXELGRID_DO_SHADOWMASK * // user wants shadowmask
sin(freq_base_screen.y * 2.0 / PIXELGRID_SHADOWMASK_H ) > 0.0 // sin > 0.0 means the row is even
PIXELGRID_DO_SHADOWMASK * // user wants shadowmask
sin(freq_base_screen.y * 2.0 / PIXELGRID_SHADOWMASK_H ) > 0.0 // sin > 0.0 means the row is even
) * PIXELGRID_SHADOWMASK_SHIFT ; // stagger by 1.5
@ -714,7 +712,7 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
//Scanlines and fake slotmask =========================================================================
vec3 rgb_h = vec3(1.0);
vec3 dedot_mix_inverted = vec3(1.0);
vec3 dedot_mix = vec3(0.0);
//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
@ -724,7 +722,7 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
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 * pi) * (PIXELGRID_OFFSET_CORE);
float triad_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);
@ -743,12 +741,10 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
rgb_h_sin = (rgb_h_sin * rgb_h_sin);
//Compute dedot mix here for use in h mask and vmask2 later
dedot_mix_inverted = vec3((1-rgb_h_sin.x) * PIXELGRID_H_DEDOT) ;
//dedot_mix_inverted = dedot_mix_inverted * (max(max(pixel_in.r, pixel_in.g), pixel_in.b)/max_inLum);
//dedot_mix_inverted = dedot_mix_inverted * dot(pixel_in, vec3(0.33333) )/max_inLum;
dedot_mix_inverted = dedot_mix_inverted * (pixel_in/max_inLum);
dedot_mix_inverted = 1-dedot_mix_inverted;
//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);
// 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
@ -784,8 +780,7 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
//This work only when there are dots and have the countereffect when there are not.
//This happen because flattening the rgb mask will make unflattened rgb triads
//more evident, so this has to be used only when needed.
//rgb_w = mix(rgb_h, rgb_w, dedot_mix_inverted);
rgb_w = mix(phosphor_width, rgb_w, dedot_mix_inverted);
rgb_w = mix(rgb_w, phosphor_width, dedot_mix);
//lower strength via user parameter?
rgb_w = mix(vec3(1.0), rgb_w, DO_PIXELGRID_W);
@ -799,10 +794,9 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
//Vertical mask .:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
// can be used for slotmask,aperturegrille ... or scanlines, but they would have a boxed shape.
vec3 darklines_mask=vec3(1.0);
vec3 PG_spark;
vec3 pixel_in_unsparkled = pixel_in;
if (PIXELGRID_Y_MASK > 0.0) {
//Compute phosphors height mask with the right reference coords.
float ph_mask_height;
if ( PIXELGRID_Y_MASK_COORDS == 1.0 )
@ -841,13 +835,8 @@ vec4 fn_pixel_grid(vec2 in_coords, vec3 pixel_in, float min_inLum, float max_inL
darklines_mask = 1-(mask_shape*V);
//Try to get a more brillant/sparkling look by highering the darklines
//effect (sub) and pushing the source color, useful for slotmasks.
PG_spark = PIXELGRID_Y_SPARK * V * (0.5/vPG_mask_height);
vec3 PG_spark = (PIXELGRID_Y_SPARK * V) * (0.5/vPG_mask_height);
darklines_mask = (darklines_mask-0.5) * (1+PG_spark) + 0.5 ;
//Dedot darklines mask:
// darklines_mask = mix(vec3(1.0), darklines_mask, dedot_mix_inverted );
// darklines_mask = mix(darklines_mask, vec3(1.0), (1- dedot_mix_inverted)*0.25 ); //dedot less?
}
@ -942,7 +931,7 @@ float get_clamped_white_reference(vec3 pixel_in){
return white_reference;
}
vec3 pixel_backdrop_image() {
vec3 pixel_backdrop_image(float isrotated) {
vec2 backdrop_offset=vec2(BACKDROP_OFFX,BACKDROP_OFFY);
vec2 backdrop_tex_size = textureSize(backdrop, 0);
@ -952,7 +941,7 @@ vec3 pixel_backdrop_image() {
vOutputCoord+backdrop_offset,
global.FinalViewportSize,
backdrop_tex_size.x/backdrop_tex_size.y,
bool(vIsRotated));
bool(isrotated));
backdrop_coords=zoom(backdrop_coords, BACKDROP_ZOOM);
return textureLod(backdrop, backdrop_coords, backdrop_lod).rgb;
@ -971,8 +960,12 @@ vec4 textureLod_wrap(sampler2D tex, vec2 co, float lod, float wrap_mode) {
if (wrap_mode == 1.0) {
//Clamp to border, black.
bool bOutside = (co.x < 0.0 || co.x > 1.0 || co.y < 0.0 || co.y > 1.0 ) ;
if (bOutside) return vec4(0.0,0.0,0.0,1.0);
//bool bOutside = (co.x < 0.0 || co.x > 1.0 || co.y < 0.0 || co.y > 1.0 ) ;
//if (bOutside) return vec4(0.0,0.0,0.0,1.0);
if (is_first_outside_rect(co, vec4(0.0,0.0,1.0,1.0))) //ASM PROOF, FASTER.
return vec4(0.0,0.0,0.0,1.0);
} else if (wrap_mode == 2.0) {
//Clamp to edge:
co = clamp(co, 0.00, 1.0);
@ -1061,7 +1054,8 @@ vec3 bezel_color(float lum) {
float fuzzyrect(vec2 uv, vec2 size, float radius, float blur) {
vec2 hSize = size / 2.0 - radius;
float d = length(max(abs(uv - vec2(0.5)),hSize)-hSize);
return smoothstep(-radius-blur, -radius+blur, -d);
//return smoothstep(-radius-blur, -radius+blur, -d);
return smoothstep_fast(-radius-blur, -radius+blur, -d);
}
@ -1080,8 +1074,8 @@ vec2 get_scaled_coords_for_bezel(vec2 co, float isrotated) {
//But still, i need to access it twice in the code.
//So this is a function that ensures me that i always calc it the same way.
co = zoomout_coords(co, -BEZEL_FRAME_ZOOM, 1.0);
co.y = zoom1D(co.y, BEZEL_ASPECT_CORRECTION);
co = zoomout_coords(co, -BEZEL_FRAME_ZOOM); //FIXME COULD BE FASTER.
co.y = zoom1D(co.y, BEZEL_ASPECT_CORRECTION );
if (DO_TILT == 1.0)
return tilt(co, isrotated, TILT_X * TILT_BEZEL_K);
@ -1101,8 +1095,8 @@ vec4 fn_pixel_fgbg_image(sampler2D smp) {
//vec2 fg_image_offset=vec2(BG_IMAGE_OFFX,BG_IMAGE_OFFY);
//back_coords = get_scaled_coords_aspect(vBg_img_coords + fg_image_offset, global.FinalViewportSize, tex_size.x/tex_size.y, bool(vIsRotated));
bool rotated = bool(vIsRotated) || BG_IMAGE_ROTATION > 4.5;
rotated = BG_IMAGE_ROTATION > 3.5;
//bool rotated = bool(vIsRotated) || BG_IMAGE_ROTATION > 4.5;
bool rotated = BG_IMAGE_ROTATION > 3.5;
vec2 back_coords = get_scaled_coords_aspect(vBg_img_coords, global.FinalViewportSize, tex_size.x/tex_size.y, rotated);
@ -1118,12 +1112,17 @@ vec3 light_over_image(vec3 light, vec3 image, float black_illumination) {
//It will add less light on dark colors (
//mitigate clipping by lowering light on bright images:
light = light * (1 - (max(image.r,image.g),image.b) ) ;
//light = light * (1 - max(max(image.r,image.g),image.b) ) ; //1313/20079
//light = light - light*max(max(image.r,image.g),image.b); //ASM PROOF FASTER 1310 20046
//light = -light * max(max(image.r,image.g),image.b) + light ; //ASM PROOF FASTER
light = fma(vec3(max(max(image.r,image.g),image.b)),
-light,
light );
vec3 light_on_black = black_illumination * light;
vec3 modulated_on_black = image.rgb + ( light * image.rgb ) + light_on_black;
return modulated_on_black;
}
@ -1140,19 +1139,12 @@ vec3 ambi_blend_image(vec4 image, vec3 ambi, float blend_mode) {
if (AMBI_BG_IMAGE_BLEND_MODE == 0.0) {
image.rgb = mix(ambi.rgb, image.rgb, image_alpha_adapted);
} else {
float black_illumination = 0.5;
vec3 ambi_alpha_masked = ambi.rgb * (1 - image_alpha_adapted);
//vec3 ambi_alpha_masked = ambi.rgb * (1 -image_alpha_adapted);
// (ambi.rgb * -image_alpha_adapted) + (ambi * 1)
vec3 ambi_alpha_masked = fma(ambi.rgb, vec3(-image_alpha_adapted), ambi.rgb) ; //ASM PROOF: FASTER
image.rgb = light_over_image(ambi_alpha_masked, image.rgb, AMBI_ADD_ON_BLACK);
}
return image.rgb;
/*image.rgb = (AMBI_BG_IMAGE_BLEND_MODE == 0.0) ?
mix(ambi.rgb, image.rgb, image_alpha_adapted)
:
image.rgb + (ambi.rgb * (1 - image_alpha_adapted));
return image.rgb;*/
}
float gaussian_coefficient(float x, float sigma) {
@ -1162,9 +1154,6 @@ float gaussian_coefficient(float x, float sigma) {
return coefficient * exp(exponent);
}
vec3 fn_pixel_content(vec2 coords) {
vec3 pixel_out;
@ -1172,7 +1161,6 @@ vec3 fn_pixel_content(vec2 coords) {
float dot_mat_or_pixelgrid = 1.0; //init dot grid or scanline mask to 1.0
//#define USE_QUILEZ
#ifdef USE_QUILEZ
@ -1210,7 +1198,8 @@ vec3 fn_pixel_content(vec2 coords) {
if (HALO_PRE_SCANLINE_GAP == 1.0 && vDo_pixelgrid_h == 1.0) {
//FIXME dot_mat lasciato indietro
halo_coords.y += (DO_PIXELGRID_H * global.in_glow_passSize.w) * ( 0.5 * (0.75-HALO_VS_SCAN) );
halo_coords.y += (DO_PIXELGRID_H * global.in_glow_passSize.w) * ( 0.5 * (0.75-HALO_VS_SCAN) );
//halo_coords.y += (DO_PIXELGRID_H * global.in_glow_passSize.w) * ( 0.375-0.5*HALO_VS_SCAN ); //ASM PROOF SLOWER
vec3 pixel_haloed = texture(halo_pass, halo_coords).rgb;
//pixel_haloed = blur_px(halo_pre_gamma_pass, halo_coords, vec2(SERVICE1*0.1)) ;
@ -1267,10 +1256,10 @@ vec4 fn_pixel_bezel(vec2 coords_for_bezel, vec2 coords_for_mirror, float nightif
vec2 bezel_lut_size = textureSize(monitor_body_curved, 0);
float bezel_frame_lod = log2(bezel_lut_size.y * (BEZEL_FRAME_ZOOM+1.0) * global.FinalViewportSize.w);
#else
float bezel_frame_lod = log2( BEZEL_RES.y * (BEZEL_FRAME_ZOOM + 1.0) * global.FinalViewportSize.w);
//float bezel_frame_lod = log2( fma( BEZEL_RES.y, BEZEL_FRAME_ZOOM, BEZEL_RES.y) * global.FinalViewportSize.w); //ASM PROOF: UNDECIDED
float bezel_frame_lod = log2( BEZEL_RES.y * (BEZEL_FRAME_ZOOM+1.0) * global.FinalViewportSize.w);
#endif
if (BEZEL_USE_STRAIGHT < 0.5)
bezel_in = textureLod(monitor_body_curved,coords_for_bezel,bezel_frame_lod);
else
@ -1289,14 +1278,14 @@ vec4 fn_pixel_bezel(vec2 coords_for_bezel, vec2 coords_for_mirror, float nightif
// Calculate Reflections, can be skipped if blue channel is 0:
if (bezel_in.b > 0.0) {
//Reflections: Calculate the bezel roughness to apply to the reflecting area. (bezel_in.g expresses the specularity)
float roughness = random_fast(vTexCoord);
float noise_power = 1/1080.0 * BEZEL_ROUGHNESS;
roughness = scale_to_range(roughness, -noise_power, noise_power);
roughness *= (1 - min(lut_specular * 10, 1.0)); // <-roughness over specular area looks bad.
//Reflections:
reflection_modifier = bezel_in.b; //bezel_in.b expresses how much the area is reflective
#define ROUGHNESS_ADAPT (2/1080.0 * BEZEL_ROUGHNESS)
float roughness = (1 - min(lut_specular * 10, 1.0)) * //Skip drawing roughness over specular, it looks bad
(random_fast(vTexCoord) * ROUGHNESS_ADAPT) - ROUGHNESS_ADAPT*0.5;
//Reflections:
reflection_modifier = bezel_in.b; //bezel_in.b expresses how much the area is reflective
//Sample the reflection pass with small offset to simulate the roughness
pixel_mirrored = texture(reflected_blurred_pass, coords_for_mirror + roughness);
@ -1306,13 +1295,15 @@ vec4 fn_pixel_bezel(vec2 coords_for_bezel, vec2 coords_for_mirror, float nightif
pixel_mirrored.rgb *= fcorners_shade;
//Push it over the specular areas and apply the reflection modifier
pixel_mirrored.rgb = pixel_mirrored.rgb * (1 + lut_specular);
//pixel_mirrored.rgb = pixel_mirrored.rgb * (1 + lut_specular);
//pixel_mirrored.rgb = pixel_mirrored.rgb + pixel_mirrored.rgb * lut_specular; //ASM PROOF: FASTER
pixel_mirrored.rgb = fma( pixel_mirrored.rgb, vec3(lut_specular), +pixel_mirrored.rgb); //ASM PROOF: FASTER
}
//Yes, we already passed ambilight as parameter, but if geometry content is overridden
//then ambientlight may have not been sampled yet due to some skip logic made in the main()
if (DO_AMBILIGHT == 1.0)
if (DO_AMBILIGHT == 1.0)
pixel_ambilight = texture(ambi_temporal_pass, vOutputCoord).rgb;
//Apply nightification, the strength is modulated by ambient light.
@ -1320,14 +1311,14 @@ vec4 fn_pixel_bezel(vec2 coords_for_bezel, vec2 coords_for_mirror, float nightif
float ambi_colorize_shade = create_ambi_colorize_shade(coords_for_bezel);
vec3 ambi_over_bezel = ( (AMBI_OVER_BEZEL * pixel_ambilight) *
(bezel_in.a * ambi_colorize_shade) *
(1-reflection_modifier) );
vec3 ambi_over_bezel = (AMBI_OVER_BEZEL * pixel_ambilight) *
(bezel_in.a * ambi_colorize_shade) *
(1-reflection_modifier) ;
bezel_out.rgb = fn_pixel_nightify(bezel_out.rgb, nightify_str, ambi_over_bezel ) ;
//Apply reflections
//Add reflections after nightification
bezel_out += (pixel_mirrored.rgb * reflection_modifier);
//Apply ambient light over the bezel
@ -1359,7 +1350,7 @@ void main() {
//Precalc Bezel coords, since it modifies content coords.
vec2 co_bezel = vec2(0.0);
if (DO_BEZEL == 1.0) {
co_content = zoomout_coords(co_content, -vBEZEL_INNER_ZOOM_adapted , 1.0);
co_content = zoomout_coords(co_content, -vBEZEL_INNER_ZOOM_adapted);
co_bezel = get_scaled_coords_for_bezel(vTexCoord, vIsRotated);
}
@ -1381,7 +1372,7 @@ void main() {
//Dynamic lum dependant full screen zoom?
#ifndef D3D_WORKAROUND
if (DO_DYNZOOM == 1.0)
if (DO_DYNZOOM > 0.0)
co_content = zoom(co_content, get_dyn_zoom(avglum_pass) );
#endif
@ -1414,6 +1405,9 @@ void main() {
//Draw content only over the alpha mask, and sample ambientlight outside it to spare gpu cycles.
if (canvas_busy > 0.5) {
pixel_out = fn_pixel_content(co_content) * canvas_busy;
//pixel_out = adaptive_strobe_checkerboard(pixel_out, vOutputCoord, global.FinalViewportSize.xy);
#ifndef D3D_WORKAROUND
if (LCD_ANTIGHOSTING > 0.0) {
vec3 feedback = texture(final_passFeedback, vOutputCoord).rgb;
@ -1440,15 +1434,20 @@ void main() {
pixel_ambi = texture(ambi_temporal_pass, vOutputCoord).rgb ;
if (DO_BG_IMAGE != 1.0) {
float noise_power = NOISEPOWER * NOISEPOWER_AMBI_MUL;
float anoise = random_fast(vTexCoord * vDynamicSeed);
anoise = scale_to_range(anoise, -noise_power, noise_power);
anoise *= (1 - pixel_ambi.g);
pixel_ambi += anoise;
const float noise_power = NOISEPOWER * NOISEPOWER_AMBI_MUL;
float anoise1 = random_fast(vTexCoord * vDynamicSeed);
anoise1 = scale_to_range(anoise1, -noise_power, noise_power);
// anoise1 *= (1 - pixel_ambi.g);
//anoise1 = (anoise1 - anoise1 * pixel_ambi.g); //ASM PROOF FASTER
anoise1 = fma(-anoise1, pixel_ambi.g, anoise1); //ASM PROOF FASTER
pixel_ambi += anoise1;
}
//pixel_under_content = clamp(pixel_ambi, 0.0,1.0) * (1-canvas_busy); //<-- this one is better because will antialias borders
// better (via canvas-busy) when ambientlight > 0.0
pixel_under_content = pixel_ambi * (1-canvas_busy);
//pixel_under_content = pixel_ambi * (1-canvas_busy);
//pixel_under_content = pixel_ambi - canvas_busy * pixel_ambi; //ASM PROOF: FASTER
pixel_under_content = fma(vec3(-canvas_busy), pixel_ambi, pixel_ambi); //ASM PROOF: FASTER
}
}
@ -1462,7 +1461,7 @@ void main() {
vec4 pixel_bezel;
//SKIP LOGIC is inside fn_pixel_bezel
if (DO_BEZEL == 1.0) {
pixel_bezel = fn_pixel_bezel(co_bezel, co_mirror, BG_IMAGE_NIGHTIFY, pixel_ambi);
pixel_bezel = fn_pixel_bezel(co_bezel, co_mirror, BG_IMAGE_NIGHTIFY * DO_BG_IMAGE, pixel_ambi);
//If we used a smooth_border, canvas_busy is it, but since the content is in the bezel,
//we can safely use it to smooth/darken the game border
pixel_out *= canvas_busy;
@ -1471,13 +1470,14 @@ void main() {
//Update alpha mask.
//We can't use the bezel alpha channel to update the alpha mask since it is transparent ù
//on the tube and we don't want to paint anything there, so use a dumb rect and add it to canvas_busy:
float rect_bezel = float(is_first_inside_rect(co_bezel, vec4(BEZEL_SHADOW_SIZE, BEZEL_SHADOW_SIZE, 1.0 - BEZEL_SHADOW_SIZE, 1.0 - BEZEL_SHADOW_SIZE)));
float rect_bezel = float(is_first_inside_rect(co_bezel, vec4(BEZEL_FRAME_SURROUND_MARGIN, BEZEL_FRAME_SURROUND_MARGIN, 1.0 - BEZEL_FRAME_SURROUND_MARGIN, 1.0 - BEZEL_FRAME_SURROUND_MARGIN)));
canvas_busy = max(pixel_bezel.a, rect_bezel);
//FragColor = vec4(canvas_busy); return; // <- uncomment to debug BEZEL_SHADOW_SIZE
//FragColor = vec4(canvas_busy); return; // <- uncomment to debug BEZEL_FRAME_SURROUND_MARGIN
//Intersect rect_bezel and bezel alpha to get the inner tube alpha
canvas_bezel_screen = (1 - pixel_bezel.a) * rect_bezel;
//canvas_bezel_screen = rect_bezel - rect_bezel* pixel_bezel.a; //ASM PROOF: SLOWER
}
if (canvas_bezel_screen > 0.5) {
@ -1496,9 +1496,9 @@ void main() {
if (DO_SPOT == 1.0) {
float dist = length( vec2( (co_content.x-0.5) * vIn_aspect, co_content.y-0.5) +
vec2( S_POSITION_X * vIn_aspect, S_POSITION_Y) );
//spot = smoothstep_fast(S_SIZE,0.0,dist)*S_POWER;
//spot = smoothstep_cos(S_SIZE,0.0,dist)*S_POWER;
pixel_out += smoothstep(S_SIZE,0.0,dist) * S_POWER * canvas_bezel_screen;
//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 = 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.
}
}
@ -1524,16 +1524,16 @@ void main() {
//Backdrop
if (DO_BACKDROP == 1.0)
pixel_out += pixel_backdrop_image();
pixel_out += pixel_backdrop_image(vIsRotated);
//Foreground image
if (DO_BG_IMAGE + BG_IMAGE_OVER == 2.0) {
vec4 pixel_fg_image = fn_pixel_fgbg_image(bg_over);
// if geometry content is overridden, ambientlight may have not been sample yet due to some skip logic
if (DO_AMBILIGHT == 1.0 && (pixel_fg_image.a+AMBI_BG_IMAGE_FORCE) > 0.0 && canvas_busy < 0.01)
pixel_ambi = texture(ambi_temporal_pass, vOutputCoord).rgb * (1- canvas_busy );
if (DO_AMBILIGHT == 1.0 && (pixel_fg_image.a+AMBI_BG_IMAGE_FORCE) > 0.0 && canvas_busy < 0.01) {
pixel_ambi = texture(ambi_temporal_pass, vOutputCoord).rgb * (1- canvas_busy ); //ALREADY TRIED COMMON fma() optimization, failed.
}
vec3 anti_nightify_ambi = (pixel_ambi * AMBI_BG_IMAGE_BLEND_MODE) *
max(AMBI_BG_IMAGE_FORCE, 1-pixel_fg_image.a) ;
@ -1550,7 +1550,7 @@ void main() {
// that have a low alpha channel, that part would be black.
if (DO_AMBILIGHT + AMBI_BG_IMAGE_BLEND_MODE == 2.0) {
float ambi_mask = create_ambi_colorize_shade(co_bezel);
float alpha_selective = clamp( pixel_fg_image.a + ( 1- canvas_busy) , 0.0, 1.0);
float alpha_selective = clamp( pixel_fg_image.a + (1- canvas_busy) , 0.0, 1.0);
pixel_out = mix(pixel_out, pixel_fg_image.rgb, alpha_selective );
float fg_image_alpha_adapted = max(pixel_fg_image.a - AMBI_BG_IMAGE_FORCE, 0.0);
vec3 light = pixel_ambi.rgb * (ambi_mask) * (1- fg_image_alpha_adapted);
@ -1607,8 +1607,6 @@ void main() {
//pixel_out = pixel_out -diff;
FragColor = vec4(pixel_out, 1.0);
//FragColor = texture(halo_pass, vOutputCoord);

View file

@ -82,8 +82,10 @@ vec4 pixel_flickering() {
vec4 pixel_cur = texture(Source,vTexCoord);
vec3 flickline = texture(Source,vFlickerCoords).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);
//float lumdiff = abs( (flickline.r + flickline.g) + (flickline.b - pixel_cur.r) - (pixel_cur.g + pixel_cur.b) ); //1687 1754 2946 ASM PROOF: FASTER
float lumdiff = abs( dot(flickline.rgb, vec3(1.0)) - dot(pixel_cur.rgb, vec3(1.0)));// 1685 1750 2948 //ASM PROOF: Faster on SIMD8 and SIMD16, slower on SIMD32
lumdiff = min(lumdiff * vFlickering_power, 1.0);
return vec4( mix(pixel_cur.rgb,flickline.rgb,lumdiff),
pixel_cur.a); //<-- wee need to return the alpha channel because it carries ntsc artifact mask
@ -101,8 +103,7 @@ void main() {
if (DO_RF_NOISE > 0.0) {
float anoise = random_fast(vTexCoord * vDynamicSeed);
anoise = scale_to_range(anoise, -RF_NOISE_STRENGTH, RF_NOISE_STRENGTH);
pixel_out.rgb += vec3(anoise);
pixel_out.rgb += scale_to_range(anoise, -RF_NOISE_STRENGTH, RF_NOISE_STRENGTH);
}
FragColor = pixel_out;
}

View file

@ -97,7 +97,8 @@ FXAA_SUBPIX_CAP - Insures fine detail is not completely removed.
// skipping normalization and tossing out blue.
// FxaaLuma() will range 0.0 to 2.963210702.
float FxaaLuma(vec3 rgb) {
return rgb.y * (0.587/0.299) + rgb.x;
//return rgb.y * (0.587/0.299) + rgb.x;
return fma( rgb.y, (0.587/0.299), rgb.x ); //ASM_PROOF: SAME
}
vec3 FxaaLerp3(vec3 a, vec3 b, float amountOfA) {
@ -105,8 +106,10 @@ vec3 FxaaLerp3(vec3 a, vec3 b, float amountOfA) {
}
vec4 FxaaTexOff(sampler2D tex, vec2 pos, ivec2 off, vec2 rcpFrame) {
float x = pos.x + float(off.x) * rcpFrame.x;
float y = pos.y + float(off.y) * rcpFrame.y;
//float x = pos.x + float(off.x) * rcpFrame.x;
//float y = pos.y + float(off.y) * rcpFrame.y;
float x = fma(float(off.x), rcpFrame.x, pos.x); //ASM PROOF: SAME
float y = fma(float(off.y), rcpFrame.y, pos.y); //ASM PROOF: SAME
return textureLod(tex, vec2(x, y),0);
}
@ -135,7 +138,7 @@ vec3 FxaaPixelShader(vec2 pos, sampler2D tex, vec2 rcpFrame)
return rgbM;
}
vec3 rgbL = rgbN + rgbW + rgbM + rgbE + rgbS;
vec3 rgbL = rgbN + rgbW + rgbM + rgbE + rgbS; //ASM_PROOF: USELESS parenthesis
float lumaL = (lumaN + lumaW + lumaE + lumaS) * 0.25;
float rangeL = abs(lumaL - lumaM);

View file

@ -103,23 +103,25 @@ void main() {
}
float in_glow_w_adapted = abs(IN_GLOW_W);
//Modulate glow power via ntsc artifact mask:
//"add" them to the configured sharpness (-> less blur)
in_glow_w_adapted = in_glow_w_adapted + DO_NTSC_ARTIFACTS * ((1-ntsc_artifacts) * NTSC_ARTF_NOBLUR);
//float in_glow_w_adapted = abs(IN_GLOW_W);
//in_glow_w_adapted = in_glow_w_adapted + DO_NTSC_ARTIFACTS * ((1-ntsc_artifacts) * NTSC_ARTF_NOBLUR);
//Same as before, but faster (ASM PROOF)
float in_glow_w_adapted = fma(
DO_NTSC_ARTIFACTS,
fma(-NTSC_ARTF_NOBLUR, ntsc_artifacts, NTSC_ARTF_NOBLUR),
abs(IN_GLOW_W)
);
//don't allow lower values that look bad:
//in_glow_w_adapted = max(in_glow_w_adapted, MIN_IN_GLOW_SHARP);
//Scale it for lanczos
// if (IN_GLOW_W < 0.0)
// in_glow_w_adapted = (in_glow_w_adapted+1)/10.0;
//Scale it for box
if (IN_GLOW_W < 0.0)
in_glow_w_adapted = (in_glow_w_adapted)/1.2;
in_glow_w_adapted = in_glow_w_adapted/1.2;
//Make it resolution independent.

View file

@ -120,7 +120,7 @@ void main() {
FragColor = vec4(color, original_unchanged);
return;
}
FragColor = texture(shift_and_bleed_pass, vTexCoord) * vGlow_Gain;
FragColor = vec4(texture(shift_and_bleed_pass, vTexCoord).rgb * vGlow_Gain, 1.0);
return;
}

View file

@ -260,7 +260,10 @@ vec3 pixel_push_luminance(vec3 c, float strength) {
//if (strength == 0.0) return c; //lighter without the check.
float whiteness = max(max(c.r, c.g), c.b);
whiteness = clamp(whiteness, 0.0, 1.0);
return c * (1 + ( (1-whiteness) * strength) );
//return c * (1 + ( (1-whiteness) * strength) );
return fma(c, vec3(fma(strength, -whiteness, strength)), c); //ASM PROOF: F
}
/*
@ -386,22 +389,19 @@ bool vec2_similar(vec2 a, vec2 b, float threshold) {
}
vec2 zoom(vec2 in_coords, float zoom_factor) {
float off = 1.0/(zoom_factor*2.0) - 0.5;
return (in_coords/zoom_factor)-off;
vec2 zoom(vec2 co, float zoom_factor) {
return 0.5 + (co - 0.5) / zoom_factor;
}
float zoom1D(float in_coord, float zoom_factor) {
float off = 1.0/(zoom_factor*2.0) - 0.5;
return (in_coord/zoom_factor)-off;
float zoom1D(float co, float zoom_factor) {
return 0.5 + (co - 0.5) / zoom_factor;
}
vec2 zoomxy(vec2 in_coords, vec2 zoom_factor) {
vec2 off = 1.0/(zoom_factor*2.0) - 0.5;
return (in_coords/zoom_factor)-off;
vec2 zoomxy(vec2 co, vec2 zoom_factor) {
return 0.5 + (co - 0.5) / zoom_factor;
}
vec2 zoomout_coords(vec2 in_coords, float zoom_out, float aspect) {
vec2 zoomout_coords_aspect(vec2 in_coords, float zoom_out, float aspect) {
// to convert to standard zoom:
// zoomout_coords(x) = zoom( 1/(x+1) );
@ -413,10 +413,19 @@ vec2 zoomout_coords(vec2 in_coords, float zoom_out, float aspect) {
vec2 offset = vec2( (zoom.x-1.0) / 2.0,
(zoom.y-1.0) / 2.0
);
return (in_coords * zoom) - offset;
}
vec2 zoomout_coords(vec2 in_coords, float zoom_out) {
// to convert to standard zoom:
// zoomout_coords(x) = zoom( 1/(x+1) );
float zoom = 1 + zoom_out;
float zoffset = zoom_out * 0.5;
return (in_coords * zoom) - zoffset;
}
bool need_doublescan() {
return
@ -449,7 +458,7 @@ float scale_to_range(float x, float dmin, float dmax) {
vec3 scale_to_range_vec3(vec3 x, float dmin, float dmax) {
//Scales 0..1 range to a..b range
return ( (dmax-dmin) * x ) + dmin;
return ( x * (dmax-dmin) ) + dmin; //ASM PROOF (fma slower)
}
vec3 scale_to_range_vec3(vec3 x, vec3 dmin, vec3 dmax) {
@ -499,6 +508,7 @@ float round_step(float f, float p) {
#define RND_C 43758.5453
float random(float power, vec2 seed) {
if (SKIP_RANDOM == 1.0) return 0.0;
//From pal-singlepass.slang
//https://github.com/svofski/CRT
//Copyright (c) 2016, Viacheslav Slavinsky
@ -512,8 +522,28 @@ float random(float power, vec2 seed) {
return noise_out;
}
float deband_static(vec2 co, float power) {
#define PI_HALF 1.5707963267949
vec2 d = sin(co* PI_HALF * params.OutputSize.xy);
float r = d.x * d.y * power;
return r;
}
float deband_temporal(vec2 co, float power) {
#define PI_HALF 1.5707963267949
vec2 d = sin(co* PI_HALF * params.OutputSize.xy);
float r = d.x * d.y * power;
r= mix(r,-r, mod(params.FrameCount, 2.0));
return r;
}
//The following produces weird results when with dynamic seed like framecount.
float random_fast(vec2 seed) {
if (SKIP_RANDOM == 1.0) return 0.0;
//return 0.0;
//return deband_static(seed, 0.001);
float noise_out = fract(sin(dot(seed.xy, VEC2_RND_A_B)) * RND_C);
return noise_out;
}
@ -791,18 +821,17 @@ float random_fast(vec2 seed) {
//co = co*2.0 - vec2(0.0,0.5);
//if (co.x > 1.0) co.x -= 1;
//Aspect
//float bUse_original_aspect = float(aspect < 0.01);
float bUse_custom_aspect = step(0.01, aspect);
//Aspect (ASM PROOF: IFTHEN is better)
float scale_y;
/*if (aspect > 0.01)
if (aspect > 0.01)
scale_y = aspect/in_aspect;
else
scale_y = 1.0;
*/
//Unbranched previous:
scale_y = mix_step(1.0, aspect/in_aspect, bUse_custom_aspect );
//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;
@ -1088,7 +1117,7 @@ vec3 rgb2hsv(vec3 c){
}
float get_dyn_zoom(sampler2D tex) {
return 1.0 + (texture(tex, vec2(0.75,0.75) ).a/ DYNZOOM_FACTOR) ;
return texture(tex, vec2(0.75,0.75)).a * DO_DYNZOOM + 1.0 ;
}
@ -1124,14 +1153,20 @@ vec2 tilt2D(vec2 co, float is_rotated, vec2 tilt) {
}
vec2 tilt(vec2 co, float is_rotated, float tilt) {
/*float is_rotated_fake() {
return params.Rotation & 1;
}*/
vec2 tilt(vec2 co, float is_rotated, float tilt) {
//ASM PROOF: if then is worse.
vec2 r_tilt = vec2( mix_step(tilt, 0.0, is_rotated),
mix_step(0.0, -tilt, is_rotated)
);
vec2 tilt_min = 1 - r_tilt;
vec2 tilt_max = 1 + r_tilt;
// X Tilt
float tilt_x_range = scale_to_range(co.y, tilt_min.x, tilt_max.x);
@ -1149,7 +1184,11 @@ vec2 tilt(vec2 co, float is_rotated, float tilt) {
float fov = mix( 1.0, TILT_FOV, abs( tilt ));
co = zoomxy(co, vec2(fov) );
co.xy += mix_step( vec2(0.0, tilt), -vec2(tilt, 0.0), is_rotated) * 0.5;
if (is_rotated > 0.5) //ASM PROOF
co.xy += -vec2(tilt, 0.0) * 0.5;
else
co.xy += vec2(0.0, tilt) * 0.5;
// co.xy += mix_step( vec2(0.0, tilt), -vec2(tilt, 0.0), is_rotated) * 0.5;
return co;
}
@ -1166,6 +1205,8 @@ bool is_first_inside_rect(vec2 point, vec4 rect) {
point.y >= rect.y && point.y < rect.w) ;
}
*/
//Following is faster (ASM proof)
bool is_first_inside_rect(vec2 point, vec4 rect) {
vec2 bounded = clamp(point, rect.xy, rect.zw);
return point == bounded;
@ -1225,6 +1266,11 @@ vec3 vibrance_set(vec3 c, float v) {
return pixel_out/255.0;
}
vec3 adaptive_black(vec3 c_in, float lum_in, float range) {
float luminance_adapt = mix( 1-range, 1+range, lum_in);
return c_in * luminance_adapt - luminance_adapt + 1;
return fma(c_in, vec3(luminance_adapt), vec3(-luminance_adapt + 1)); //ASM_PROOF: SAME
}
vec3 color_tools(vec3 pixel_out, vec3 Temperature_rgb) {
//Apply color corrections to input signal.
@ -1246,9 +1292,15 @@ vec3 vibrance_set(vec3 c, float v) {
vec3 pixel_grayscale = vec3(dot(pixel_out.rgb, W_C_TO_GRAY));
vec3 pixel_in_hsv = rgb2hsv(pixel_grayscale); //FIXME needed? yes, checked.
float lum = pixel_in_hsv.z * pixel_in_hsv.z; //<-- looks way better!
vec2 bias = mix_step( vec2(0.0, COLOR_MONO_HUE_BIAS), vec2(COLOR_MONO_HUE_BIAS, 0.0), float(COLOR_MONO_HUE_BIAS > 0.0));
bias = abs(bias);
//vec2 bias = mix_step( vec2(0.0, abs(COLOR_MONO_HUE_BIAS)), vec2(abs(COLOR_MONO_HUE_BIAS), 0.0), float(COLOR_MONO_HUE_BIAS > 0.0));
//Following should be faster (ASM PROOF)
vec2 bias;
if (COLOR_MONO_HUE_BIAS > 0.0)
bias = vec2(abs(COLOR_MONO_HUE_BIAS),0.0);
else
bias = vec2(0.0,abs(COLOR_MONO_HUE_BIAS));
lum=scale_to_range(lum, 0.0-bias.x, 1.0+bias.y);
pixel_in_hsv.y=1.0; //sat
@ -1351,3 +1403,69 @@ vec4 PG_get_hmask_preset_unfloored() {
}
vec3 adaptive_strobe( vec3 c) {
#define STRENGTH 1.0; //effect strength
#define BRIGHT_BIAS 1.0 //brightness compensation
#define CONTRAST_COMPENSATION 0.5 //maximum contrast compensation
#define GAIN_COMPENSATION 0.5 //maximum gain compensation
vec3 c_temp = c.rgb;
c_temp = clamp(c_temp, vec3(0.0), vec3(1.0));
vec3 room = (0.5 - abs(0.5-c_temp)) * STRENGTH;
vec3 contrast_adj = mix(vec3(0.0), vec3(-CONTRAST_COMPENSATION), room);
vec3 gain_adj = mix(vec3(1.0), vec3(GAIN_COMPENSATION), room);
//Adjust brightness/contrast
c = ( (1+contrast_adj+contrast_adj)* c)-contrast_adj;
c *= gain_adj;
if (mod(params.FrameCount, 2.0 ) == 0.0) {
return c + room / BRIGHT_BIAS;
}else {
return c - room * BRIGHT_BIAS;
}
}
vec3 adaptive_strobe_checkerboard(vec3 pixel_out, vec2 co, vec2 outputsize) {
float strength = 0.5; //0.5 is good
float square_size = 3; //checkerboard squares border size (1.0 = full screen blank)
float period_blank = 1.0; //draw checkerboard every "period_blank" frames
float period_flip = 2.0 ; //invert checkerboard colors every # frames, usually/try period_blank*2.
bool is_blank_time = (mod(params.FrameCount, period_blank) == 0.0);
if (is_blank_time) {
vec3 checkerboard = vec3(1.0);
if (mod( floor(co.x * outputsize.x), square_size) >= square_size/2.0)
checkerboard = vec3(1.0);
else
checkerboard = vec3(-1.0);
if (mod( floor(co.y * outputsize.y), square_size) >= square_size/2.0)
checkerboard = -checkerboard;
if (mod(params.FrameCount, period_flip) >= period_flip/2.0)
checkerboard = -checkerboard;
checkerboard *= min( pixel_out, 1-(pixel_out) ) * strength;
//#define SPLIT_SCREEN
#ifdef SPLIT_SCREEN
if (co.x > 0.5)
pixel_out.rgb = pixel_out.rgb+ checkerboard;
#else
pixel_out.rgb = pixel_out.rgb+ checkerboard;
#endif
}
return pixel_out;
}

View file

@ -19,7 +19,7 @@ void main() {
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 = zoomout_coords( vCoordsAdapted, BEZEL_RFL_ZOOM, 1.0);
vCoordsAdapted = zoomout_coords( vCoordsAdapted, BEZEL_RFL_ZOOM);
vCoords_shade = zoom(vTexCoord,1.05);
@ -57,7 +57,7 @@ void main() {
vec2 coords = vCoordsAdapted;
if (DO_DYNZOOM == 1.0)
if (DO_DYNZOOM > 0.0)
coords = zoom(coords, get_dyn_zoom(avglum_pass));
//eventually return black pixel

View file

@ -11,9 +11,8 @@ layout(location = 1) out vec2 vR_offset;
layout(location = 2) out vec2 vG_offset;
layout(location = 3) out vec2 vB_offset;
layout(location = 4) out float vDo_shadow_mode;
layout(location = 5) out float vDecon_or_SatBleed_or_JustShadow;
layout(location = 6) out float vDecon_or_JustShadow;
layout(location = 7) out float vShow_artifact_mask;
layout(location = 5) out float vDecon_or_JustShadow;
layout(location = 6) out float vShow_artifact_mask;
#include "includes/functions.include.slang"
void main()
@ -35,9 +34,16 @@ void main()
vB_offset=offsets_from_float(SHIFT_B+210.0,RGB_SHIFT_RANGE);
}
vec2 d = -params.OutputSize.zw * 0.5;
vR_offset *= d;
vG_offset *= d;
vB_offset *= d;
//Precalc some conditions:
vDecon_or_SatBleed_or_JustShadow = float(DO_SHIFT_RGB + DO_SAT_BLEED > 1.0 || DOT_M_SHADOW_STR > 0.0 );
vDecon_or_JustShadow = float(DO_SHIFT_RGB > 0.0 || DOT_M_SHADOW_STR > 0.0);
bool do_shadow = (DO_DOT_MATRIX == 1.0 && DOT_M_SHADOW_STR > 0.0);
vDecon_or_JustShadow = float(DO_SHIFT_RGB > 0.0 || do_shadow );
vShow_artifact_mask = float(NTSC_SHOW_ARTF_MASK + DO_NTSC_ARTIFACTS == 2.0);
}
@ -49,9 +55,8 @@ layout(location = 1) in vec2 vR_offset;
layout(location = 2) in vec2 vG_offset;
layout(location = 3) in vec2 vB_offset;
layout(location = 4) in float vDo_shadow_mode;
layout(location = 5) in float vDecon_or_SatBleed_or_JustShadow;
layout(location = 6) in float vDecon_or_JustShadow;
layout(location = 7) in float vShow_artifact_mask;
layout(location = 5) in float vDecon_or_JustShadow;
layout(location = 6) in float vShow_artifact_mask;
layout(location = 0) out vec4 FragColor;
@ -91,36 +96,34 @@ const mat3 mat3_YUV2RGB = mat3(
vec4 deconvergence_shadow(vec2 coords, sampler2D in_texture, vec4 sourcesize2) {
vec4 deconvergence_shadow(vec2 coords, sampler2D in_texture, vec4 source_pixel) {
//Emulates deconvergence or shadowing for dot matrix screens like Gameboy.
//Since both effects should not coexist in real life, we use a singe function for both.
//The function stays more or less the same, but rgb offsets calculated in vertex shader
//will be the same for shadow mode. Hopefully shader texture cache will take care of
//multiple sampling for the same tex coords.
vec4 pixel_cur = texture(in_texture, coords);
vec2 d = -vec2(sourcesize2.z, sourcesize2.w)*0.5;
vec3 pixel_offset;
pixel_offset.r=texture(in_texture,coords + vR_offset * d).r;
pixel_offset.g=texture(in_texture,coords + vG_offset * d).g;
pixel_offset.b=texture(in_texture,coords + vB_offset * d).b;
//Since we are sampling from a "clamp-to-border" texture, ensure we've no black bleeding
//by clamping the texture coords
coords = clamp(coords,params.SourceSize.zw*1 ,1.0-params.SourceSize.zw);
pixel_offset.r=texture(in_texture,coords + vR_offset).r;
pixel_offset.g=texture(in_texture,coords + vG_offset).g;
pixel_offset.b=texture(in_texture,coords + vB_offset).b;
vec3 deconvergence_mode = mix(pixel_cur.rgb, pixel_offset, OFFSET_STRENGTH);
vec3 shadow_mode = pixel_cur.rgb - max( (pixel_cur.rgb - pixel_offset), vec3(0.0) ) * DOT_M_SHADOW_STR;
vec3 deconvergence_mode = mix(source_pixel.rgb, pixel_offset, OFFSET_STRENGTH);
vec3 shadow_mode = source_pixel.rgb - max( (source_pixel.rgb - pixel_offset), vec3(0.0) ) * DOT_M_SHADOW_STR;
return vec4( mix_step(deconvergence_mode, shadow_mode, vDo_shadow_mode),
pixel_cur.a );
source_pixel.a );
}
vec4 deconvergence_shadow_wrap(vec2 coord) {
if ( DO_FXAA == 1.0) {
return deconvergence_shadow(coord, FXAA_pass, global.FXAA_passSize);
} else {
return deconvergence_shadow(coord, flick_and_noise_pass, global.flick_and_noise_passSize);
}
vec4 deconvergence_shadow_wrap(vec2 coord, vec4 source_pixel) {
if ( DO_FXAA == 1.0)
return deconvergence_shadow(coord, FXAA_pass, source_pixel);
else
return deconvergence_shadow(coord, flick_and_noise_pass, source_pixel);
}
#define SIDE_RIGHT 1
@ -137,15 +140,15 @@ vec3 pixel_bleed_side_NTSC(vec4 pixel_in, vec2 co, float size, sampler2D in_text
if (vShow_artifact_mask == 1.0) return vec3(strength_modifier);
vec2 off_l = vec2(SIDE_LEFT * sourcesize2.z,0.0);
vec2 off_r = vec2(SIDE_RIGHT * sourcesize2.z,0.0);
vec2 off_r = vec2(SIDE_RIGHT * sourcesize2.z,0.0);
for ( float i=1 ; i <= size ; i++ ){
w=w/SAT_BLEED_FALLOFF;
//w = w * exp(i*i*(1-SAT_BLEED_FALLOFF)*0.1);
vec3 smp_YIQ = texture(flick_and_noise_pass, co - i*off_l ).rgb * mat3_RGB2YIQ;
w=w/SAT_BLEED_FALLOFF; //w = w * exp(i*i*(1-SAT_BLEED_FALLOFF)*0.1);
vec3 smp_YIQ = texture(in_texture, co - i*off_l ).rgb * mat3_RGB2YIQ;
//Blur Y, I and Q
blur_YIQ_l = mix(blur_YIQ_l.xyz, smp_YIQ.xyz, w/vec3( bandwidth_mhz_Y_ntsc, bandwidth_mhz_I, bandwidth_mhz_Q));
smp_YIQ = texture(flick_and_noise_pass, co - i*off_r ).rgb * mat3_RGB2YIQ;
smp_YIQ = texture(in_texture, co - i*off_r ).rgb * mat3_RGB2YIQ;
//Blur Y, I and Q
blur_YIQ_r = mix(blur_YIQ_r.xyz, smp_YIQ.xyz, w/vec3( bandwidth_mhz_Y_ntsc, bandwidth_mhz_I, bandwidth_mhz_Q));
}
@ -166,11 +169,11 @@ vec3 pixel_bleed_side_PAL(vec3 pixel_in, vec2 co, float size, sampler2D in_textu
for ( float i=1 ; i <= size ; i++ ){
w=w/SAT_BLEED_FALLOFF;
vec2 off = vec2(sourcesize2.z*i,0.0);
vec3 smp_YUV = texture(flick_and_noise_pass, co - i*off_l ).rgb * mat3_RGB2YUV;
vec3 smp_YUV = texture(in_texture, co - i*off_l ).rgb * mat3_RGB2YUV;
//Blur Y, U, V
blur_YUV_l = mix(blur_YUV_l.xyz, smp_YUV.xyz, w/vec3( bandwidth_mhz_Y_pal, bandwidth_mhz_U, bandwidth_mhz_V));
smp_YUV = texture(flick_and_noise_pass, co - i*off_r ).rgb * mat3_RGB2YUV;
smp_YUV = texture(in_texture, co - i*off_r ).rgb * mat3_RGB2YUV;
//Blur Y, U, V
blur_YUV_r = mix(blur_YUV_r.xyz, smp_YUV.xyz, w/vec3( bandwidth_mhz_Y_pal, bandwidth_mhz_U, bandwidth_mhz_V));
}
@ -193,7 +196,7 @@ vec4 pixel_bleed(vec4 pixel_in, vec2 co, sampler2D in_texture, vec4 sourcesize2)
#endif
if (SAT_BLEED_PAL == 1.0) {
return vec4 ( pixel_bleed_side_PAL(pixel_in.rgb, co, size, in_texture, sourcesize2), pixel_in.a);
return vec4 ( pixel_bleed_side_PAL(pixel_in.rgb, co, size, in_texture, sourcesize2), pixel_in.a);
} else {
return vec4 ( pixel_bleed_side_NTSC(pixel_in.rgba, co, size, in_texture, sourcesize2), pixel_in.a);
}
@ -202,41 +205,23 @@ 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;
//Handle case where both are needed:
//First shift the right source, then pass it to bleed function.
if (vDecon_or_SatBleed_or_JustShadow > 0.0 ) {
pixel_out = deconvergence_shadow_wrap(vTexCoord);
if (DO_SAT_BLEED > 0.0) {
if ( DO_FXAA == 1.0) {
pixel_out = pixel_bleed(pixel_out, vTexCoord, FXAA_pass, global.FXAA_passSize);
} else {
pixel_out = pixel_bleed(pixel_out, vTexCoord, flick_and_noise_pass, global.flick_and_noise_passSize);
}
}
} else
//Handle case where only deconvergence is requested
if (vDecon_or_JustShadow > 0.0 ) {
pixel_out = deconvergence_shadow_wrap(vTexCoord);
} else
if (DO_SAT_BLEED > 0.0) {
//Handle case where only chroma bleed is requested
if ( DO_FXAA == 1.0) {
pixel_out = texture(FXAA_pass, vTexCoord);
pixel_out = pixel_bleed(pixel_out, vTexCoord, FXAA_pass, global.FXAA_passSize);
} else {
pixel_out = texture(flick_and_noise_pass, vTexCoord);
pixel_out = pixel_bleed(pixel_out, vTexCoord, flick_and_noise_pass, global.flick_and_noise_passSize);
}
} else
//Passthrough
if ( DO_FXAA == 1.0) {
pixel_out = texture(FXAA_pass, vTexCoord);
pixel_out = texture(FXAA_pass, vTexCoord );
} else {
pixel_out = texture(flick_and_noise_pass, vTexCoord);
}
//shift
if (vDecon_or_JustShadow > 0.0 )
pixel_out = deconvergence_shadow_wrap(vTexCoord, pixel_out);
//..and bleed
if (DO_SAT_BLEED > 0.0)
pixel_out = pixel_bleed(pixel_out, vTexCoord, flick_and_noise_pass, global.flick_and_noise_passSize);
//pre-gamma if needed by glow.
if (DO_CCORRECTION > 0.5)
pixel_out.rgb = pow(pixel_out.rgb, vec3(IN_GLOW_GAMMA));