Hi, thanks for answering. I’ve been doing some more testing with latest release in SDR mode and I’ve found something that I’m sure will help you tackle the issue.
The issue with the 4K mask that I mentioned is being caused by the colour grading that is present in your shader.
I’ve used the 2730 sdr preset as a base and changed a few settings, mostly making things neutral and adjusting gamma as we discussed. See my preset quoted at the end of this post.
Currently this is tested with the shader colour space set to dci-p3 output, since it is what my monitor sdr output comes closest to and it also having the best gray ramp
With this preset the 4K|1000TVL mask output looks like this, which is obviously not how we want it:
Now, if I make the shader skip the colour grading / colour space conversion in gamma_correct.h like below (removing the color space conversion * k709_to_XYZ) * kXYZ_to_DCIP3):
include/gamma_correct.h
else
{
//const vec3 dcip3_colour = (scanline_colour * k709_to_XYZ) * kXYZ_to_DCIP3;
const vec3 dcip3_colour = scanline_colour;
gamma_out = LinearToDCIP3(dcip3_colour);
Then the exact same preset gives the following output, which is what we want obviously:
It would be nice to know whether or not the issue is related to other parts of your code. I noticed you have been incorporating the colour grading stuff from Dogway’s grade.slang, but there’s a big caveat with some of that colourspace code (I’m talking solely about the colour gamut / colour space conversions, I have no opinion on the other stuff). From what I’ve tested with grade.slang the colour space conversions to wide gamut are disfunctional. When I just use dogway’s grade.slang as a standalone it gives me very washed out colors. Much more than what it should be when putting sRGB/709 color space into wide gamut on a wide gamut monitor.
To me it seems the wide gamut colour space stuff in grade.slang was never really tested because dogway didn’t have a wide gamut monitor himself, so no proper way to compare whether 709 to DCI-P3 etc was giving comparable output as just being in native sRGB mode etc.
So again to not give the impression I’m dissing grade.slang, it’s only the colour space stuff in grade that I think should not be used.
My suggestion for you to try and get to the bottom of this would be to remove all colour gamut conversion stuff that you’ve integrated from grade.slang, and instead use the colour space conversion code from guest.r advanced. Which according to my testing seems to work OK. It may save you a lot of headache further along the road.
The guest.r code I’m referring to is in the pre-shaders-afterglow.slang pass, see here:
https://github.com/libretro/slang-shaders/blob/master/crt/shaders/guest/advanced/pre-shaders-afterglow.slang
With regards to sony megatron, personally I would be for having all the colour grading and gamma correct stuff in a single pass and not spread out among different passes and parts of the code. Maybe that is in the realm of possibility for the sony megatron?
Preset used with testing:
Note that I’ve been testing with a core that has double horizontal pixels, so you may want to adjust the sharpness when used with other cores
hcrt_hdr = "0.000000"
hcrt_colour_space = "2.000000"
hcrt_crt_resolution = "3.000000"
hcrt_colour_system = "0.000000"
hcrt_gamma_in = "1.760000"
hcrt_gamma_out = "1.759991"
hcrt_red_scanline_min = "0.800001"
hcrt_red_scanline_max = "0.900001"
hcrt_red_scanline_attack = "0.450000"
hcrt_green_scanline_min = "0.800001"
hcrt_green_scanline_max = "0.900001"
hcrt_green_scanline_attack = "0.450000"
hcrt_blue_scanline_min = "0.800001"
hcrt_blue_scanline_max = "0.900001"
hcrt_blue_scanline_attack = "0.450000"
hcrt_red_beam_sharpness = "0.500000"
hcrt_green_beam_sharpness = "0.500000"
hcrt_blue_beam_sharpness = "0.500000"