Made default shader more like a Sony PVM 2730 with a slightly softer image than the 20L4 Added two new slangp configs that represent a Sony PVM 2730 and a Sony PVM 20L4 Removed defunct shader parameters Added sharpness parameter Cleaned up shader a little

This commit is contained in:
majorpainthecactus 2021-12-30 22:08:43 +00:00
parent e2036576a2
commit 1e433f2c25
4 changed files with 24 additions and 19 deletions

View file

@ -0,0 +1,6 @@
#reference "crt-sony-pvm-4k-hdr.slangp"
Contrast = "4.500000"
PaperWhiteNits = "500.000000"
ScanlineWidth = "0.600000"
ResolutionPattern = "1.000000"
Sharpness = "2.500000"

View file

@ -0,0 +1,6 @@
#reference "crt-sony-pvm-4k-hdr.slangp"
Contrast = "4.500000"
PaperWhiteNits = "450.000000"
ScanlineWidth = "0.950000"
ResolutionPattern = "2.000000"
Sharpness = "1.800000"

View file

@ -6,7 +6,7 @@ an aperture grille afterwards which is kind of what a CRT would actually do - it
My HDR 700 monitors does seem to get reasonably close to the brightness of my PVM's - its not quite there but its close.
Currently geared towards a Sony PVM 20L4.
Currently defaults towards a Sony PVM 2730.
To use:
Please Enable HDR in RetroArch,
@ -77,7 +77,3 @@ mipmap_input3 = "false"
alias3 = ""
float_framebuffer3 = "false"
srgb_framebuffer3 = "false"
ScanlineWidth = "0.600000"
Contrast = "4.500000"
PaperWhiteNits = "500.000000"

View file

@ -27,16 +27,14 @@ layout(push_constant) uniform Push
vec4 OriginalSize;
vec4 OutputSize;
uint FrameCount;
float ScanlineWidth;
float ScreenWidth;
float ScreenHeight;
float ResolutionPattern;
float ScanlineWidth;
float ResolutionPattern;
float Sharpness;
} params;
#pragma parameter ScanlineWidth "Scanline Width" 0.5 0.0 1.0 0.01
#pragma parameter ScreenWidth "Screen Width" 3840.0 0.0 7680.0 1.0
#pragma parameter ScreenHeight "Screen Height" 2160.0 0.0 4320.0 1.0
#pragma parameter ResolutionPattern "Resolution Pattern" 1.0 0.0 8.0 1.0
#pragma parameter ScanlineWidth "Scanline Width" 0.95 0.0 1.0 0.01
#pragma parameter ResolutionPattern "Resolution Pattern" 2.0 0.0 8.0 1.0
#pragma parameter Sharpness "Sharpness" 1.8 0.0 5.0 0.1
layout(std140, set = 0, binding = 0) uniform UBO
{
@ -72,7 +70,6 @@ float ModInteger(float a, float b)
#define kGuassianMin vec3(1.1)
#define kGuassianMax vec3(3.0)
#define Sharpness 2.5
#define kRed vec3(1.0, 0.0, 0.0)
#define kGreen vec3(0.0, 1.0, 0.0)
@ -108,8 +105,8 @@ void main()
const float Gaussian = pow(kEuler, -0.5 * pow(ScanlineDistance/0.3, 2.0)); /* Gaussian distribution */
float Ratio = (vTexCoord.x * params.SourceSize.x) - (floor(vTexCoord.x * params.SourceSize.x));
Ratio = clamp(((Ratio - 0.5) * Sharpness) + 0.5, 0.0f, 1.0);
float HorizInterp = (vTexCoord.x * params.SourceSize.x) - (floor(vTexCoord.x * params.SourceSize.x));
HorizInterp = clamp(((HorizInterp - 0.5) * params.Sharpness) + 0.5, 0.0f, 1.0);
const vec2 SourceTexCoord0 = vec2(vTexCoord.x, ScanlinePosition / params.OutputSize.y);
@ -121,8 +118,8 @@ void main()
const vec3 HDRColour1 = texture(Source, SourceTexCoord1).xyz;
const vec3 SDRColour1 = texture(StockPass, SourceTexCoord1).xyz;
const vec3 HDRColour = mix(HDRColour0, HDRColour1, vec3(Ratio));
const vec3 SDRColour = mix(SDRColour0, SDRColour1, vec3(Ratio));
const vec3 HDRColour = mix(HDRColour0, HDRColour1, vec3(HorizInterp));
const vec3 SDRColour = mix(SDRColour0, SDRColour1, vec3(HorizInterp));
vec3 Luminance = Ramp3(vec3(Gaussian), (SDRColour * kGuassianMax) + kGuassianMin);