Jump to content
Sign in to follow this  
Pilot53

P3D HDR Brightness Mod - Bright Daytime and Dark Night

Recommended Posts

Hey guys, in this post I will be explaining some simple tweaks that I have been testing on my system that will increase the "R" in HDR.  I was not sure if I should post this here or in "Tips and Tricks" but if the Mod's feel this post belongs there instead feel free to move it.  The purpose of these tweaks is to increase the range of the HDR in P3D allowing for the kind of dark nights where you wont be able to see a wing or cloud unless there is a light shining on it, while also getting a brighter daytime than default that will showcase the true power of the sun.  If set up correctly all of this plays nicely with cloud shadows which will still remain dark, it is now a truly realistic experience to break out from under a dark gloomy overcast.  You should be able to make the effects as dramatic as you want without having to use sweetfx or enb type mods.  I want to give credit to Rob Ainscough and others who have provided insight on modifying the hdr file, as these tweaks build off of their findings.  You can see my results here on this thread: http://forum.avsim.net/topic/465796-p3d-hdr-tweaks/

 

First Things First:

If you expect to get the same predictable results that I have been getting you need to calibrate your monitor as accurately as possible.  This can be tough to get 100% perfect without professional equipment, but link to the site below has helped me and should get you close enough.  Make sure you follow the pages in order.  If you are using an HDTV I find its best to disable any of the "adaptive contrast" or "color enhancer" settings as well.  

 

http://www.lagom.nl/lcd-test/

 

 

The two files we will be modifying will be: GPUTerrain.fx located in .../Prepar3D v2 Main Directory/ShadersHLSL ,the next is HDR.hlsl located in

 .../Prepar3D v2 Main Directory/ShadersHLSL/PostProcess

 

After modifying any of these shader files be sure to delete your shader folder located in .../AppData/Local/Lockheed Martin/Prepar3D v2

 

Before we start tweaking it is important to understand that this involves a lot of trial and error and the settings used will depend heavily on your monitor calibration/size/resolution, sky textures, clouds, and sun textures.  You may get perfect settings using my values, or you may have to modify them quite a bit.  

 

 

The Tweaks:

Every single setting we are going to discuss is related to the others so it is important to understand the effect they have on each other.  I am going to do my best to outline the order of these modifications that will yield the most efficient process.

 

1: Open GPUTerrain.fx and find this line : BaseColor *= lerp( .35f, 1.0f, fAlpha ); - Change .35 to .42.  The tweaks we are going to apply tend to wash out the colors slightly and this should restore them back to what you are used to.  This is the only mod to this file.

 

2: Open HDR.hlsl, the remainder of the tweaks will apply to this file.  Find the entry static const float BloomThreshold =  close to the top.

This top parameter determines the level of brightness that bloom will be applied.  I set mine to 4.10f, others that like less bloom will want to set this higher, perhaps around 5.00 or more.  You don't want this too low or moonlit objects will see a bloom effect.  Find static const float BloomBlurSigma = , change this to 1.3f.  This controls the blur effect of bloom.  Lower increases the blur.  Find static const float TimeDelta = , change this to 4.5f.  This controls the rate and which your eyes adjust to changing light conditions.

 

3: Find the entry for //avgLuminance *= 0.85f; , this is what we will be using to darken the nighttime.  Remove the slashes and change the 0.85f to 1.20f for now.  Next Fire up P3D, set the date to 2/18/2015 at night, and load the sim using your favorite aircraft someplace in the northeast usa.  Click map, set the aircraft altitude to 35000 ft, and load the thunderstorm weather theme.  This is date and time in which there is no moon.  You should see NO clouds outside your windscreen, if you see clouds increase the avg luminance value until you no longer can see clouds.  This is heavily dependent on proper calibration of your monitor.

 

4:  Now that night is set up properly it is time to increase the brightness of the day.  Find the following section:

 

// calculate the luminance using a weighted average

    float luminance = .    Change the entire line to the following: float luminance =  ( 0.50 * CalcLuminance( color ));  
