Sony Megatron Colour Video Monitor

This should be a trivial test to perform. I’ll give it a go when I get a chance and we’ll see what happens when we take off the mask and the shader.

Mask/Shader Off

Mask/Shader On

6 Likes

Hi there. Yesterday I found out about the Sony Megatron shader and I was blown away by how much it resembled a real CRT shader. Also saw the Dead Cells vid on Youtube and in motion too it looks fabulous. So today I’ve been trying to implement it in reshade. I’m using “ReShade_Setup_5.8.0_Addon” so that I can also the AutoHDR addon. I was able to enable that succesfully within reshade. Regrettably, with the Sony Megatron.fx shader I keep getting a red “failed to compile” message in my shader overview.

To be clear, I’m using reshade with standalone version of MAME (so no retroarch) and either of the direct x (9 or 10/11/12) API’s function with reshade. When I use Open GL or Vulkan I cannot open reshade and no folders are automatically created within my MAME folder where the mame exe is. But either of the Direct X’s do work. Maybe this is relevant info, maybe not.

I downloaded the Sony Megatron Github files (9 files in total), with one of them being the SonyMegatron.fx shader and I extracted all files to:

LaunchBox\Emulators\mame 0.249_HOR\reshade-shaders\Shaders\SonyMegatron-ReShade-main

with ‘SonyMegatron-ReShade-main’ being the main folder where those files are in.

In reshade I open the settings tab and add the directory for this folder under the effects section as I assume otherwise reshade has no idea it has to look there for the Sony Megatron shader.

The 7 ini files I place in the root directory of where the mame exe is located which is the ‘mame 0.249_HOR’ folder also mentioned above. But those 7 ini files also kept in the folder under reshade-shaders\Shaders\SonyMegatron-ReShade-main. Maybe this is relevant info, maybe not.

Now, the error message I get is [SonyMegatron.fx] failed to compile and the full message is visible in the screenshot.

basically: error X3535, bitwise operations not supported on target ps_3_0.

And I know that that line is telling me to search row 1557, as the error is there, but I’m not knowledgeable enough to figure it out.

Sorry for the somewhat longish post, but I’d like to be thorough.

Can anyone please clarify what might be going on? Thanks

1 Like

I believe that error indicates that it’s trying to use directx 9 but requires functions that are not available in dx9’s “shader model” version. Try using dx10+ instead and, if it still fails, see if it’s a different error and, if so, post it here and we can take a look.

2 Likes

Be aware that somebody already did a port to ReShade. I haven’t tested it a lot, but it functions (sort of). There should be some talk about in this thread.

1 Like

Hi there, I did the entire process all over again, but instead selected direct x 10/11/12 as the API in the initial reshade setup process. The error persists though.

Is there a way to copy and paste the entire error message from within reshade? In any case, attached the error message, very similar to the one I posted earlier today. Only the characters after the word ‘shader’ seem different, but starting from (1557,14-28) it’s 100% the same.

if I can do more to help clarify the issue by all means let me know.

I have to emphasize once more that I don’t use retroarch in this particular case, but rather standalone mame.

Thanks

1 Like

Hi Jamirus. I am using reshade and I assume the correct files from the github repository, namely this one:

so all seems well in this regard…I think. Thanks for offering your input though.

1 Like

Oh sorry, yeah I thought wanted to port it, I forgot that in case of problems Reshade gives out the message about failed compilation.

1 Like

Somebody could explain me with simple words why HDR is necessary for this shader to work?

Great job!

2 Likes

Because it doesn’t use any “solutions/tricks” to gain extra brightness that require additional subpixels to be lit besides the subpixels simulating the phosphors and those emulated phosphors are supposed to be aligned with the subpixels of the display. So it’s a sort of a pure solution that relies only on the brute force brightness of the display to generate all brightness and glow.

Normally when implementing a shader solution with full strength mask and scanlines the image tends to be dark. Glow and other effects can brighten things up a bit but introduce additional subpixels to be lit except for the ones simulating the phosphors.

HDR isn’t a requirement since there is also an SDR version for bright SDR displays.

