Possible to saturate/desaturate (similar to AD 1257 mod) using global lighting?

Users who are viewing this thread

wrwlf

Sergeant
Quick question, (I am guessing this is skybox related), but is there some sort of global lighting/saturation/color modifier which can be applied (outside of ENBs)? I am mostly curious how certain mods, for example AD 1257, achieve that visual effect. AD 1257 has a weary dreary/desaturated look to it. Is this from the textures/assets used or is there some way to achieve a similar or even opposite (more saturation) effect?

Thanks.
 

La Grandmaster

Sergeant Knight at Arms
You can do it in the postfx file, which can be downloaded with taleworlds shader files. Basically you would want to download that file, drag and drop it into your mods folder. Then open it with notepad and scroll down to near the bottom and look for a line where the screen image is output itll say
Code:
return "something";
and then above this line and before gamma correction you will want to paste your desaturation code - something like this


Code:
	//greyscale code
        float desat_amount = 0.6;
	float greyscale = dot(color.rgb, float3(0.30, 0.59, 0.11));    
	color.rgb = (lerp(greyscale, color.rgb, desat_amount)); 
       //greyscale code end

The postfx does not need to be compiled so you can just run your game and if you have done it correctly it should work.



On a side note for more info on the postfx file (as this isnt documented anywhere else on these forums) - with M&B we are fairly limited with what we can do in the postfx file as we dont have access to many texture samplers - we dont have access to the depth sampler and a few others which may be useful which means that SSAO and Depth of field are impossible to do with this file. The only samplers we have access to are various screen texture samplers which are used for bloom and a few other things.
 

La Grandmaster

Sergeant Knight at Arms
Yeah its very simple stuff once you get your head round it, you can add tints to the "screen", darken corners, increase or decrease contrast, brighten or darken the picture, blur the edges of the screen and various other stuff, all with pretty much 0 impact on performance. But as I said before, SSAO and other more advanced postfx features are impossible given that we dont have access to certain features.
 

wrwlf

Sergeant
La Grandmaster said:
You can do it in the postfx file, which can be downloaded with taleworlds shader files. Basically you would want to download that file, drag and drop it into your mods folder. Then open it with notepad and scroll down to near the bottom and look for a line where the screen image is output itll say
Code:
return "something";
and then above this line and before gamma correction you will want to paste your desaturation code - something like this


Code:
	//greyscale code
        float desat_amount = 0.6;
	float greyscale = dot(color.rgb, float3(0.30, 0.59, 0.11));    
	color.rgb = (lerp(greyscale, color.rgb, desat_amount)); 
       //greyscale code end

The postfx does not need to be compiled so you can just run your game and if you have done it correctly it should work.



On a side note for more info on the postfx file (as this isnt documented anywhere else on these forums) - with M&B we are fairly limited with what we can do in the postfx file as we dont have access to many texture samplers - we dont have access to the depth sampler and a few others which may be useful which means that SSAO and Depth of field are impossible to do with this file. The only samplers we have access to are various screen texture samplers which are used for bloom and a few other things.

Awesome! Exactly what I was looking for, thanks a lot!
I spent a lot of time trying to get an ENB set up to do what I wanted, but never really got any acceptable results and it always feels very "hacky", this is much cleaner and easier to work with.
 

La Grandmaster

Sergeant Knight at Arms
Yeah I am not a fan of ENBs either. I suppose they are a kind of hack, with ENB's you are basically running an additional postfx system on top of the one warband already has. And as far as I know the ones in use weren't designed to work specifically with warband either so issues may prop up there as well.
 

wrwlf

Sergeant
Quick heads up before anyone else tries this, make sure to change these lines in your postFX.fx file (otherwise you will get a runtime error about instruction limit reached):

#define RELATIVE_PS_TARGET ps_2_0 ->  #define RELATIVE_PS_TARGET PS_2_X
compile ps_2_0 -> compile PS_2_X (multiple lines where this needs to be done)
 

Cozur

Grandmaster Knight
WB
Is it possible to make it time-dependent? Like making nights very saturated - day not so much?
 

La Grandmaster

Sergeant Knight at Arms
Cozur said:
Is it possible to make it time-dependent? Like making nights very saturated - day not so much?
Hmm it may be,

if you look inside module_postfx you will see that there are 3 float4 values which are defined here (you can think of a float4 value as a numerical value which has 4 components, usually "labelled" as x,y,z,w. Each of these components is an independent number, its almost like having 4 global variables in the module system, but they can only be numerical values)

Code:
#define postfxParams1	(PFX1)	float4(postfx_editor_vector[1].x, postfx_editor_vector[1].y, postfx_editor_vector[1].z, postfx_editor_vector[1].w) 
	#define postfxParams2	(PFX2)	float4(postfx_editor_vector[2].x, postfx_editor_vector[2].y, postfx_editor_vector[2].z, postfx_editor_vector[2].w)
	#define postfxParams3	(PFX3)	float4(postfx_editor_vector[3].x, postfx_editor_vector[3].y, postfx_editor_vector[3].z, postfx_editor_vector[3].w)