Adding the .50 multiplier tricks the HDR into thinking lit up objects are darker than they really are, which causes it to apply more brightness.  Many users may prefer a value of .6 instead. Higher numbers will produce a darker environment.
 
5:
Now move down a few lines and find the line : float difference = .  I found that without this next tweak the flight deck was too dark in the daytime when in a brightly lit environment.  This tweak modifies the overall aggressiveness of the HDR effect. Change the line to read: float difference = ( 0.6 * (currentLum - lastLum ) );  We have added another multiplier that will tell the hdr that the difference in brightness is less, therefore toning down the hdr effect.  Default value  is 1.0 which I think is much too camera like.  I find that 0.6 is much closer to the human eye.
 
6: Move back to the top of the file and find the line: static const float BloomMagnitude = , This controls the strength of the bloom effect, I like some bloom on the bright cloud tops, master caution lights etc. and also think it is realistic to have to turn down the brightness on your pfd/nd etc. at night so I have this set rather high at 04.85f .  If you are someone who likes less bloom you may want to lower this value.
 
Final Words and Troubleshooting:
Again it is important to understand how these settings will effect one another so you can troubleshoot them properly.  If you are seeing shimmering due to excessive bloom you want to mess with the bloom parameters and not tweak #4.  Raising blursigma and bloomthreshold, and lowering bloommagnitude will diminish excessive bloom.  Tweak #4 is for increasing daytime brightness, not bloom.  Lower the multiplier in small increments until you are happy with the general brightness of sunlit terrain and your instrument panel.  As for tweak #5, the closer you get to one the more dramatic your daytime darks and daytime brights will be.  You may find your flight deck is too dark when looking out the window even though it looked great when you were below that overcast layer.  Or your overhead panel will over saturate with brightness as you move your head position away from the outside windows.  If you experience this you need to lower the multiplier in tweak number 5.  Thanks for reading and good luck!

 

Lian Li 011 Air Mini | AMD 7950X3D | Asus ROG STRIX B650E-F | Arctic Cooling Liquid Freezer II 280mm RGB | 2x32GB G.Skill DDR5-6000 | ASUS TUF RTX 4090 | Seasonic Prime Platinum 1000W | Varjo Aero

 

Share this post


Link to post

Awesome and thank you.

 

Will be testing this out tonight, I've been using MER with the default HDR but now I can tweak it further with a great base to start with. Thanks again.

Share this post


Link to post
Guest

Glad you posted this Mike, a big thank you.  I've asked LM if these HDR settings could be made available (and easier) via the P3D Menu system so folks don't have to go about editing shader files.  Everyone will have a different opinion on what they like and don't like based on monitor calibrations and personal preference ... so providing and easy UI to do this would be a nice benefit.

 

Cheers, Rob.

Share this post


Link to post

This is just great! 

Amazing work, you've done here .. 

 

Thank you!


Best regards,
--Anders Bermann--
____________________
Scandinavian VA

Pilot-ID: SAS2471

Share this post


Link to post

Thank you! Will definitely try these  :smile:


38.jpg

Brynjar Mauseth 

Share this post


Link to post

Nice pioneering work, thanks Mike!

 

As far as I can tell by my own experimenting, the light is also influenced by the top row of pixels in the sky textures, so the end result may vary depending on what kind of sky mod (if any) is used.

 

For example, in my experience both the HDR sky mod as well as the REX sky textures have considerably lighter shadows than the stock sky. I prefer the deep stock shadows so I modded my favorite REX set to mimic those.


- Jens Peter "Penz" Pedersen

Share this post


Link to post
Guest tymk

I've only been able to do a quick test, but I'm already very impressed by the results. :Applause: The night is really dark, and the VC lighting is much more realistic now. And it's possible to keep bright daylight at the same time, which gives excellent variety of conditions depending on cloud cover. I might need to tinker a bit with bloom, as I'm using a rather bright daytime sky theme, but the effect is quite spectacular.

 

BIG, BIG THANKS for taking the time to tweak the shaders and sharing your findings!

 

