Jump to content
Sign in to follow this  
pgde

LM's Temporary Fix For Haze Issue on Horizon P3D 5.3

Recommended Posts

From Beau Hollis:

https://www.prepar3d.com/forum/viewtopic.php?f=6312&t=143957&start=30

Here is a copy and paste:

 

Hello all,

We have a shader fix to bring back the horizon fade behavior while maintaining the improvements made to fog blending and curvature correction of layers below the camera. Since it's is a shader-only change, I will post instructions below for those that want to try it before we put out an official fix.

Note this instructions assume default P3D shaders, so if you are using an add-on that modified our shaders this may not work as exptected. Also note that you will need write permissions to your install directory which may require admin rights.

First locate ShadersHLSL\FuncLibrary.fxh and save a backup copy in case you into any issues.

Open ShadersHLSL\FuncLibrary.fxh in a text editor and look for this line of code:

CODE: SELECT ALL

    return float4(fogInscatter, transmittance);

It should be around line 505 at the end of a function called CalculateFogAndTransmittance. Once you find it you can replace it with this:

CODE: SELECT ALL

#if !defined(SHD_ENHANCED_ATMOSPHERICS_BLEND) && !defined(SHD_TO_FAR_CLIP)
    const float distanceFogTrans = min(transmittance, CalculateExponentialFogBlend(distanceSq, cb_View.mFogDensity));
    fogInscatter += cb_View.mFogColor.rgb * distanceFogTrans;
    transmittance = saturate(transmittance - distanceFogTrans);
#endif
    return float4(fogInscatter, transmittance);

Then clear your shader cache by removing this folder or deleting it's contents:
%LocalAppData%\Lockheed Martin\Prepar3D v5\Shaders

If P3D is running, shut it down and start it back up again.

If, after giving it some time to load shaders, everything is black, something went wrong. In that case you need to revert to the backup copy and clear the shader cache again. Almost every shader includes this header so any syntax error here will mean that most shaders won't compile.

Edited by pgde
  • Like 6

Gigabyte x670 Aorus Elite AX MB; AMD 7800X3D CPU; Deepcool LT520 AIO Cooler; 64 Gb G.Skill Trident Z5 NEO DDR5 6000; Win11 Pro; P3D V5.4; 1 Samsung 990 2Tb NVMe SSD: 1 Crucial 4Tb MX500 SATA SSD; 1 Samsung 860 1Tb SSD; Gigabyte Aorus Extreme 1080ti 11Gb VRAM; Toshiba 43" LED TV @ 4k; Honeycomb Bravo.

 

Share this post


Link to post

Thanks for the info, does this only apply for users that have EA off?


Sergio Naiberg

Share this post


Link to post

I wonder if TOGA can apply this to envshade somehow since this may or may not work for those of us using it. 


5800X3D, Gigabyte X570S MB, 4090FE, 32GB DDR4 3600 CL14, EVO 970 M.2's, Alienware 3821DW  and 2  22" monitors,  Corsair RM1000x PSU,  360MM MSI MEG, MFG Crosswind, T16000M Stick, Boeing TCA Yoke/Throttle, Skalarki MCDU and FCU, Saitek Radio Panel/Switch Panel, Spad.Next

Share this post


Link to post

Hi,


I'm not able to understand what to do.
COuld anybody post the modfied file

 

Thank's

Yves from ELLX.


Yves SAMUEL

ELLX

Share this post


Link to post
53 minutes ago, micstatic said:

I wonder if TOGA can apply this to envshade somehow since this may or may not work for those of us using it. 

I have already contacted their tech support and asked this. Stay tuned and I will post when I receive an answer!

  • Like 1
  • Upvote 1

Gigabyte x670 Aorus Elite AX MB; AMD 7800X3D CPU; Deepcool LT520 AIO Cooler; 64 Gb G.Skill Trident Z5 NEO DDR5 6000; Win11 Pro; P3D V5.4; 1 Samsung 990 2Tb NVMe SSD: 1 Crucial 4Tb MX500 SATA SSD; 1 Samsung 860 1Tb SSD; Gigabyte Aorus Extreme 1080ti 11Gb VRAM; Toshiba 43" LED TV @ 4k; Honeycomb Bravo.

 

