The online racing simulator
#1 - Nilex
Post-process shader (0.6K+): retain original image brightness and colors
>EDIT: Ok I wrongly thought this modification will give you the option to have the original image while benefiting from the rest of what PPS has to offer. Turns out there are no other benefits other than altering the image. This mod effect, then, can be simply achieved be achieved by turning on 4x AA in LFS options Tilt. So you can ignore the rest of my post.
Gutholz explained it well in post #7 and offered examples in his link for practical usage of the PPS file. EDIT<

Some of you may have noticed this new feature (lets shorten it to PPS) under Options - Misc, that came with K version, which basically changes brightness and color values among other things. I was not a fan of that. So after some online bitching from yours truly, our good guy King found a simple solution to have PPS enabled, with the benefits it brings, while retaining original image brightness and colors:

https://www.lfs.net/attachment/137301
1. save to LFS\data\shaders
2. rename original "PostProcess.psh" to "PostProcess - orig.psh" (for backup)
3. rename "PostProcess.txt" to "PostProcess.psh" (had to use .txt extension because .psh isn't allowed to be uploaded)
4. restart LFS for changes to take effect
You can view .psh content with plain notepad. Very few changes are made from the original.

Examples:
PPS off - original

PPS on - original

PPS on - new


Few important notes:
1. PPS will NOT work if you already have 3rd party .dll file in LFS folder. You will receive endless stream of "Could not create the render target texture" error messages instead. Remove any .dll if you want to have working PPS. At least until another King appears Smile
2. You will lose ability to set AA levels with PPS on. Instead it is forced to 4x AA.
Source: https://www.lfs.net/forum/post/1900982#post1900982
3. You can play around with 1.0f value in this line, to achieve different brightness:
return (tex_col - float4(0.5f, 0.5f, 0.5f, 0.0f)) * 1.0f + float4(0.5f, 0.5f, 0.5f, 0.0f)
maybe other values, I haven't tried.
4. Can go back to original at any time by renaming "PostProcess - orig.psh" (the backup) to "PostProcess.psh" and restarting LFS.
* 1. and 2. is general PPS behavior, this modification has nothing to do with that.
Attached images
PPS off - orig.jpg
PPS on - orig.jpg
PPS on - new.jpg
Attached files
PostProcess.txt - 740 B - 629 views
Uhm, am I missing something, or what's the point of the new shader, when it doesn't actually change anything? Shrug
#3 - lfsrm
Yea I can't spot any difference...
#4 - Nilex
I'm not sure what PPS does. Does it change anything else besides brightness, colors and AA?
If not, then it will keep doing whatever else it does but it will look better Smile Vanilla shader is ugly.
The point of having a PPS is to enable people to alter the look of the picture in game, on pixel level. The "default" PPS comes with more contrast, but you can do a lot more advanced things in the shader.

So if you just keep this in the PPS file main function:

float4 tex_col = tex2D(Tex0, In.Texture);

return tex_col;

it will look exactly the same as with PPS turned off, except the forced AA.
#6 - Nilex
Hm, I was under the impression it does more. Maybe some things people want to have, but keeping the original image more or less intact.
Some have reported performance increase when using it for example, but now that I think about it that may have been that their 8x AA got reduced to 4x.
And I was thinking I am giving people more choice Tilt. So lets conclude: what this modification has done is - only added a 4x AA?
Quote from Nilex :So lets conclude: what this modification has done is - only added a 4x AA?

Yes, that shader does not alter the image in anyway.
Your linked post suggest that in LFS the options to enable post-processing and AA are coupled.
But that shader itself does nothing.

What the posted file does:
Original file PostProcess.psh of LFS comes with a few examples, but by they are disabled.
That file now enables the "contrast" example and the contrast-factor was edited from 1.2 to 1.0
Which means nothing gets changed.

return (tex_col - float4(0.5f, 0.5f, 0.5f, 0.0f)) * 1.0f + float4(0.5f, 0.5f, 0.5f, 0.0f);
is a more complicated way to write:
return tex_col;

( Similiar to how x + 5 - 5 is the same as just x )


/edit
I wrote a bit about shaders in the "Custom Shaders" thread:
https://www.lfs.net/forum/post/1903540#post1903540
Maybe it is also insightful for other players?
That thread in general has some nice examples what shaders can do beside just tweaking contrast, colors or such.
By the way, if you are editing a shader and want to see how it looks inside LFS, you don't need to restart. Just type /rsh
#9 - Nilex
Thanks for clarification, added an edit to 1st post.
I tried to change for the beginning just the brightness. Changed following line

return (tex_col - float4(0.5f, 0.5f, 0.5f, 0.0f)) * 1.2f + float4(0.5f, 0.5f, 0.5f, 0.0f);

to

return (tex_col - float4(0.5f, 0.5f, 0.5f, 0.0f)) * 5.2f + float4(0.5f, 0.5f, 0.5f, 0.0f);

I changed some other figures located below "GAMMA" and so on but it changed nothing :-(

What did I do wrong?
For a start, make sure you have enabled the post processing shader in Misc options.

The different examples in the psh file are mostly commented out, and you can see this because their line starts with a double slash.

// This line is a comment and is ignored by the compiler
// Comments are also used to make code inactive

So, if you wanted to try the gamma example, you should add // to comment out the currently active section of code, remove the // on the gamma line of code, save the file then type /rsh in LFS. Watch out for any error messages or warnings that will appear as messages at the top left of the screen.
Thank you for your help.

I just tweaked the following line in the file "PostProcess.psh" :

original: return -2.0f * x_cu + 3.0f * x_sq;
MOD : return -2.0f * x_cu + 3.3f * x_sq;

-> makes the Gamma much brighter


Second thing I changed was in the file "Car2.psh"

I wanted to make the car look more reflecting, so I changed this lines:

original: const float facing_reflectivity = 0.08f; // reflectivity of glass (parallel to normal)
MOD : const float facing_reflectivity = 0.32f; // reflectivity of glass (parallel to normal)

original: const float facing_reflectivity = 0.04f; // reflectivity of paint (parallel to normal)
MOD : const float facing_reflectivity = 0.35f; // reflectivity of paint (parallel to normal)

-> increase reflection of the car and gives a much better look. The reflection also increases for blank areas in the interior.

Of course this tweaks are nothing special and very easy, but it gives me what I was searching for and the result is stunning! Sorry that I am not able to upload some pics. Hopefully this is a usefull help for somebody :-)


EDIT:

I changed also following line in the file "Car2.psh"

original: ret.a = lerp(texture_col.a, 1.0f, reflectivity_mul); // destination pixel is multiplied by (1 - ret.a)

MOD: ret.a = lerp(texture_col.a, 0.25f, reflectivity_mul); // destination pixel is multiplied by (1 - ret.a)

-> effects that glasses are less blue and more transparent
This is my first shaders ,thank you for explain how modify it.
i follow Gutholz way, making 1 with less saturation and other with "image color" ( a bit "sepia" style ).guys post here way to writing in other files or add new ways like Gutholz done.
sorry about pixel , my video card is weak. if is possible making print screen with my shaders for i see how it looks in good computer.
thank you Smile
Attached images
01 PREVIEW 01.jpg
01 PREVIEW 02.jpg
02 PREVIEW 01.jpg
02 PREVIEW 02.jpg
Attached files
01PostProcess_Abone.rar - 3.1 MB - 324 views
02PostProcess_Abone.rar - 3.1 MB - 314 views
Quote from Nilex :

https://www.lfs.net/attachment/137301
1. save to LFS\data\shaders
2. rename original "PostProcess.psh" to "PostProcess - orig.psh" (for backup)
3. rename "PostProcess.txt" to "PostProcess.psh" (had to use .txt extension because .psh isn't allowed to be uploaded)
4. restart LFS for changes to take effect
You can view .psh content with plain notepad. Very few changes are made from the original.


I like it, shadows are less dark
Abone, very nice work. I further experimented and came up with this. Basically I changed two files PostProcess and Car2.psh and increased the reflection of the car to make it more realistic. I'm very happy with the results now. Have a look! Smile
*Clearer windows
*More saturation
*Realistic reflections
Attached images
Screen Shot 2017-08-11 at 9.46.32 PM.png
Screen Shot 2017-08-11 at 9.54.18 PM.png
Screen Shot 2017-08-11 at 9.55.22 PM.png
Attached files
Shaders.zip - 5.1 KB - 421 views

Post-process shader (0.6K+): retain original image brightness and colors
(15 posts, started )
FGED GREDG RDFGDR GSFDG