Tym

Share this post


Link to post

Excellent thanks, and +1 for (Robs) suggested UI enhancements to allow easy editing - Cheers K


Kevin Firth - i9 10850K @5.2; Asus Maximus XII Hero; 32Gb Cas16 3600 DDR4; RTX3090; AutoFPS; FG mod

Beta tester for: UK2000; JustFlight; VoxATC; FSReborn; //42

xaP1VAU.png

Share this post


Link to post

Mike,

 

I tried this with 4KHD TV and it works perfectly.

 

Thanks for your easy to do guide.

 

 

Iceman

Share this post


Link to post

Thanks OP for the detailed and easy to follow tweaks. I wonder if you are getting dark ground textures at night even when moon is out? I still see dark green textures on the ground... The VC is casting shadows from the 1/4 moon that out tonight, it does seem still a bit too bright..

 

EDIT - Ah,, let me delete the shaders folder and let it rebuild, that might be the reason.

 

EDIT #2 -  Wacked the avgLuminance up to 3.2f and clouds look (in that I cant see them anymore, lol) at night. Daytime its perhaps a bit too dull now. As Rob has said it probably down to my monitors - they are not calibrated at all (I like them dark as possible really) Will keep on tweaking..! I had been able to get ReShade DOF working so might enable that once the HDR setting have settled down.

Share this post


Link to post

Yes, thanks very much Rob, great idea, hope LM listens.

Share this post


Link to post

After a few hours tweaking, I’ve settled on some settings which work well on my system. I’m currently using HDEv2 sky textures and clouds. Everything else texture wise is default.

With three monitors (5760*1080) the HDR shaders needed a little more work to give good daytime results.

Earlier I mentioned that my Ideals would be to have dark nights, dull days when it was cloudy, bright sunny days (that made me want to put on my sunglasses) with good cloud shadow effects. Cockpits that I could use and the HDR effect moving from dark to light. I figured this would be a lot to ask for but no, I now have all these things!

I added Reshade to the equation out of curiosity. In FSX using SweetFX was the only way to get close to a reasonable 24hr lighting environment. Just by using the tweaks above I got to this position in P3D. Adding Reshade has simply made it better for me. The three settings I switched on have lifted the scene and made it more vibrant. I could get away with only using the tweaks above if I was on a single monitor but when spread over three it just needed a little more of a kick.

So thank you once again Mike and Rob and others who have contributed to making all this happen.
P3D is now (as close as you can get) a 24hr lighting environment.

Yes Rob, a great idea to inform LM and if they indeed implement this in the future it will help everyone I’m sure.

 

Here are my settings for a Three monitor surround system

GPUTerrain.fx (F:\Lockheed Martin\Prepar3D v2\ShadersHLSL)

COLOUR
Line 888: BaseColor *= lerp( .46f, 1.0f, fAlpha );

HDR.hlsl (F:\Lockheed Martin\Prepar3D v2\ShadersHLSL\PostProcess)

NIGHT
Line 10: static const float BloomThreshold = 04.10f;
Line 12: static const float BloomBlurSigma = 1.3f;
Line 13: static const float TimeDelta = 4.5f;
Line 166: avgLuminance *= 2.35f;

DAY
Line 90: float luminance =  ( 0.35 * CalcLuminance( color ));
Line 100: float difference = ( 0.75 * (currentLum - lastLum ) );
Line 11: static const float BloomMagnitude = 04.85f;

 

ReShade - SweetFX_settings.txt (The following are switched on and at default settings)
#define USE_BLOOM  1
#define USE_LIFTGAMMAGAIN 1
#define USE_VIBRANCE  1

Share this post


Link to post

Thanks for sharing. I made a git on bitbucket for those that might want to just download the tweaked files instead of hunting through the lines: https://bitbucket.org/pnirattisai/p3d-hdr-tweaks

 

Feel free to edit them. For me, the nights look great but I'm still tweaking it for a brighter daytime. I'm sure it's because I'm using the HDE skytextures which are darker than the default.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...