Share this post


Link to post
1 hour ago, yvesamuel said:

Hi,


I'm not able to understand what to do.
COuld anybody post the modfied file

 

Thank's

Yves from ELLX.

Here ya go......don't forget to follow the installation instructions.

Modified FuncLibrary.fxh

 

Oh, and as usual, install at your own risk.

Edited by Sparkrite
  • Like 2
  • Upvote 1

Share this post


Link to post

@Sparkrite, I’ve hidden your post as it appears to me to be suspect.

Please explain the purpose of your link.


Ray (Cheshire, England).
System: P3D v5.3HF2, Intel i9-13900K, MSI 4090 GAMING X TRIO 24G, Crucial T700 4Tb M.2 SSD, Asus ROG Maximus Z790 Hero, 32Gb Corsair Vengeance DDR5 6000Mhz RAM, Win 11 Pro 64-bit, BenQ PD3200U 32” UHD monitor, Fulcrum One yoke.
Cheadle Hulme Weather

Share this post


Link to post
10 minutes ago, Ray Proudfoot said:

@Sparkrite, I’ve hidden your post as it appears to me to be suspect.

Please explain the purpose of your link.

@yvesamuel said he wasn't able to modify the file and asked if someone would do it for him and upload it, so I did as he requested.

Was I in beach of some rule? If I was, then I apologize .

Just trying to help someone out @Ray Proudfoot.

BTW I couldn't find a way to attach a file to my post so just used 'Easy upload', hence the link.

 

EDIT: out of interest, in what way did it 'appear suspect', please?

Edited by Sparkrite
  • Upvote 1

Share this post


Link to post

@Sparkrite, I understand. I’m not 100% sure if it contravenes AvSim or LM T&Cs but I’ve unhidden your post. I appreciate you’r trying to help, thanks.

Users install this file at their own risk.


Ray (Cheshire, England).
System: P3D v5.3HF2, Intel i9-13900K, MSI 4090 GAMING X TRIO 24G, Crucial T700 4Tb M.2 SSD, Asus ROG Maximus Z790 Hero, 32Gb Corsair Vengeance DDR5 6000Mhz RAM, Win 11 Pro 64-bit, BenQ PD3200U 32” UHD monitor, Fulcrum One yoke.
Cheadle Hulme Weather

Share this post


Link to post
7 minutes ago, Sparkrite said:

EDIT: out of interest, in what way did it 'appear suspect', please?

I hadn’t read all posts in this topic and it was reported as possible breach of copyright.


Ray (Cheshire, England).
System: P3D v5.3HF2, Intel i9-13900K, MSI 4090 GAMING X TRIO 24G, Crucial T700 4Tb M.2 SSD, Asus ROG Maximus Z790 Hero, 32Gb Corsair Vengeance DDR5 6000Mhz RAM, Win 11 Pro 64-bit, BenQ PD3200U 32” UHD monitor, Fulcrum One yoke.
Cheadle Hulme Weather

Share this post


Link to post
2 hours ago, pgde said:

From Beau Hollis:

https://www.prepar3d.com/forum/viewtopic.php?f=6312&t=143957&start=30

Here is a copy and paste:

 

Hello all,

We have a shader fix to bring back the horizon fade behavior while maintaining the improvements made to fog blending and curvature correction of layers below the camera. Since it's is a shader-only change, I will post instructions below for those that want to try it before we put out an official fix.

Note this instructions assume default P3D shaders, so if you are using an add-on that modified our shaders this may not work as exptected. Also note that you will need write permissions to your install directory which may require admin rights.

First locate ShadersHLSL\FuncLibrary.fxh and save a backup copy in case you into any issues.

Open ShadersHLSL\FuncLibrary.fxh in a text editor and look for this line of code:

CODE: SELECT ALL


    return float4(fogInscatter, transmittance);

It should be around line 505 at the end of a function called CalculateFogAndTransmittance. Once you find it you can replace it with this:

CODE: SELECT ALL


#if !defined(SHD_ENHANCED_ATMOSPHERICS_BLEND) && !defined(SHD_TO_FAR_CLIP)
    const float distanceFogTrans = min(transmittance, CalculateExponentialFogBlend(distanceSq, cb_View.mFogDensity));
    fogInscatter += cb_View.mFogColor.rgb * distanceFogTrans;
    transmittance = saturate(transmittance - distanceFogTrans);