Now from the comments in module_postfx file we can see where these are used in the postfx file

Code:
#  4) shader parameters1 [ HDRRange, HDRExposureScaler, LuminanceAverageScaler, LuminanceMaxScaler ]
#  5) shader parameters2 [ BrightpassTreshold, BrightpassPostPower, BlurStrenght, BlurAmount ]
#  6) shader parameters3 [ AmbientColorCoef, SunColorCoef, SpecularCoef, -reserved ]

So we can see that
postfx_editor_vector[1].x is used to define the HDR Range
and
postfx_editor_vector[2].w is used to define the BlurAmount
ect

Now we can see that in the comments the very last value in shader parameters3 is reserved. In module_postfx this value is always set to 1.0000
e.g

Code:
("default", 0, 0, [125.9922, 1.0588, 1.4510, 9.1765], [0.9608, 1.1373, 1.1373, 0.1961], [1.0, 1.0, 1.0, 1.0000]),
 ("map_params", 0, 3, [128.0000, 1.04, 1.2941, 10.0000], [2.3725, 2.1569, 1.8431, 0.4863], [1.0, 1.0, 1.05, 1.0]),

Now you could replace the value of 1 with the amount you want each time of day and weather setting to be desaturated (0 being completely destaurated and 1 being fully coloured).

Then in the postfx file, you would define the desaturation value at the top -
search for

Code:
#define BlurAmount 			(postfxParams2.w)

and then below this paste the following

Code:
#define DesaturationAmount			(postfxParams3.w)



and then finally use the code i posted before but this time change the first line so that it uses DesaturationAmount, e.g


Code:
	//greyscale code
        float desat_amount = DesaturationAmount;
	float greyscale = dot(color.rgb, float3(0.30, 0.59, 0.11));    
	color.rgb = (lerp(greyscale, color.rgb, desat_amount)); 
       //greyscale code end
 

wrwlf

Sergeant
So, I've started playing around with desaturation and some other effects (bleach bypass, sepia tint, etc). But apart from these "cookie"-cutter effects I really have no idea what I am doing. I want to generate some sort of desaturated, gritty "lighting"/"mood", do any of you know of a forum/resource where I could ask/find some more info about this?
Just to clarify, I am perfectly comfortable with the Linear Algebra/Vector math, I just have no clue about RGB/color effect algorithms or how to put anything more complex together.
 
La Grandmaster said:
Yeah I am not a fan of ENBs either. I suppose they are a kind of hack, with ENB's you are basically running an additional postfx system on top of the one warband already has. And as far as I know the ones in use weren't designed to work specifically with warband either so issues may prop up there as well.

On top of lag, ENBs make edit mode completely unusable and act weird in windowed mode. Not an issue for most people I guess, but it makes them less viable.

Speaking of edit mode, do the postfx sliders in the scene editor affect this?
 

La Grandmaster

Sergeant Knight at Arms
wrwlf said:
So, I've started playing around with desaturation and some other effects (bleach bypass, sepia tint, etc). But apart from these "cookie"-cutter effects I really have no idea what I am doing. I want to generate some sort of desaturated, gritty "lighting"/"mood", do any of you know of a forum/resource where I could ask/find some more info about this?
To be honest I dont really know what you mean,
To get a more gritty mood you could try increasing the contrast and darkening the image. If you need help obtaining a specific effect I might be able to help you out but "some sort of desaturated, gritty "lighting"/"mood"" is a bit too vague sorry  :wink:

jacobhinds said:
Speaking of edit mode, do the postfx sliders in the scene editor affect this?
I have no idea to be honest, the postfx sliders dont actually do anything do they? (i dont have them due to my monitor resolution options so have never been able to try them out).
 

wrwlf

Sergeant
La Grandmaster said:
wrwlf said:
So, I've started playing around with desaturation and some other effects (bleach bypass, sepia tint, etc). But apart from these "cookie"-cutter effects I really have no idea what I am doing. I want to generate some sort of desaturated, gritty "lighting"/"mood", do any of you know of a forum/resource where I could ask/find some more info about this?
To be honest I dont really know what you mean,
To get a more gritty mood you could try increasing the contrast and darkening the image. If you need help obtaining a specific effect I might be able to help you out but "some sort of desaturated, gritty "lighting"/"mood"" is a bit too vague sorry  :wink:

jacobhinds said:
Speaking of edit mode, do the postfx sliders in the scene editor affect this?
I have no idea to be honest, the postfx sliders dont actually do anything do they? (i dont have them due to my monitor resolution options so have never been able to try them out).

Yeah, I know I am too vague  :grin: That is probably why I cannot find anything elsewhere either.
I will keep experimenting with various effects (sharpening + desaturation seem promising so far).
Do you know if there is way to reload the postfx shaders without restarting the game?
 

La Grandmaster

Sergeant Knight at Arms
@you could try playing in windowed mode and then selecting view and restore module data. Not 100% sure this will work well with postfx, you could give it a try.
 
Top Bottom