Shader tune shader

I think it could be useful to provide a generic shader to be appended to any chain which helps you to compare the naked/original output with the processed one, so I made one.

The workflow is that you set a desidered target gain and gamma which will be applied to the Original/Naked picture (eg, if you would be satisfied to get an 80% brightness after applying mask or scanlines gaps, you set the Target Gain parameter to 0.8; similar goes for Target Gamma, when on CRT I assume you want it to stay to 2.4 or similar), then you select a comparison effect and play with its parameter.

Also, feeding Retroarch with test images like colored or B/W ramps is a good idea.

Several comparison effects are implemented:

By using this helper shader, it is quite easy to create presets that have full brightness; I find the checkerboard and the frame alternation to be very useful:

If you squint your eyes, the mask disappears and you can see a uniform image; (that suggests me that i could implement a way to blur both images for an easier comparison).

Download here.

Suggestions?

6 Likes

What is the rationale for trying to match the raw pixels? Shouldn’t the raw pixels be corrected by a CRT? As I understand it, the gamma of the raw image is wrong.

1 Like

The main use is to be able to tune masks and scanline dynamic/strength so that they would not alter the intended shades.

So you target an output gamma (again, about 2.4 for CRT); and optionally a tradeoff by lowering the target gain.

1 Like

Ok, I get it now. It seems like it could be very useful!

1 Like

The gamma isn’t necessarily wrong. If you are on a 2.2 display gamma in a dim room, then it’s wrong, but if you e.g. calibrate your display to 2.4 gamma in a dim room, or calibrate to 2.2 in a medium bright room, it should be correct.

2 Likes

http://web.mit.edu/jmorzins/www/gamma/rwb/gamma.html

Since most sensors used in television cameras produce output voltages proportional to scene intensity, a correction for CRT gamma must be applied to the camera signal to avoid having midtones in the scenes being too dark on the TV set. When television standards were defined it was decided to correct for the gamma of the CRT in every television set by using a correction circuit in the camera which applies a gamma of 0.45 = 1/2.2. This value was chosen to simultaneously correct for the CRT gamma of 2.5 and compensate for the apparent reduction of contrast which occurs when a TV is viewed against the dim background typically found in a living room. Applying the correction at the studio was more economical than applying the correction in every TV set.

3 Likes