Merge pull request #374 from HyperspaceMadness/master

Mega Bezel V1.12.0_2023-03-11
This commit is contained in:
hizzlekizzle 2023-03-14 08:29:28 -05:00 committed by GitHub
commit 7d4ce160c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 410 additions and 120 deletions

View File

@ -186,7 +186,8 @@ filter_linear33 = true
float_framebuffer33 = "true"
alias33 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader34 = ../../../shaders/base/post-crt-prep-glass.slang

View File

@ -167,7 +167,8 @@ filter_linear29 = true
float_framebuffer29 = "true"
alias29 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader30 = ../../../shaders/base/post-crt-prep-image-layers.slang

View File

@ -155,7 +155,8 @@ filter_linear27 = true
float_framebuffer27 = "true"
alias27 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader28 = ../../../shaders/base/post-crt-prep-image-layers.slang

View File

@ -167,7 +167,8 @@ filter_linear29 = true
float_framebuffer29 = "true"
alias29 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader30 = ../../../shaders/base/post-crt-prep-glass.slang

View File

@ -155,7 +155,8 @@ filter_linear27 = true
float_framebuffer27 = "true"
alias27 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader28 = ../../../shaders/base/post-crt-prep-glass.slang

View File

@ -167,7 +167,8 @@ filter_linear29 = true
float_framebuffer29 = "true"
alias29 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader30 = ../../../shaders/base/post-crt-prep-no-reflect.slang

View File

@ -155,7 +155,8 @@ filter_linear27 = true
float_framebuffer27 = "true"
alias27 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader28 = ../../../shaders/base/post-crt-prep-no-reflect.slang

View File

@ -133,7 +133,8 @@ filter_linear20 = true
float_framebuffer20 = "true"
alias20 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader21 = ../../../shaders/base/post-crt-prep-glass.slang

View File

@ -107,7 +107,8 @@ filter_linear16 = true
float_framebuffer16 = "true"
alias16 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader17 = ../../../shaders/base/post-crt-prep-glass.slang

View File

@ -133,7 +133,8 @@ filter_linear20 = true
float_framebuffer20 = "true"
alias20 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader21 = ../../../shaders/base/post-crt-prep-image-layers.slang

View File

@ -107,7 +107,8 @@ filter_linear16 = true
float_framebuffer16 = "true"
alias16 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader17 = ../../../shaders/base/post-crt-prep-image-layers.slang

View File

@ -133,7 +133,8 @@ filter_linear20 = true
float_framebuffer20 = "true"
alias20 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader21 = ../../../shaders/base/post-crt-prep-no-reflect.slang

View File

@ -107,7 +107,8 @@ filter_linear16 = true
float_framebuffer16 = "true"
alias16 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader17 = ../../../shaders/base/post-crt-prep-no-reflect.slang

View File

@ -98,7 +98,7 @@ alias14 = "LinearizePass"
shader15 = ../../../shaders/base/delinearize.slang
float_framebuffer15 = "true"
shader16 = ../../../shaders/lcd-cgwg/hsm-lcd-grid-v2.slang
shader16 = ../../../shaders/lcd-cgwg/hsm-lcd-grid-v2-no-reflect.slang
filter_linear16 = "false"
scale_type16 = "viewport"
scale16 = "1.0"

View File

@ -133,7 +133,8 @@ filter_linear20 = true
float_framebuffer20 = "true"
alias20 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader21 = ../../../shaders/base/post-crt-prep-no-reflect.slang

View File

@ -107,7 +107,8 @@ filter_linear16 = true
float_framebuffer16 = "true"
alias16 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader17 = ../../../shaders/base/post-crt-prep-no-reflect.slang

View File

@ -115,7 +115,8 @@ filter_linear16 = true
float_framebuffer16 = "true"
alias16 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader17 = ../../../shaders/base/post-crt-prep-potato.slang

View File

@ -89,7 +89,8 @@ filter_linear12 = true
float_framebuffer12 = "true"
alias12 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader13 = ../../../shaders/base/post-crt-prep-potato.slang

View File

@ -95,7 +95,7 @@ alias13 = "LinearizePass"
shader14 = ../../../shaders/base/delinearize.slang
float_framebuffer14 = "true"
shader15 = ../../../shaders/lcd-cgwg/hsm-lcd-grid-v2.slang
shader15 = ../../../shaders/lcd-cgwg/hsm-lcd-grid-v2-potato.slang
filter_linear15 = "false"
scale_type15 = "viewport"
scale15 = "1.0"

View File

@ -134,7 +134,8 @@ filter_linear20 = true
float_framebuffer20 = "true"
alias20 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader21 = ../../../shaders/base/post-crt-prep-image-layers.slang

View File

@ -134,7 +134,8 @@ filter_linear20 = true
float_framebuffer20 = "true"
alias20 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader21 = ../../../shaders/base/post-crt-prep-image-layers.slang

View File

@ -134,7 +134,8 @@ filter_linear20 = true
float_framebuffer20 = "true"
alias20 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader21 = ../../../shaders/base/post-crt-prep-image-layers.slang

View File

@ -134,7 +134,8 @@ filter_linear20 = true
float_framebuffer20 = "true"
alias20 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader21 = ../../../shaders/base/post-crt-prep-image-layers.slang

View File

@ -108,7 +108,8 @@ filter_linear16 = true
float_framebuffer16 = "true"
alias16 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader17 = ../../../shaders/base/post-crt-prep-image-layers.slang

View File

