contrast in enbeffects.fx PP3

share shaders here
Post Reply
  • Author
  • Message
Offline
*sensei*
Posts: 397
Joined: 16 Mar 2013, 16:28

contrast in enbeffects.fx PP3

I want to insert a little piece of code that allows me to simply regulate contrast in the enbeffects.fx file.

i copied a part of the PP1 contrast & saturation routine, but that has a nasty posterizing sideeffect cause it
luminates greytones so that black parts of the image get grey, i don't want that.

so i'm pretty sure the piece of code is not really the right way to regulate contrast.

i know how to insert code and make defines, but i don't know much about color processing yet.
can someone tell me what code regulates simple contrast ?

what i inserted was this;

Code: Select all

	#ifdef PP3EXTRA
		float cgray=dot(color.xyz, float3(0.27, 0.67, 0.06));
		cgray=pow(cgray, EContrastV3);
		float3 poweredcolor=pow(color.xyz, EColorSaturationV3);
		float newgray=dot(poweredcolor.xyz, float3(0.27, 0.67, 0.06));
		color.xyz=poweredcolor.xyz*cgray/(newgray+0.0001);
	#endif
i simply copied it from PP1 and made a few new variables to regulate contrast and saturation and made a define in the PP3 subsection so i can enable/disable it.

any help would be greatly appreciated.
_________________
Intel I9-9900k, RTX 3070, 1TB Samsung EVO 970, 1TB Crucial SSD, 1TB Kingston SSD , Realtek HD Audio, 16GB 3400MHZ System RAM, W10 Pro x64.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17436
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: contrast in enbeffects.fx PP3

This is not contrast, but method to make tonemapping output without loosing too much contrast. The issue #1 is that contrast is low dynamic range "effect", so default contrast math must be applied after tonemapping, when colors are in range from 0..1 (code of contrast from photoshop is in my latest enbeffect.fx for skyrim). For HDR data base value not exist, probably contrast looks more like higher power function (reverse gamma), as colors more saturated and intensity both, but pow function greatly change values above 1. May be better to use adaptation texture as middle gray (and correct it a little by some var) and then apply contrast math? Another idea is to remap hdr 0..1..65535 range to -1..0..1 range, then apply contrast and restore back, but it's just for math, result may not look good.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
*sensei*
Posts: 397
Joined: 16 Mar 2013, 16:28

Re: contrast in enbeffects.fx PP3

ok so tonemapping makes HDR into LDR effect, from 0 to 1 ?
so can i take that piece of code from the Skyrim file and insert it in my effects file, would that work ?

So contrast in HDR is always a combination of different techniques that aproaches the look of contrast, i didn't know there was no HDR function for that
seemed kinda obvious to me that that would be something like that..

i will read up on it a bit so i understand it a little better, i understand what you say but i'm certainly not able yet
to write that routine myself, but i will study it a bit more, certainly not the use of the adaptation texture.

i will go and read some more now..

thanks for your answer.
_________________
Intel I9-9900k, RTX 3070, 1TB Samsung EVO 970, 1TB Crucial SSD, 1TB Kingston SSD , Realtek HD Audio, 16GB 3400MHZ System RAM, W10 Pro x64.

Offline
*sensei*
Posts: 397
Joined: 16 Mar 2013, 16:28

Re: contrast in enbeffects.fx PP3

ok, so i made a stupid error at first by forgetting the ; behind the declared variables, but now i have got it working !
i copied your code from the Skyrim effects file and the code works nicely !
since these LDR code pieces are very understandable it immediately cleared it up a bit for me, Thanks Boris !

by the way, does the Fallout Binary also have the possibility to have the values show up in the GUI ?
i mean, can i make the same stuff in the GUI so i can adjust the var values in-game ?
_________________
Intel I9-9900k, RTX 3070, 1TB Samsung EVO 970, 1TB Crucial SSD, 1TB Kingston SSD , Realtek HD Audio, 16GB 3400MHZ System RAM, W10 Pro x64.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17436
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: contrast in enbeffects.fx PP3

ok so tonemapping makes HDR into LDR effect, from 0 to 1 ?
Yes
so can i take that piece of code from the Skyrim file and insert it in my effects file, would that work ?
Depends from what exactly you want.

Fallout don't have annotations support, so parameters are not editable in gui. It's a lot of code changes, which i don't want to make without important reason and you know my opinion about modding Fallout.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7

Offline
*sensei*
Posts: 397
Joined: 16 Mar 2013, 16:28

Re: contrast in enbeffects.fx PP3

brightness and contrast code seem to work reasonably well in Fallout.
good enough for what i need, i just needed slight changes, not drastic, and it does the job pretty well.

haha, yes i know,
well i don't mind about that, i just thought it would be handy if it was possible.
i'm not going to change my brightness and contrast constantly in the GUI so it's ok.
i was just curious.

thanks again, messing with this code has learned me a bit how it works,
next i'm going to do some beginners lessons in the directx sdk i downloaded.
there are some pretty neat examples/lessons in the sdk i must say, from beginner to advanced.
_________________
Intel I9-9900k, RTX 3070, 1TB Samsung EVO 970, 1TB Crucial SSD, 1TB Kingston SSD , Realtek HD Audio, 16GB 3400MHZ System RAM, W10 Pro x64.
Post Reply