3 Likes

Yeah i understood that, what i know about HDR (little) is that it provides more bits per channel, so i wondered if and why it was a requirement, since the maximim brightness isn’t strictly bound to HDR, right?

2 Likes

I think some if not most displays only reach their peak brightness in HDR mode. Before HDR came into the fore as a standard, peak white point was somewhat limited and HDR extends the limits thus allowing brighter highlights.

https://www.rtings.com/tv/learn/hdr-vs-sdr#:~:text=HDR%20is%20a%20video%20signal,deliver%20an%20excellent%20HDR%20experience.

2 Likes

So there is an SDR mode on this shader, which works outside of HDR, and if you can crank the brightness up high enough the image will be bright enough.

If you are using HDR then it is trying to pump the brightest pixels up while leaving darker pixels darker. It seems like the HDR mode may be able to be brighter for the brightest pixels vs increasing the panel brightness.

But @MajorPainTheCactus could give a better description.

3 Likes

I think we are missing the main reason.

Try running the HDR preset without HDR enabled. It is not just a brightness situation, there is some HDR specific code that effects the colors etc. You will know more than I. (As a shader author.)

2 Likes

Apologies for the delayed reply. Ok so that error is as @hunterk said and its to do with using DirectX9 but as you said youre using DirectX10/11/12 what is happening is that Mame looks like its not pumping up the pixel shader support in those versions - loosely max pixel shader version support is this d3d9=ps3 d3d10=ps4 d3d11=ps5 d3d12=ps6. But the application is free to use whatever pixel shader support it want below that maximum.

I think the bitwise operators were only supported in ps4. Essentially it looks like MAME although using DirectX10/11/12 compiles shaders with only ps3 support.

BUT this is a bit strange/doesnt make sense as this shader isnt part of MAME and is compiled by reshade and reshade should choose the highest pixel shader support. Are you definitely, definitely sure MAME is using directx 10/11/12?

2 Likes

Hi @kokoko3k as everybody has mentioned its just that peak brightness on most (all?) TV’s is only reached in hdr mode (see RTings.com) and thus to get the full benefit of that peak brightness you need to set the tv into hdr mode but as you point out you then need to convert the narrower colour gamut of old games consoles/tvs into the wider colour gamut of HDR or more correctly Rec. 2020/BT.2020.

There are TVs out there now that can reach very high brightness in SDR (though still not quite as high as their HDR brightness) see laptop screens. Mobile phone screens are very very bright SDR screens - 1600+nits and Id actually recommend this shader in its SDR mode on those screens. It runs a treat on my OnePlus Pro8 in sdr mode.

3 Likes

Just to add Rec. 2020 is just a wider colour gamut but Rec.2100 introduced a different gamma curve which uses a PQ transfer function. This is what most (all?) HDR TVs implement to get higher peak brightness. We have to inverse tonemap the old console output to use that higher brightness and different gamma curve as well.

3 Likes

Thanks for joining the pieces!
I finally understood the full issue, which is just a complication to circumvent another complication apparently caused by Tv manufacturer then…

1 Like

Hi there, no worries, thanks for getting back to me. I confirm two things:

  1. Initial set up of reshade I definitely chose the direct x 10/11/12 API

  2. I have Direct x 12 installed on my PC (checked with dxdiag)

You ask the following: “Are you definitely, definitely sure MAME is using directx 10/11/12?”

I’m not sure. What I do know is that when I select that API (or the direct x 9 API), I get reshade to work with Mame. When I select either open gl or Vulkan API, reshade does not seem to function.

I’m not sure what Mame standalone is supposed to use. Is there a way to verify that somewhere? I guess not open GL or Vulkan since reshade does not work when I choose either of those 2.

1 Like

Yes essentially this shader shifts the problem of replicating the CRT look from the shader to the display i.e it takes advantage of features/specifications of modern displays and so the shaders main job is to convert the specs of old displays into the specs of modern displays.

2 Likes

Ah ok so MAME itself sounds like its not using Directx 10+ - to run this shader the application itself needs to support Directx10+ not Reshade.

1 Like