@ -108,7 +108,8 @@ filter_linear16 = true
float_framebuffer16 = "true"
alias16 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader17 = ../../../shaders/base/post-crt-prep-image-layers.slang

View File

@ -108,7 +108,8 @@ filter_linear16 = true
float_framebuffer16 = "true"
alias16 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader17 = ../../../shaders/base/post-crt-prep-image-layers.slang

View File

@ -108,7 +108,8 @@ filter_linear16 = true
float_framebuffer16 = "true"
alias16 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader17 = ../../../shaders/base/post-crt-prep-image-layers.slang

View File

@ -108,7 +108,8 @@ filter_linear16 = true
float_framebuffer16 = "true"
alias16 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader17 = ../../../shaders/base/post-crt-prep-image-layers.slang

View File

@ -108,7 +108,8 @@ filter_linear16 = true
float_framebuffer16 = "true"
alias16 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader17 = ../../../shaders/base/post-crt-prep-image-layers.slang

View File

@ -116,7 +116,8 @@ filter_linear16 = true
float_framebuffer16 = "true"
alias16 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader17 = ../../../shaders/base/post-crt-prep-potato.slang

View File

@ -116,7 +116,8 @@ filter_linear16 = true
float_framebuffer16 = "true"
alias16 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader17 = ../../../shaders/base/post-crt-prep-potato.slang

View File

@ -84,7 +84,8 @@ filter_linear11 = true
float_framebuffer11 = "true"
alias11 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader12 = ../../../shaders/base/post-crt-prep-potato.slang

View File

@ -84,7 +84,8 @@ filter_linear11 = true
float_framebuffer11 = "true"
alias11 = "CRTPass"
g_sat = 0.15
g_sat = 0.25
g_lum = 0.15
g_gamma_out = 2.45
shader12 = ../../../shaders/base/post-crt-prep-potato.slang

View File

@ -3,7 +3,7 @@ Mega Bezel Shader Readme
------------------------------------------------------------------------------------------------------------
![Mega Bezel Logo](MegaBezelLogo.png)
**Version V1.11.0_2023-02-25**
**Version V1.12.0_2023-03-11**
----------------------------------------
----------------------------------------

View File

