Page 1 of 1
[DX11] ColorLab Color Correction Suite
Posted: 25 Feb 2019, 00:31
by SandvichDISH
This is a enbeffectpostpass.fx color correction megashader I made, mostly for personal amusement, but I think it's pretty powerful. It's similar to Marty McFly's lightroom shader. It makes use of the CIE-LAB colorspace (which inspired the name) for saturation and preserving luma for the split tone and hue shift effects,
for a more natural result. It provides full TOD parameter customization through Reforged UI that you can customize by editing the defines near the top of the enbeffectpostpass.fx file.
The fancy graphs in the image above are all available in realtime, and show some useful feedback regarding the various effects.
The shader can be applied directly to the image, or indirectly through a LUT to save performance (and you could take a screenshot to export the LUT).
The effects available are as follows:
- Split range color filter and saturation.
- Per-hue saturation and shift controls.
- Global saturation, color temperature in kelvin, and hue shift.
- Black level, white level, contrast, gamma.
- Per-channel Lift/Gamma/Gain.
- Output dither.
Click here to see the full list of ingame parameters available.
For the dither, normally you want to keep the bit depth at 8. Other options are mostly for demonstration. The "Legacy Dither" option provides a dither that doesn't rely on Timer.z, which is as of writing only available in the latest versions of ENB for Skyrim: SE and Fallout 4.
There are 4 available techniques:
ColorLab
ColorLab w/ Graphs
ColorLab as LUT
ColorLab as LUT w/ Graphs
Fairly self explanatory, ColorLab simply applies the post processing to the whole fullscreen image, while ColorLab as LUT applies to to either a 256x16 LUT or a 1024x32 LUT, which is then applied to the fullscreen image afterwards. Selecting the techniques with graphs will show the graphs seen in the above screenshot, which provide information for most of the effects. The ColorLab as LUT w/ Graphs will also show the generated LUT in the bottom right to be inspected or taken a screenshot of.
Re: [DX11] ColorLab Color Correction Suite
Posted: 03 Mar 2019, 06:09
by cOJzZ
http://www.brucelindbloom.com/index.htm ... atrix.html
sRGB D65 to XYZ matrix, in:linear rgb nominal range [0,1], out: z may exceed 1
0.4124564 0.3575761 0.1804375// sum = 0.95047 (x100 = 95.047)
0.2126729 0.7151522 0.0721750// sum = 1.0000001
0.0193339 0.1191920 0.9503041// sum = 1.08883 (x100 = 108.883)
https://docs.opencv.org/master/de/d25/i ... sions.html
opencv RGB(sRGB D65) to XYZ matrix
0.412453 0.357580 0.180423//sum = 0.950456
0.212671 0.715160 0.072169//sum = 1
0.019334 0.119193 0.950227//sum = 1.088754
before XYZ to Lab
X←X/Xn,whereXn=0.950456
Z←Z/Zn,whereZn=1.088754
XYZ to Lab
Xr^(1/3) when Xr>ϵ
Lab to XYZ
Fx^3 when Fx^3>ϵ
Re: [DX11] ColorLab Color Correction Suite
Posted: 03 Mar 2019, 09:22
by SandvichDISH
@cOJzZ are you suggesting I should use OpenCV's values for my conversions?
Re: [DX11] ColorLab Color Correction Suite
Posted: 03 Mar 2019, 11:41
by cOJzZ
Before XYZ to Lab
xyz / reference white
Opencv use (0.950456, 1, 1.088754)
sorry for my broken engrisu
And in Colorlab/colorspace.fxh, used D65 = float3(94.811, 100.000, 107.304), if I'm not misunderstand something, it's x100 of the value should be used.
another not used constant D65_2 = float3(95.047, 100.000, 108.883)
looks like the reference white point is been coded in the rgb to xyz matrix, opencv use a tweaked one, let the sum of the second row(Y's value when rgb=(1,1,1) to be exactly 1.0)
so i think should use a reference white D65_2/100 corresponding to the rgb to xyz matrix.
when xyz2cielab
xyz > 0.008856 ? xyz = pow(xyz, 1.0/3.0) : xyz * 7.787 + (16.0/116.0);
we get xyz^(1/3) when xyz > epsilon
and when cielab2xyz
xyz = xyz > 0.008856 ? xyz = xyz * xyz * xyz : (xyz - 16.0 / 116.0) / 7.787;
it should be xyz*xyz*xyz > epsilon ?
Thank you for all the code post, I use some in my enb preset, and they're great. The per hue saturation control is wonderful.
Re: [DX11] ColorLab Color Correction Suite
Posted: 03 Mar 2019, 12:16
by SandvichDISH
You're totally right, I copied over the values without thinking about why they were normalized to a 0-100 range. You're also right to see mistakes in the CIELAB conversion functions, I carelessly uploaded the files with those mistakes in.
If you redownload the files now, these problems should be fixed.