Extended Levels (W\B point ) + Histogram port

  • JBeckman
3 years 11 months ago - 3 years 11 months ago #21 by JBeckman Replied by JBeckman on topic Extended Levels (W\B point ) + Histogram port

xristosv wrote: Can anybody help me? How can i use this? Im new to reshade stuff :(

The initial shader would be this:

Which you can use to tweak some titles using limited 16-235 to full 0-255 range.
Such as Sekiro for example. steamcommunity.com/app/814380/discussion...1850323802573052780/
(EDIT: Well it can do more than just full/limited but it's one example by adjusting black and white levels via two sliders from 0 to 255 that this shader offers.)

The new one and with a new name would be this:

This has far more control and options though I have only started using it myself and the first post should be fairly thorough on just how you can use this which together with the updated Histogram.fx shader you can take a sample image and run it through that to compare and fine tune the settings but it's a very complex task with games having tone-mapping and coloration and various shaders and effects though if you know the sky should be white clouds and blue well sky then you can use that as a source for correcting brightness and the color range, I'd start with the earlier levels.fx and see how that affects black and white levels perhaps using limited and full range as a basis and how that affects how games or applications look before starting to dig into Levels Plus and a whole host of separate options including what appears to be Rec.2020 color specs over Rec.709 and well if that and things like RGB and SRGB doesn't say much that's just another indication of how complex this balancing act can be.

And why the histogram shader can be helpful for comparing and finding what to adjust though I have not used the shader much myself and this is something I just started dabbling in a week back in a few games trying to fix really blown out gamma though this display is also kinda mid-tier and fairly simply calibrated so it can never be perfect either but some small improvements are doable without going into some really complicated operations and calibrations.

It's overwhelming to me too, again start simple and then maybe work your way from there. :)

EDIT: You have too many links. I see so there's a max limit on these forums then but oh well so no Wikipedia URL entries but you can use that for the RGB, SRGB, SCRGB, Rec.709 and Rec.2020 and ACES information or basics for what these are is how I mean with that. :)



EDIT: Got a few of them in.

EDIT: There should also be ready made presets using levels.fx though levelsplus as a newer entry might be less common particularly for older presets uploaded.
(EDIT: But I see the Sekiro example above actually switched over to that with a explanation as to why.)

And I'm pretty much a amateur too so still have a ton more to learn and how to use this for full effect instead of just slight tweaks.

EDIT: Updated a bit, polished the reply somewhat and made it easier to read and more detailed in how I meant and explanation for well the few bits that I do know somewhat about, first post is a good start for when you go into the Levels Plus effect and how it can be used to correct a number of issues in media including games.
(I had no idea it was that prevalent, quite interesting and a good fact to be aware of.)
Last edit: 3 years 11 months ago by JBeckman.
The following user(s) said Thank You: xristosv

Please Log in or Create an account to join the conversation.

  • orator89
3 years 11 months ago - 3 years 11 months ago #22 by orator89 Replied by orator89 on topic Extended Levels (W\B point ) + Histogram port

v00d00m4n wrote: Extended Levels (W\B point ) + Histogram port

Forgot to share port of more recent version for Media Player Classic, which would be helpful for fixing ugly color grading in movies.

 * Levels version 1.6.6 MPC Edition lite
 * Original version by Christian Cann Schuldt Jensen ~ CeeJay.dk
 * Updated to 1.3+ by Kirill Yarovoy ~ v00d00m4n
 * Allows you to set a new black and a white level.
 * This increases contrast, but clips any colors outside the new range to either black or white
 * and so some details in the shadows or highlights can be lost.
 * The shader is very useful for expanding the 16-235 TV range to 0-255 PC range.
 * You might need it if you're playing a game meant to display on a TV with an emulator that does not do this.
 * But it's also a quick and easy way to uniformly increase the contrast of an image.
 * -- Version 1.0 --
 * First release
 * -- Version 1.1 --
 * Optimized to only use 1 instruction (down from 2 - a 100% performance increase :) )
 * -- Version 1.2 --
 * Added the ability to highlight clipping regions of the image with #define HighlightClipping 1
 * -- Version 1.3 --
 * Added inddependant RGB channel levels that allow to fix impropely balanced console specific color space.
 * Most of modern Xbox One \ PS4 ports has white point around 233 222 211 instead of TV 235 235 235
 * which can be seen and aproximated by analyzing histograms of hundreds of hudless screenshots of modern games
 * including big titles such as GTAV, Witcher 3, Watch_Dogs, most of UE4 based titles and so on.
 * Most of these games lacking true balanced white and black colors and looks like if you play on very old and dusty display.
 * This problem could be related to improper usage and settings of popular FILMIC shader, introduced in Uncharted 2.
 * I used to prebake static luts to restore color balance, but doing so in image editors was slow, so once i discovered
 * that Reshade 3 has RGB UI settings i decided that dynamic in-game correction would be more productive, so i updated this
 * old shader to correct color mess in game. I can spot white oddities wiht my naked eyes, but i suggest to combine this shader
 * with Ganossa Histogram shader, loaded after levels for this, but you need to update it for Rehade 3 and get it here:
 * https://github.com/crosire/reshade-shaders/blob/382b28f33034809e52513332ca36398e72563e10/ReShade/Shaders/Ganossa/Histogram.fx
 * -- Version 1.4 --
 * Added ability to upshift color range before expanding it. Needed to fix stupid Ubisoft mistake in Watch Dogs 2 where they
 * somehow downshifted color range.
 * -- Version 1.5 --
 * Changed formulas to allow gamma and output range controls.
 * -- Version 1.6 --
 * Added ACES curve, to avoid clipping.
 * -- Version 1.6.5 --
 * Ported for MPC, cleaned out broken and debug stuff.
 * -- Version 1.6.6 --
 * Made ACES useful and configurable.

// Settings

// #define InputBlackPoint float3(16/255.0f, 18/255.0f, 20/255.0f) //the thing 2011

//#define InputWhitePoint float3(233/255.0f, 222/255.0f, 211/255.0f) // generic value for modern games like GTAV and Witcher 3
//#define InputWhitePoint float3(233/255.0f, 222/255.0f, 222/255.0f) // the thing 2011
//#define InputWhitePoint float3(184/255.0f, 182/255.0f, 164/255.0f) // blade runner 2049

#define InputBlackPoint float3(16/255.0f, 16/255.0f, 16/255.0f)

#define InputWhitePoint float3(235/255.0f, 235/255.0f, 235/255.0f)

#define InputGamma float3(1.0f,1.0f,1.0f)

#define OutputBlackPoint float3(0/255.0f, 0/255.0f, 0/255.0f)

#define OutputWhitePoint float3(255/255.0f, 255/255.0f, 255/255.0f)

#define ColorRangeShift float3(0/255.0f, 0/255.0f, 0/255.0f)

#define ColorRangeShiftSwitch 0

#define ACESLuminancePercentage 98

#define ACEScurve 1

#define LevelsEnabled 1

sampler BackBuffer : register(s0);

// Helper function
float3 ACESFilmRec2020( float3 x )
    float a = 15.8f;
    float b = 2.12f;
    float c = 1.2f;
    float d = 5.92f;
    float e = 1.9f;
    x = x * ACESLuminancePercentage * 0.005; // Restores luminance
    return ( x * ( a * x + b ) ) / ( x * ( c * x + d ) + e );

// Main function

float4 main(float2 texcoord : TEXCOORD0) : COLOR
  float3 InputColor = tex2D(BackBuffer, texcoord).rgb;
  float3 OutputColor;
  if (LevelsEnabled == true)
     OutputColor = pow(((InputColor + (ColorRangeShift * ColorRangeShiftSwitch)) - InputBlackPoint)/(InputWhitePoint - InputBlackPoint) , InputGamma) * (OutputWhitePoint - OutputBlackPoint) + OutputBlackPoint;
  } else {
	  OutputColor = InputColor;
  if (ACEScurve == true)
   OutputColor = ACESFilmRec2020(OutputColor);
	return float4(OutputColor, 1.0);

ACES here works like some sort of HDR color look simulator and sorta like TV > PC color range expander.

Here few shots of how that works in MPC in movies:

Hi, I tried to apply this shader in MPC-HC, but I don't get the result that I see in your photos, when I apply to movies... If I apply the shader (i saved your shader as "Levels.hlsl", copied in "SHaders" folder for MPC-HC, and then selected from "shaders" menu in MPC-HC 1.8.6 64bit, it's right no?) but I get a result with less less brightness, less highlights, and more contrast then original.. Instead in your example I can see that highlights change, and color hue also.... How is it possible? Thanks...
Last edit: 3 years 11 months ago by orator89.