@ -1,27 +1,22 @@
![Mega_Bezel_Logo|512x256, 75%](upload://6PNkvcMF9Go9Wnk6OJXfYR1opXI.png)
Mega Bezel is updated to V1.11.0_2023-02-25
Mega Bezel is updated to V1.12.0_2023-03-11
Changes:
* Guest Advanced updated to crt-guest-advanced-2023-02-25-release1
* Improvements to the new Magic Glow feature
* Turn Magic Glow on and Increase the Glow amount to see the effect
* New Slot Mask Mitigation option to reduce moire
* Added/Restored Guest's Raster Bloom as well as Overscan control
* Updated Comments in presets to use # instead of // as per @hunterk's request
* Added rotation option for Rotate CRT Tube:
* -1 = 90 Degrees Clockwise (or 270 Counter Clockwise)
* 0 = No Rotation
* 1 = 90 Degrees Counter Clockwise
* Added groundwork for the wildcard replacement feature so presets will auto rotate and not flip in the future
* Fixed a performance issue where we were rendering more than we needed to
* This should increase performance across most presets
* Fixed color rainbowing in reflection for Guest-Advanced and LCD-GRID
* Updated to crt-guest-advanced-2023-03-11-release1
* Updated GDV-MINI from @ROBMARK85's request
----------------------------------------------------
--- TODO ---------------------------------------
----------------------------------------------------
* Update Guest to latest
* Check on Afterglow for BiRaitBec
* Add Curvature to EasyMode for lasly
* Rotate Texture Parameters
* Rotate Image Layers with Parameters
* Update Megatron
* Add Passthrough Preset, no crt shader
* Add AbsoluteMax as a scaling type

View File

@ -285,7 +285,7 @@ vec4 HHLP_GetBilinearTextureSample(sampler2D in_sampler, vec2 in_coord, vec4 in_
bool HHLP_IsOutsideCoordSpace(vec2 in_coord)
{
return (abs(in_coord.x - 0.5) > 0.51 && abs(in_coord.y - 0.5) > 0.51);
return (abs(in_coord.x - 0.5) > 0.501 || abs(in_coord.y - 0.5) > 0.501);
}
float rand(vec2 co, float size){

View File

@ -23,7 +23,7 @@
*/
// Screen Scale Required Parameters
#pragma parameter HSM_MEGA_BEZEL_TITLE "[ --- HSM MEGA BEZEL V1.11.0_2023-02-25 --- ]" 0 0 0.001 0.001
#pragma parameter HSM_MEGA_BEZEL_TITLE "[ --- HSM MEGA BEZEL V1.12.0_2023-03-11 --- ]" 0 0 0.001 0.001
#pragma parameter HSM_RESOLUTION_DEBUG_ON " Show Resolution Info" 0 0 1 1
float HSM_RESOLUTION_DEBUG_ON = global.HSM_RESOLUTION_DEBUG_ON;

View File

@ -362,7 +362,7 @@ void main()
SCREEN_ASPECT,
bezel_outside_flat_coord,
frame_outside_flat_coord);
cache_bounds_coord = (frame_outside_flat_coord - 0.5) * 0.9 + 0.5;
cache_bounds_coord = (bezel_outside_flat_coord - 0.5) * 0.9 + 0.5;
#endif
if (HHLP_IsOutsideCoordSpace(cache_bounds_coord))

View File

@ -569,11 +569,11 @@ float DrawResolutions(vec2 uv, vec2 viewport_size, vec2 screen_size, vec4 screen
print_pos.x = margin;
print_pos.y += STRHEIGHT(1);
// Text Version V1.11.0_2023-02-25
// Text Version V1.12.0_2023-03-11
// Version
_1 _per _1 _1 _per _0 _spc
_1 _per _1 _2 _per _0 _spc
// Date
_2 _0 _2 _3 _dsh _0 _2 _dsh _2 _5
_2 _0 _2 _3 _dsh _0 _3 _dsh _1 _1
// Title ----------------------------------------------------------
print_pos.x = margin;

View File

@ -1,5 +1,5 @@
/*
CRT - Guest - Nomask w. Curvature
CRT - Guest - Nomask w. Curvature
With work by DariusG to create a cut down extra fast version
Copyright (C) 2017-2018 guest(r) - guest.r@gmail.com
@ -25,8 +25,6 @@ layout(push_constant) uniform Push
vec4 SourceSize;
vec4 OriginalSize;
vec4 OutputSize;
uint FrameCount;
float brightboost;
float saturation;
float scanline;
@ -39,48 +37,61 @@ layout(push_constant) uniform Push
float maskDark;
float maskLight;
float CGWG;
// float warpX;
// float warpY;
// float gamma_out;
// float vignette;
} params;
// Parameter lines go here:
#pragma parameter GDVMINI_X_EMPTY_LINE " " 0 0 0.001 0.001
#pragma parameter gdv_mini_title "[ GDV MINI - DariusG ]:" 0.0 0.0 1.0 1.0
#pragma parameter brightboost " Bright boost -- brightboost" 1.1 0.5 2.0 0.05
#pragma parameter brightboost " Bright boost -- brightboost" 1.0 0.5 2.0 0.05
#define brightboost params.brightboost
#pragma parameter saturation " Saturation adjustment -- saturation" 1.1 0.1 2.0 0.05
#pragma parameter saturation " Saturation adjustment -- saturation" 1.0 0.0 2.0 0.05
#define saturation params.saturation
#pragma parameter scanline " Scanline Adjust -- scanline" 8 1 12 1
#pragma parameter scanline " Scanline Adjust -- scanline" 8.0 1.0 12.0 1.0
#define scanline params.scanline
#pragma parameter beam_min " Scanline Dark -- beam_min" 1.7 0.5 3 0.05
#pragma parameter beam_min " Scanline Dark -- beam_min" 1.7 0.5 3.0 0.05
#define beam_min params.beam_min
#pragma parameter beam_max " Scanline Bright -- beam_max" 2.1 0.5 3 0.05
#pragma parameter beam_max " Scanline Bright -- beam_max" 2.1 0.5 3.0 0.05
#define beam_max params.beam_max
#pragma parameter h_sharp " Horizontal Sharpness -- h_sharp" 2 1 5 0.05
#pragma parameter h_sharp " Horizontal Sharpness -- h_sharp" 2.0 1.0 5.0 0.05
#define h_sharp params.h_sharp
#pragma parameter shadowMask " CRT Mask: 0:CGWG, 1-4:Lottes, 5-6:Trinitron" 0.0 -1.0 8.0 1.0
#pragma parameter shadowMask " CRT Mask: 0:CGWG, 1-4:Lottes, 5-6:Trinitron" 0.0 -1.0 10.0 1.0
#define shadowMask params.shadowMask
#pragma parameter masksize " CRT Mask Size (2.0 is nice in 4k) -- masksize" 0 0 2.0 1.0
#pragma parameter masksize " CRT Mask Size (2.0 is nice in 4k) -- masksize" 0.0 0.0 2.0 1.0
#define masksize params.masksize
#pragma parameter mcut " Mask 5-7 cutoff -- mcut" 0.2 0.0 0.5 0.05
#pragma parameter mcut " Mask 5-7-10 cutoff -- mcut" 0.2 0.0 0.5 0.05
#define mcut params.mcut
#pragma parameter maskDark " Lottes maskDark" 0.5 0.0 2 0.1
#pragma parameter maskDark " Lottes maskDark" 0.5 0.0 2.0 0.1
#define maskDark params.maskDark
#pragma parameter maskLight " Lottes maskLight" 1.5 0.0 2.0 0.1
#define maskLight params.maskLight
#pragma parameter CGWG " CGWG Mask Str. -- CGWG" 0.4 0 1 0.1
#pragma parameter CGWG " CGWG Mask Str. -- CGWG" 0.4 0.0 1.0 0.1
#define CGWG params.CGWG
// #pragma parameter warpX "CurvatureX (default 0.03)" 0.0 0.0 0.25 0.01
// #define warpX params.warpX
// #pragma parameter warpY "CurvatureY (default 0.04)" 0.0 0.0 0.25 0.01
// #define warpY params.warpY
// #pragma parameter vignette "Vignette On/Off" 0.0 0.0 1.0 1.0
// #define vignette params.vignette
#pragma stage vertex
layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord;
@ -152,9 +163,9 @@ vec3 Mask(vec2 pos, vec3 c)
pos.x = fract(pos.x/3.0);
if (pos.x < 0.333) mask.r = maskLight;
if (pos.x < 0.333) mask.b = maskLight;
else if (pos.x < 0.666) mask.g = maskLight;
else mask.b = maskLight;
else mask.r = maskLight;
mask*=line;
}
@ -164,9 +175,9 @@ vec3 Mask(vec2 pos, vec3 c)
{
pos.x = fract(pos.x/3.0);
if (pos.x < 0.333) mask.r = maskLight;
if (pos.x < 0.333) mask.b = maskLight;
else if (pos.x < 0.666) mask.g = maskLight;
else mask.b = maskLight;
else mask.r = maskLight;
}
// Stretched VGA style shadow mask (same as prior shaders).
@ -175,9 +186,9 @@ vec3 Mask(vec2 pos, vec3 c)
pos.x += pos.y*3.0;
pos.x = fract(pos.x/6.0);
if (pos.x < 0.333) mask.r = maskLight;
if (pos.x < 0.333) mask.b = maskLight;
else if (pos.x < 0.666) mask.g = maskLight;
else mask.b = maskLight;
else mask.r = maskLight;
}
// VGA style shadow mask.
@ -187,9 +198,9 @@ vec3 Mask(vec2 pos, vec3 c)
pos.x += pos.y*3.0;
pos.x = fract(pos.x/6.0);
if (pos.x < 0.333) mask.r = maskLight;
if (pos.x < 0.333) mask.b = maskLight;
else if (pos.x < 0.666) mask.g = maskLight;
else mask.b = maskLight;
else mask.r = maskLight;
}
// Alternate mask 5
@ -246,8 +257,91 @@ vec3 Mask(vec2 pos, vec3 c)
else mask.g = maskLight;
mask*=line;
}
else if (shadowMask == 9.0)
{
vec3 Mask = vec3(maskDark);
float bright = maskLight;
float left = 0.0;
if (fract(pos.x/6.0) < 0.5)
left = 1.0;
float m = fract(pos.x/3.0);
if (m < 0.3333) Mask.b = 0.9;
else if (m < 0.6666) Mask.g = 0.9;
else Mask.r = 0.9;
if (mod(pos.y,2.0)==1.0 && left == 1.0 || mod(pos.y,2.0)==0.0 && left == 0.0 ) Mask*=bright;
return Mask;
}
else if (shadowMask == 10.0)
{
vec3 Mask = vec3(maskDark);
float line = maskLight;
float odd = 0.0;
if (fract(pos.x/6.0) < 0.5)
odd = 1.0;
if (fract((pos.y + odd)/2.0) < 0.5)
line = 1.0;
float m = fract(pos.x/3.0);
float y = fract(pos.y/2.0);
if (m > 0.3333) {Mask.r = 1.0; Mask.b = 1.0;}
else if (m > 0.6666) Mask.g = 1.0;
else Mask = vec3(mcut);
if (m>0.333) Mask*=line;
return Mask;
}
return mask;
}
}
/* HSM Removed
mat3 vign( float l )
{
vec2 vpos = vTexCoord;
vpos *= 1.0 - vpos.xy;
float vig = vpos.x * vpos.y * 40.0;
vig = min(pow(vig, 0.2), 1.0);
if (vignette == 0.0) vig=1.0;
return mat3(vig, 0, 0,
0, vig, 0,
0, 0, vig);
}
// Distortion of scanlines, and end of screen alpha.
vec2 Warp(vec2 pos)
{
pos = pos*2.0-1.0;
pos *= vec2(1.0 + (pos.y*pos.y)*warpX, 1.0 + (pos.x*pos.x)*warpY);
return pos*0.5 + 0.5;
}
*/
vec3 saturationFunction (vec3 textureColor)
{
float lum=length(textureColor.rgb)*0.5775;
vec3 luminanceWeighting = vec3(0.3,0.6,0.1);
if (lum<0.5) luminanceWeighting.rgb=(luminanceWeighting.rgb*luminanceWeighting.rgb)+(luminanceWeighting.rgb*luminanceWeighting.rgb);
float luminance = dot(textureColor.rgb, luminanceWeighting);
vec3 greyScaleColor = vec3(luminance);
vec3 res = vec3(mix(greyScaleColor, textureColor.rgb, saturation));
return res;
}
void main()
{
@ -268,7 +362,7 @@ void main()
SCREEN_ASPECT,
bezel_outside_flat_coord,
frame_outside_flat_coord);
cache_bounds_coord = (frame_outside_flat_coord - 0.5) * 0.9 + 0.5;
cache_bounds_coord = (bezel_outside_flat_coord - 0.5) * 0.9 + 0.5;
#endif
#endif
@ -312,15 +406,18 @@ void main()
vec3 color = color1*sw(f,luma1) + color2*sw(1.0-f,luma2);
color*=brightboost;
color = min(color, 1.0);
color = color * Mask(vTexCoord * global.OutputSize.xy, color);
float lum = color.r*0.3+color.g*0.6+color.b*0.1;
// Apply difference between GAMMA_INPUT and HSM_GAMMA_OUT_CRT
color = pow(color, vec3(GAMMA_INPUT / HSM_GAMMA_OUT_CRT) + 0.05);
float l = length(color);
color = normalize(pow(color, vec3(saturation,saturation,saturation)))*l;
color*= mix(1.0,brightboost,lum);
color = saturationFunction(color);
// HSM Removed
// color*= vign(lum);
FragColor = vec4(color, 1.0);
}

View File

@ -255,7 +255,7 @@ void main()
SCREEN_ASPECT,
bezel_outside_flat_coord,
frame_outside_flat_coord);
cache_bounds_coord = (frame_outside_flat_coord - 0.5) * 0.9 + 0.5;
cache_bounds_coord = (bezel_outside_flat_coord - 0.5) * 0.9 + 0.5;
#endif
#endif

View File

@ -273,7 +273,7 @@ void main()
SCREEN_ASPECT,
bezel_outside_flat_coord,
frame_outside_flat_coord);
cache_bounds_coord = (frame_outside_flat_coord - 0.5) * 0.9 + 0.5;
cache_bounds_coord = (bezel_outside_flat_coord - 0.5) * 0.9 + 0.5;
#endif
#endif
@ -643,7 +643,22 @@ if (abs(vertmask) > 0.025)
USE_VERTICAL_SCANLINES * CROPPED_ROTATED_SIZE_WITH_RES_MULT.x;
float hsm_no_scanlines = HSM_INTERLACE_MODE < 0 && HSM_INTERLACE_TRIGGER_RES <= scan_res ? 1 : no_scanlines;
color = (gc(color1)*w1*cd1 + gc(color2)*w2*cd2)/mix(1.0.xxx, w1+w2, hsm_no_scanlines);
// HSM Added
float screen_mask = HSM_GetCornerMask((screen_curved_coord - 0.5) * 0.999 + 0.5, SCREEN_ASPECT, HSM_GLOBAL_CORNER_RADIUS * HSM_SCREEN_CORNER_RADIUS_SCALE, 0.9);
bool is_inside_screen = screen_mask > 0.001;
// if (is_inside_screen)
color = (gc(color1)*w1*cd1 + gc(color2)*w2*cd2)/mix(1.0.xxx, w1+w2, hsm_no_scanlines);
// TODO this bit was to remove scanlines outside of the screen,
// but it has a problem when scangamma is used, so is disabled for now
// else
// {
// color = (gc(color1)*w1*cd1 + gc(color2)*w2*cd2)/(w1+w2);
// vec3 color_no_scanline = gc(color1) + gc(color2);
// color = mix(color, color_no_scanline, hsm_no_scanlines);
// }
// End HSM Addition
if (abs(rolling_scan) > 0.005)
{

View File

@ -163,14 +163,14 @@
#pragma parameter slotmask1 " Slot Mask Strength Dark Pixels -- slotmask1" 0.0 0.0 1.0 0.05
#define slotmask1 global.slotmask1
#pragma parameter slotwidth " Slot Mask Width -- slotwidth" 2.0 1.0 8.0 1.0
#pragma parameter slotwidth " Slot Mask Width -- slotwidth" 2.0 1.0 16.0 1.0
#define slotwidth global.slotwidth // Slot Mask Width
#pragma parameter double_slot " Slot Mask Height: 2x1 or 4x1... -- double_slot" 1.0 1.0 4.0 1.0
#define double_slot global.double_slot // Slot Mask Height
#pragma parameter slotms " Slot Mask Size - Auto | 2K | 4k -- slotms" 1.0 0.0 4.0 1.0
#define slotms global.slotms // Slot Mask Size
#pragma parameter slotms " Slot Mask Thickness - Auto | 2K | 4k -- slotms" 1.0 0.0 4.0 1.0
#define slotms global.slotms // Slot Mask Thickness
#pragma parameter mclip " Keep Mask Effect with Clipping -- mclip" 0.0 0.0 1.0 0.05
#define mclip global.mclip
@ -231,6 +231,15 @@
// #pragma parameter post_br " Post CRT Brightness" 1.0 0.25 5.0 0.01
#define red vec3(1, 0, 0)
#define green vec3(0, 1, 0)
#define blue vec3(0, 0, 1)
#define magenta vec3(1, 0, 1)
#define yellow vec3(1, 1, 0)
#define cyan vec3(0, 1, 1)
#define white vec3(1, 1, 1)
#define black vec3(0, 0, 0)
#define COMPAT_TEXTURE(c,d) texture(c,d)
#define TEX0 vTexCoord
@ -283,7 +292,7 @@ float HSM_GetAutoScaledMaskSize(float in_masksize)
// Shadow mask (1-4 from PD CRT Lottes shader).
vec3 Mask(vec2 pos, float mx, float mb)
vec3 Mask(vec2 pos, float mx, float mb, inout float mask_average_luma)
{
// HSM Added
float final_mask_size = HSM_GetAutoScaledMaskSize(masksize);
@ -310,6 +319,7 @@ vec3 Mask(vec2 pos, float mx, float mb)
*/
vec3 mask = vec3(maskDark, maskDark, maskDark);
vec3 mask_average = vec3(maskDark, maskDark, maskDark);
vec3 one = vec3(1.0);
// brightness correcture masks 5-12
@ -322,6 +332,9 @@ vec3 Mask(vec2 pos, float mx, float mb)
if (shadowMask == -1.0)
{
mask = vec3(1.0);
mask_average = vec3(1.0);
mask_average_luma = 1;
return mask;
}
// Phosphor.
@ -330,6 +343,9 @@ vec3 Mask(vec2 pos, float mx, float mb)
pos.x = fract(pos.x*0.5);
if (pos.x < 0.49) { mask.r = 1.0; mask.g = mc; mask.b = 1.0; }
else { mask.r = mc; mask.g = 1.0; mask.b = mc; }
// HSM Added
mask_average = (black + white + white + vec3(1, mc, 1) + vec3(mc, 1, mc)) / 5;
}
// Very compressed TV style shadow mask.
@ -350,6 +366,14 @@ vec3 Mask(vec2 pos, float mx, float mb)
else mask.b = maskLight;
mask*=line;
// HSM Added
mask_average = (
vec3(maskLight, mask_average.g, mask_average.b) +
vec3(mask_average.r, maskLight, mask_average.b) +
vec3(mask_average.r, mask_average.g, maskLight))
/ 3;
mask_average *= (maskDark * 2 + maskLight) / 3.0;
}
// Aperture-grille.
@ -360,6 +384,13 @@ vec3 Mask(vec2 pos, float mx, float mb)
if (pos.x < 0.5) mask.r = maskLight;
else if (pos.x < 1.5) mask.g = maskLight;
else mask.b = maskLight;
// HSM Added
mask_average = (black +
vec3(maskLight, mask_average.g, mask_average.b) +
vec3(mask_average.r, maskLight, mask_average.b) +
vec3(mask_average.r, mask_average.g, maskLight))
/ 4;
}
// Stretched VGA style shadow mask (same as prior shaders).
@ -371,6 +402,14 @@ vec3 Mask(vec2 pos, float mx, float mb)
if (pos.x < 0.3) mask.r = maskLight;
else if (pos.x < 0.6) mask.g = maskLight;
else mask.b = maskLight;
// HSM Added
mask_average = (black +
white +
vec3(maskLight, mask_average.g, mask_average.b) +
vec3(mask_average.r, maskLight, mask_average.b) +
vec3(mask_average.r, mask_average.g, maskLight))
/ 5;
}
// VGA style shadow mask.
@ -380,9 +419,17 @@ vec3 Mask(vec2 pos, float mx, float mb)
pos.x += pos.y*3.0;
pos.x = fract(pos.x/6.0);
if (pos.x < 0.3) mask.r = maskLight;
if (pos.x < 0.3) mask.r = maskLight;
else if (pos.x < 0.6) mask.g = maskLight;
else mask.b = maskLight;
// HSM Added
mask_average = (black +
white +
vec3(maskLight, mask_average.g, mask_average.b) +
vec3(mask_average.r, maskLight, mask_average.b) +
vec3(mask_average.r, mask_average.g, maskLight))
/ 5;
}
// Trinitron mask 5
@ -396,6 +443,10 @@ vec3 Mask(vec2 pos, float mx, float mb)
}
else mask.g = 1.0;
mask = clamp(mix( mix(one, mask, mcut), mix(one, mask, maskstr), mx), 0.0, 1.0) * dark_compensate;
// HSM Added
mask_average = (magenta + green) / 2;
mask_average = clamp(mix( mix(one, mask_average, mcut), mix(one, mask_average, maskstr), mx), 0.0, 1.0) * dark_compensate;
}
// Trinitron mask 6
@ -407,6 +458,10 @@ vec3 Mask(vec2 pos, float mx, float mb)
else if (pos.x < 1.5) mask.g = 1.0;
else mask.b = 1.0;
mask = clamp(mix( mix(one, mask, mcut), mix(one, mask, maskstr), mx), 0.0, 1.0) * dark_compensate;
// HSM Added
mask_average = (red + green + blue) / 3;
mask_average = clamp(mix( mix(one, mask_average, mcut), mix(one, mask_average, maskstr), mx), 0.0, 1.0) * dark_compensate;
}
// BW Trinitron mask 7
@ -419,6 +474,10 @@ vec3 Mask(vec2 pos, float mx, float mb)
}
else mask = 1.0.xxx;
mask = clamp(mix( mix(one, mask, mcut), mix(one, mask, maskstr), mx), 0.0, 1.0) * dark_compensate;
// HSM Added
mask_average = (black + white) / 2;
mask_average = clamp(mix( mix(one, mask_average, mcut), mix(one, mask_average, maskstr), mx), 0.0, 1.0) * dark_compensate;
}
// BW Trinitron mask 8
@ -430,6 +489,10 @@ vec3 Mask(vec2 pos, float mx, float mb)
else if (pos.x < 0.6) mask = 1.0.xxx;
else mask = 1.0.xxx;
mask = clamp(mix( mix(one, mask, mcut), mix(one, mask, maskstr), mx), 0.0, 1.0) * dark_compensate;
// HSM Added
mask_average = (black + white + white) / 3.0;
mask_average = clamp(mix( mix(one, mask_average, mcut), mix(one, mask_average, maskstr), mx), 0.0, 1.0) * dark_compensate;
}
// Magenta - Green - Black mask
@ -441,6 +504,10 @@ vec3 Mask(vec2 pos, float mx, float mb)
else if (pos.x < 0.6) mask.rb = 1.0.xx;
else mask.g = 1.0;
mask = clamp(mix( mix(one, mask, mcut), mix(one, mask, maskstr), mx), 0.0, 1.0) * dark_compensate;
// HSM Added
mask_average = (black + black + magenta + green) / 4.0;
mask_average = clamp(mix( mix(one, mask_average, mcut), mix(one, mask_average, maskstr), mx), 0.0, 1.0) * dark_compensate;
}
// RGBX
@ -453,6 +520,11 @@ vec3 Mask(vec2 pos, float mx, float mb)
else if (pos.x < 0.7) mask.g = 1.0;
else mask.b = 1.0;
mask = clamp(mix( mix(one, mask, mcut), mix(one, mask, maskstr), mx), 0.0, 1.0) * dark_compensate;
// HSM Added
// mask_average = (black + red + green + blue) / 4.0;
mask_average = (red + green + blue) / 4.0;
mask_average = clamp(mix( mix(one, mask_average, mcut), mix(one, mask_average, maskstr), mx), 0.0, 1.0) * dark_compensate;
}
// 4k mask
@ -465,6 +537,10 @@ vec3 Mask(vec2 pos, float mx, float mb)
else if (pos.x < 0.7) mask.gb = 1.0.xx;
else mask.b = 1.0;
mask = clamp(mix( mix(one, mask, mcut), mix(one, mask, maskstr), mx), 0.0, 1.0) * dark_compensate;
// HSM Added
mask_average = (red + yellow + cyan + blue) / 4.0;
mask_average = clamp(mix( mix(one, mask_average, mcut), mix(one, mask_average, maskstr), mx), 0.0, 1.0) * dark_compensate;
}
// RRGGBBX mask
@ -477,6 +553,11 @@ vec3 Mask(vec2 pos, float mx, float mb)
else if (pos.x < 4.5) mask.g = 1.0;
else mask.b = 1.0;
mask = clamp(mix( mix(one, mask, mcut), mix(one, mask, maskstr), mx), 0.0, 1.0) * dark_compensate;
// HSM Added
// mask_average = (black + red * red + green * green + blue + blue) / 7.0;
mask_average = (red * red + green * green + blue + blue) / 6.0;
mask_average = clamp(mix( mix(one, mask_average, mcut), mix(one, mask_average, maskstr), mx), 0.0, 1.0) * dark_compensate;
}
// 4k mask
@ -491,12 +572,41 @@ vec3 Mask(vec2 pos, float mx, float mb)
else if (pos.x < 4.5) mask.gb = 1.0.xx;
else mask.b = 1.0;
mask = clamp(mix( mix(one, mask, mcut), mix(one, mask, maskstr), mx), 0.0, 1.0) * dark_compensate;
// HSM Added
mask_average = (black + red + yellow + white + cyan + blue) / 6.0;
mask_average = clamp(mix( mix(one, mask_average, mcut), mix(one, mask_average, maskstr), mx), 0.0, 1.0) * dark_compensate;
}
// HSM Added
float maskmin_average = min(min(mask_average.r, mask_average.g), mask_average.b);
mask_average = (mask_average - maskmin_average) * (1.0 + (maskboost - 1.0) * mb) + maskmin_average;
mask_average_luma = dot(mask_average.rgb, vec3(0.299, 0.587, 0.114));
float maskmin = min(min(mask.r,mask.g),mask.b);
return (mask - maskmin) * (1.0 + (maskboost-1.0)*mb) + maskmin;
}
// TODO need to instead just have a extra parameter to the mask functions to give the average back
// HSM Added
// vec3 HSM_MaskAverage(vec2 start_pos, float mx, float mb)
// {
// int sample_count = 32;
// vec3 mask_sum = vec3(0);
// for(int i=0; i <= sample_count; i++)
// {
// for(int j=0; j <= sample_count; j++)
// {
// mask_sum += Mask(start_pos + vec2(i, j), mx, mb);
// }
// }
// return vec3((mask_sum.r + mask_sum.g + mask_sum.b) / 3.0) / float(sample_count * sample_count);
// }
float SlotMask(vec2 pos, float m)
{
if ((slotmask + slotmask1) == 0.0) return 1.0;
@ -506,7 +616,7 @@ float SlotMask(vec2 pos, float m)
// HSM Added
float final_mask_size = HSM_GetAutoScaledMaskSize(slotms);
pos = floor(pos / final_mask_size);
pos.y = floor(pos.y / final_mask_size);
// End HSM Added
/* HSM Removed
@ -523,7 +633,17 @@ float SlotMask(vec2 pos, float m)
return slot;
}
}
// HSM Added
float HSM_SlotMaskAverage(vec2 start_pos, float m)
{
float slot_dark = mix(1.0 - slotmask1, 1.0 - slotmask, m);
float slot = (slotwidth * 1 + 2 * slot_dark +
double_slot * 1 + 2 * slot_dark) /
(slotwidth + 2 + double_slot + 2);
return slot;
}
/* HSM Removed
vec2 Warp(vec2 pos)
{
@ -723,11 +843,11 @@ void main()
BEZEL_OUTSIDE_COORD,
BEZEL_OUTSIDE_CURVED_COORD,
FRAME_OUTSIDE_CURVED_COORD);
cache_bounds_coord = (FRAME_OUTSIDE_CURVED_COORD - 0.5) * 0.9 + 0.5;
cache_bounds_coord = (BEZEL_OUTSIDE_COORD - 0.5) * 0.9 + 0.5;
#endif
#endif
if (cache_bounds_coord.x < -0.01 || cache_bounds_coord.x > 1.01 || cache_bounds_coord.y < -0.01 || cache_bounds_coord.y > 1.01)
if (HHLP_IsOutsideCoordSpace(cache_bounds_coord))
{
FragColor = vec4(0);
return;
@ -806,7 +926,10 @@ if ((abs(global.deconrr) + abs(global.deconrry) + abs(global.deconrg) + abs(glob
*/
// HSM Added
if (GDV_DECONVERGENCE_ON > 0.5 && ((abs(global.deconrr) + abs(global.deconrry) + abs(global.deconrg) + abs(global.deconrgy) + abs(global.deconrb) + abs(global.deconrby)) > 0.2))
float screen_mask = HSM_GetCornerMask((screen_curved_coord - 0.5) * 0.999 + 0.5, SCREEN_ASPECT, HSM_GLOBAL_CORNER_RADIUS * HSM_SCREEN_CORNER_RADIUS_SCALE, 0.9);
bool is_inside_screen = screen_mask > 0.001;
if (is_inside_screen && GDV_DECONVERGENCE_ON > 0.5 && ((abs(global.deconrr) + abs(global.deconrry) + abs(global.deconrg) + abs(global.deconrgy) + abs(global.deconrb) + abs(global.deconrby)) > 0.2))
fetch_pixel(color, Bloom, pos1, pos); // deconvergence
float cm = igc(max(max(color.r,color.g),color.b));
@ -847,7 +970,15 @@ if ((abs(global.deconrr) + abs(global.deconrry) + abs(global.deconrg) + abs(glob
float smask = SlotMask(maskcoord, mx);
smask = clamp(smask + mix(smask_mit, 0.0, min(w3, sqrt(max(max(orig1.r,orig1.g),orig1.b)))), 0.0, 1.0);
cmask*= Mask(maskcoord, mx, mb);
float mask_average_luma = 0;
cmask*= Mask(maskcoord, mx, mb, mask_average_luma);
if (!is_inside_screen)
{
smask = HSM_SlotMaskAverage(vec2(0.5), mx);
smask = clamp(smask + mix(smask_mit, 0.0, min(w3, sqrt(max(max(orig1.r,orig1.g),orig1.b)))), 0.0, 1.0);
cmask = vec3(mask_average_luma);
}
if (mask_layout > 0.5) cmask = cmask.rbg;

View File

@ -1 +1 @@
crt-guest-advanced-2023-02-25-release1
crt-guest-advanced-2023-03-11-release1

View File

@ -201,7 +201,7 @@ void main()
BEZEL_OUTSIDE_COORD,
BEZEL_OUTSIDE_CURVED_COORD,
FRAME_OUTSIDE_CURVED_COORD);
cache_bounds_coord = (FRAME_OUTSIDE_CURVED_COORD - 0.5) * 0.9 + 0.5;
cache_bounds_coord = (BEZEL_OUTSIDE_COORD - 0.5) * 0.9 + 0.5;
#endif
#endif

View File

@ -0,0 +1,6 @@
#version 450
#define IS_NO_REFLECT_PRESET
#include "../base/common/globals-and-screen-scale-params.inc"
#include "../base/common/common-functions.inc"
#include "hsm-lcd-grid-v2.inc"

View File

@ -0,0 +1,5 @@
#version 450
#include "../base/common/globals-and-potato-params.inc"
#include "../base/common/common-functions.inc"
#include "hsm-crt-guest-advanced.inc"

View File

@ -106,28 +106,34 @@ void main()
vec2 cache_bounds_coord = SCREEN_COORD;
// // If it's the potato preset render the whole frame
// #ifndef IS_POTATO_PRESET
// #ifndef IS_NO_REFLECT_PRESET
// vec2 bezel_outside_flat_coord;
// vec2 frame_outside_flat_coord;
// HSM_GetSimpleBezelCoords(TUBE_DIFFUSE_COORD,
// TUBE_DIFFUSE_SCALE,
// TUBE_SCALE,
// SCREEN_ASPECT,
// bezel_outside_flat_coord,
// frame_outside_flat_coord);
// cache_bounds_coord = (frame_outside_flat_coord - 0.5) * 0.9 + 0.5;
// #endif
// #endif
// If it's the potato preset render the whole frame
#ifndef IS_POTATO_PRESET
#ifndef IS_NO_REFLECT_PRESET
// Have to get the scale of the coordinates so we can figure out the size of the onscreen rectangle of the area
HSM_GetBezelCoords(TUBE_DIFFUSE_COORD,
TUBE_DIFFUSE_SCALE,
TUBE_SCALE,
SCREEN_ASPECT,
false,
BEZEL_OUTSIDE_SCALE,
BEZEL_OUTSIDE_COORD,
BEZEL_OUTSIDE_CURVED_COORD,
FRAME_OUTSIDE_CURVED_COORD);
cache_bounds_coord = (BEZEL_OUTSIDE_COORD - 0.5) * 0.9 + 0.5;
#endif
#endif
// if (HHLP_IsOutsideCoordSpace(cache_bounds_coord))
// {
// FragColor = vec4(0);
// return;
// }
if (HHLP_IsOutsideCoordSpace(cache_bounds_coord))
{
FragColor = vec4(0);
return;
}
vec2 screen_curved_coord = HSM_GetCRTShaderCurvedCoord(SCREEN_COORD);
// HSM Added
float screen_mask = HSM_GetCornerMask((screen_curved_coord - 0.5) * 1.00 + 0.5, SCREEN_ASPECT, HSM_GLOBAL_CORNER_RADIUS * HSM_SCREEN_CORNER_RADIUS_SCALE, 0.9);
vec2 curved_coord = HSM_GetMirrorWrappedCoord(screen_curved_coord);
vec2 texelSize = 1 / CROPPED_ROTATED_SIZE_WITH_RES_MULT;
// End Addition
@ -169,9 +175,11 @@ void main()
vec3 averageColor = topLeftColor + bottomRightColor + bottomLeftColor + topRightColor;
averageColor = mat3(cred, cgreen, cblue) * averageColor;
// HSM Added
vec3 source_color = texture(Source, curved_coord).rgb;
vec3 averageColorOutsideScreen = mix(mat3(cred, cgreen, cblue) * source_color, source_color, 0.75);
averageColor = mix(averageColorOutsideScreen, averageColor, screen_mask);
FragColor = vec4(averageColor, 1);
FragColor = pow(FragColor, vec4(1 / (HSM_GAMMA_OUT_CRT / DEFAULT_SRGB_GAMMA)));
}

View File

@ -2,4 +2,6 @@
#include "../base/common/globals-and-screen-scale-params.inc"
#include "../base/common/common-functions.inc"
#include "../base/common/params-2-bezel.inc"
#include "../base/common/common-functions-bezel.inc"
#include "hsm-lcd-grid-v2.inc"

View File

@ -1164,7 +1164,7 @@ void main()
SCREEN_ASPECT,
bezel_outside_flat_coord,
frame_outside_flat_coord);
cache_bounds_coord = (frame_outside_flat_coord - 0.5) * 0.9 + 0.5;
cache_bounds_coord = (bezel_outside_flat_coord - 0.5) * 0.9 + 0.5;
#endif
#endif