#endif
    return float4(fogInscatter, transmittance);

Then clear your shader cache by removing this folder or deleting it's contents:
%LocalAppData%\Lockheed Martin\Prepar3D v5\Shaders

If P3D is running, shut it down and start it back up again.

If, after giving it some time to load shaders, everything is black, something went wrong. In that case you need to revert to the backup copy and clear the shader cache again. Almost every shader includes this header so any syntax error here will mean that most shaders won't compile.

it never cease to amaze me how developers/programmers  in IT   , (IE Beau Hollis) doesnt realise that to the "common garden pc user"  this sort of stuff  is  about as daunting as it gets.

If people stuggle with uninstalling client and content, how the blazes are they going to do the above, 

It would be like me giving Hollis an OPS-A and asking him to tell me in 10 mins whats the minimum flight time required for to augament a 3 man crew to extend an FDP and why.   In short he wouldnt be able to do it, (neither would most people on here) he wouldnt know what im on about, because its not his field of expertise.  Neither is amending XMLS/FXH for the average person. 

I swear these people have zero interpersonal skills I really do.   They spend all their time writing code like this.

It beggers belief. 

  

Edited by fluffyflops
  • Like 1
  • Upvote 1

 
 
 
 
14ppkc-6.png
  913456

Share this post


Link to post
1 minute ago, Ray Proudfoot said:

I hadn’t read all posts in this topic and it was reported as possible breach of copyright.

Ah right.

I'm no expert on copyright laws Ray, but I doubt if it's in breach as It is publicly available on LM's site, if that means anything. 😄

https://www.prepar3d.com/forum/viewtopic.php?f=6312&t=143957&start=30#

  • Upvote 1

Share this post


Link to post

I think the mod is publicly available but not the entire file.


Gigabyte x670 Aorus Elite AX MB; AMD 7800X3D CPU; Deepcool LT520 AIO Cooler; 64 Gb G.Skill Trident Z5 NEO DDR5 6000; Win11 Pro; P3D V5.4; 1 Samsung 990 2Tb NVMe SSD: 1 Crucial 4Tb MX500 SATA SSD; 1 Samsung 860 1Tb SSD; Gigabyte Aorus Extreme 1080ti 11Gb VRAM; Toshiba 43" LED TV @ 4k; Honeycomb Bravo.

 

Share this post


Link to post
22 minutes ago, Sparkrite said:

Ah right.

I'm no expert on copyright laws Ray, but I doubt if it's in breach as It is publicly available on LM's site, if that means anything. 😄

https://www.prepar3d.com/forum/viewtopic.php?f=6312&t=143957&start=30#

The line that needs amending is there -  not the complete file. Unless admin interject it can stand.


Ray (Cheshire, England).
System: P3D v5.3HF2, Intel i9-13900K, MSI 4090 GAMING X TRIO 24G, Crucial T700 4Tb M.2 SSD, Asus ROG Maximus Z790 Hero, 32Gb Corsair Vengeance DDR5 6000Mhz RAM, Win 11 Pro 64-bit, BenQ PD3200U 32” UHD monitor, Fulcrum One yoke.
Cheadle Hulme Weather

Share this post


Link to post

For anyone who might be struggling to add the line:

Go to your main P3D install folder, find ShadersHSL folder. Open FuncLibrary.fxh file with notepad.

CTRL+F, and search for return float4(fogInscatter, transmittance);   

After that, select the entire text, press backspace. And paste this info instead:

#if !defined(SHD_ENHANCED_ATMOSPHERICS_BLEND) && !defined(SHD_TO_FAR_CLIP)
    const float distanceFogTrans = min(transmittance, CalculateExponentialFogBlend(distanceSq, cb_View.mFogDensity));
    fogInscatter += cb_View.mFogColor.rgb * distanceFogTrans;
    transmittance = saturate(transmittance - distanceFogTrans);
#endif
    return float4(fogInscatter, transmittance);

Then save the file. Do not make any further modifications. Once saved, delete shaders as usual and let them rebuild when starting P3D again. 

  • Like 1
  • Upvote 1

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...