Please Log in or Create an account to join the conversation.

  • AcidRains
3 years 10 months ago #23 by AcidRains Replied by AcidRains on topic Extended Levels (W\B point ) + Histogram port
Any chance i can have this on older reshade version, like 1.1.0?
if not then can anyone teach me how to port this to reshade 1.1.0? really need this,thx

Please Log in or Create an account to join the conversation.

  • dawidezzo
3 years 5 months ago - 2 years 6 months ago #24 by dawidezzo Replied by dawidezzo on topic Extended Levels (W\B point ) + Histogram port
Hello v00d00m4n

Do you have any idea how to make a color profile similar to bt709 using Reshade? BT709 is located in games like Resident Evil 7 and RE2, Devil May Cry 5 and CoD Black Ops 3. In my opinion lack this option in many games is the main problem that causes (not only levels mismatch) milky and washed out picture in many games ported from consoles to PC. Bt709 is darker and uses gamma 2.35-2.4 and PC as we know is adapted to gamma 2.2. What do you think about it?

Cheers :)
Last edit: 2 years 6 months ago by dawidezzo.

Please Log in or Create an account to join the conversation.

  • Dimetry
3 years 1 month ago #25 by Dimetry Replied by Dimetry on topic Extended Levels (W\B point ) + Histogram port

Thank you for your work and explanations, but I still not sure about Full/Limited color range games...
For example, we have Dark Souls III with washed out colors. How to definitely know if the game was designed for 16-235 space either or for 0-255 space? In first case isn't colors below 16 or above 235 should look gray? Or there is a chance that game could display those shades, but anyway should be converted into full range format to fit design?

Please Log in or Create an account to join the conversation.

We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.