Very dark cockpit in 5.2

Any issues, problems or troubleshooting topics related to the Prepar3D client application.
giorgio759
Posts: 2
Joined: Sun May 17, 2015 12:52 am

Re: Very dark cockpit in 5.2

Post by giorgio759 »

Thanks for this modification & for sharing it. The PMDG B737NGXu cockpit lighting is much better & I don't have to use a flashlight to flip switches on the overhead console.
George McDowell
KBZN
Wise87
Posts: 19
Joined: Thu Dec 15, 2016 5:06 am

Re: Very dark cockpit in 5.2

Post by Wise87 »

Do we add too the existing entries or replace it all with the above?
sincedric
Posts: 25
Joined: Wed Aug 09, 2017 10:28 am

Re: Very dark cockpit in 5.2

Post by sincedric »

BiologicalNanobot wrote: Tue Jun 15, 2021 9:20 pm Hi,

One of the reasons of dark cockpits is the HDR tonemapper used in the simulator. Physically based lighting calculations often produce values beyond SDR, so it is easier to do calculations in HDR and then convert resulting HDR image back to SDR. Mathematical functions called tonemappers are used for this purpose.

P3D uses Narkowicz fit of ACES tonemapper, which makes the image overly contrasty and crushes blacks. I hope Lockheed Martin uses Uncharted 2 instead, which results in a much more natural look.

Here is my implementation, if it helps:

Code: Select all

float3 Uncharted2Curve(float3 input_color)
{
    const float shoulder_strength = 0.22;
    const float linear_strength = 0.30;
    const float linear_angle = 0.10;
    const float toe_strength = 0.20;
    const float toe_numerator = 0.01;
    const float toe_denominator = 0.30;

    return (((input_color * ((shoulder_strength * input_color) + (linear_angle * linear_strength))) + (toe_strength * toe_numerator)) / ((input_color * ((shoulder_strength * input_color) + linear_strength)) + (toe_strength * toe_denominator))) - (toe_numerator / toe_denominator);
}

float3 ToneMap(float3 input_color)
{
    const float exposure_bias = 2.0;
    const float white_point = 11.2;

    return saturate(Uncharted2Curve(input_color * exposure_bias) / Uncharted2Curve(float3(white_point, white_point, white_point)));
}
Thanks for the code, it's my first time messing with shaders, can you tell us which part should I replace? Or perhaps a working completed file? I looked and I couldn't figure where this code should go in HDR.hlsl. Thank you!
BiologicalNanobot
Posts: 42
Joined: Wed Feb 10, 2021 4:15 pm

Re: Very dark cockpit in 5.2

Post by BiologicalNanobot »

Hi,

For people who want to use my HDR.hlsl mod, here is the full code for HDR.hlsl:

Code: Select all

//---------------------------------------------------------------------------
// Prepar3d - Shader Effect Files
// Copyright (c) 2021, Lockheed Martin Corporation
//---------------------------------------------------------------------------

#include "ShaderMacros.h"
#include "ConstantBuffers.fxh"
#include <FuncLibrary.fxh>
#include "Quad.sh"

shared cbuffer cbHDRData : REGISTER(b, POST_PROCESS_CB_REGISTER)
{
    float BloomMagnitude;
    float SaturationScalar;
    float2 pad;
};

Texture2D<float4> inputTexture : register( t0 );
Texture2D<float4> bloomTexture : register( t1 );
shared StructuredBuffer<float> exposureBuffer: register(t2);

float3 Uncharted2Curve(float3 input_color)
{
    const float shoulder_strength = 0.22;
    const float linear_strength = 0.30;
    const float linear_angle = 0.10;
    const float toe_strength = 0.20;
    const float toe_numerator = 0.01;
    const float toe_denominator = 0.30;

    return (((input_color * ((shoulder_strength * input_color) + (linear_angle * linear_strength))) + (toe_strength * toe_numerator)) / ((input_color * ((shoulder_strength * input_color) + linear_strength)) + (toe_strength * toe_denominator))) - (toe_numerator / toe_denominator);
}

float3 ToneMap(float3 input_color)
{
    const float exposure_bias = 2.0;
    const float white_point = 11.2;

    return saturate(Uncharted2Curve(input_color * exposure_bias) / Uncharted2Curve(float3(white_point, white_point, white_point)));
}

// Applies exposure and tone mapping to the input, and combines it with the
// results of the bloom pass
float4 Composite(PsQuad vert) : SV_Target
{
    //Calculate the exposure.
    float exposure = exposureBuffer[0];

    //Get the HDR color.
    float4 color = inputTexture.Sample(samClamp, vert.texcoord);

    //Apply bloom and exposure.
    color.rgb += BloomMagnitude * bloomTexture.Sample(samClamp, vert.texcoord).rgb;
    color.rgb *= exposure;
   
    //Tone map.
	color.rgb = ToneMap(color.rgb);

    //Saturate the final color if desired.
    float3 finalColor = lerp(RGBToLuma(color.rgb), color.rgb, SaturationScalar);
    
    //Linear to sRGB happening on write into render target.
    return float4(finalColor, color.a);
}
Simply replace all of the code in HDR.hlsl (located in Prepar3D root directory/ShadersHLSL/PostProcess) with the code above and delete the shader cache by removing %localappdata%/Lockheed Martin/Prepar3D v5/Shaders folder.

Do NOT forget to create a backup first! The shader mod is only compatible with v5.2, for v5.1 HF1 and previous versions you can manually replace default ToneMap function with Uncharted2Curve and ToneMap functions I posted before.

I really hope Lockheed Martin makes this default in next Prepar3D versions.
b757max
Posts: 8
Joined: Thu Jun 10, 2021 5:15 am

Re: Very dark cockpit in 5.2

Post by b757max »

Hello! What method can I use to increase the brightness of the cockpit and reduce the brightness of the volume cloud. Because according to your method, external light and shadow become similar to V4, and I like V5's external light and shadow very much. I'd appreciate it if you could offer me some advice
Note: my English is not very good
hkhoanguyen
Posts: 46
Joined: Sat Feb 21, 2015 8:45 am

Re: Very dark cockpit in 5.2

Post by hkhoanguyen »

BiologicalNanobot wrote: Wed Jun 16, 2021 12:01 pm Hi,

For people who want to use my HDR.hlsl mod, here is the full code for HDR.hlsl:

I really hope Lockheed Martin makes this default in next Prepar3D versions.
Hello BiologicalNanobot, thanks for the modification, but after testing I think HDR modification also makes the night sky (at mid night) brighter which is a bit unrealistic in my opinion

Image
Image

You have any idea to fix that ?
shermank
Posts: 335
Joined: Thu Nov 28, 2013 6:17 pm

Re: Very dark cockpit in 5.2

Post by shermank »

Reference is made in this thread to HDR Tone Blocker....and a work around has been posted. But, where can this be applied? I see nothing within the p3d folder that would guide me to it, or at least I see nothing that I recognize. Thanks for some help.

Sherm
disco79stu
Posts: 57
Joined: Thu Jul 16, 2020 9:05 pm

Re: Very dark cockpit in 5.2

Post by disco79stu »

shermank wrote: Thu Jun 17, 2021 12:42 pm Reference is made in this thread to HDR Tone Blocker....and a work around has been posted. But, where can this be applied? I see nothing within the p3d folder that would guide me to it, or at least I see nothing that I recognize. Thanks for some help.

Sherm
Try this location:
... Lockheed Martin\Prepar3D v5\ShadersHLSL\PostProcess
Phillip2
Posts: 29
Joined: Fri Jun 08, 2018 9:15 pm
Location: Copenhagen, Denmark

Re: Very dark cockpit in 5.2

Post by Phillip2 »

BiologicalNanobot wrote: Wed Jun 16, 2021 12:01 pm Hi,

For people who want to use my HDR.hlsl mod, here is the full code for HDR.hlsl:

Code: Select all

//---------------------------------------------------------------------------
// Prepar3d - Shader Effect Files
// Copyright (c) 2021, Lockheed Martin Corporation
//---------------------------------------------------------------------------

#include "ShaderMacros.h"
#include "ConstantBuffers.fxh"
#include <FuncLibrary.fxh>
#include "Quad.sh"

shared cbuffer cbHDRData : REGISTER(b, POST_PROCESS_CB_REGISTER)
{
    float BloomMagnitude;
    float SaturationScalar;
    float2 pad;
};

Texture2D<float4> inputTexture : register( t0 );
Texture2D<float4> bloomTexture : register( t1 );
shared StructuredBuffer<float> exposureBuffer: register(t2);

float3 Uncharted2Curve(float3 input_color)
{
    const float shoulder_strength = 0.22;
    const float linear_strength = 0.30;
    const float linear_angle = 0.10;
    const float toe_strength = 0.20;
    const float toe_numerator = 0.01;
    const float toe_denominator = 0.30;

    return (((input_color * ((shoulder_strength * input_color) + (linear_angle * linear_strength))) + (toe_strength * toe_numerator)) / ((input_color * ((shoulder_strength * input_color) + linear_strength)) + (toe_strength * toe_denominator))) - (toe_numerator / toe_denominator);
}

float3 ToneMap(float3 input_color)
{
    const float exposure_bias = 2.0;
    const float white_point = 11.2;

    return saturate(Uncharted2Curve(input_color * exposure_bias) / Uncharted2Curve(float3(white_point, white_point, white_point)));
}

// Applies exposure and tone mapping to the input, and combines it with the
// results of the bloom pass
float4 Composite(PsQuad vert) : SV_Target
{
    //Calculate the exposure.
    float exposure = exposureBuffer[0];

    //Get the HDR color.
    float4 color = inputTexture.Sample(samClamp, vert.texcoord);

    //Apply bloom and exposure.
    color.rgb += BloomMagnitude * bloomTexture.Sample(samClamp, vert.texcoord).rgb;
    color.rgb *= exposure;
   
    //Tone map.
	color.rgb = ToneMap(color.rgb);

    //Saturate the final color if desired.
    float3 finalColor = lerp(RGBToLuma(color.rgb), color.rgb, SaturationScalar);
    
    //Linear to sRGB happening on write into render target.
    return float4(finalColor, color.a);
}
Simply replace all of the code in HDR.hlsl (located in Prepar3D root directory/ShadersHLSL/PostProcess) with the code above and delete the shader cache by removing %localappdata%/Lockheed Martin/Prepar3D v5/Shaders folder.

Do NOT forget to create a backup first! The shader mod is only compatible with v5.2, for v5.1 HF1 and previous versions you can manually replace default ToneMap function with Uncharted2Curve and ToneMap functions I posted before.

I really hope Lockheed Martin makes this default in next Prepar3D versions.
Thanks indeed for that one - it worked!
A little hint for anyone not use to deal with strange file formats, as me, I found that I had to rename the the HDR.hlsl to HDR.txt - then copy your good stuff into the txt file, save it, and then rename the file back to HDR.hlsl

That said, I'm still not able to load the same multimonitor PMDG setup into v5 as I'm use to with v4 because of VAS issues. It's a complete mystery to me that LM chose to start all over, back to scratch, when introducing v5. The reason for me, years ago, to go for v4 was mainly the introduction of the 64 bit base, which completely eliminated the VAS issue. It's hard to deal with the disappointing fact, that the VAS issue now turns up again and LM has spend over 2 years to develop v5 and still not reached a useful and stable stadium compared to LM's nice working version 4.
Phillip
ASUS PRIME Z370-P i9 9900K 16GB-DDR4 nVidia RTX2080 Win10 64 1909 PRO1863 USB earphones Artic7 Steel3 and s/pdif opt.7.1 surround Denon amp P3DV5.3 ASP/ASCA ProATC/X UTLive
Almogatar
Posts: 10
Joined: Sun Jul 12, 2020 8:23 am

Re: Very dark cockpit in 5.2

Post by Almogatar »

hkhoanguyen wrote: Wed Jun 16, 2021 5:24 pm
BiologicalNanobot wrote: Wed Jun 16, 2021 12:01 pm Hi,

For people who want to use my HDR.hlsl mod, here is the full code for HDR.hlsl:

I really hope Lockheed Martin makes this default in next Prepar3D versions.
Hello BiologicalNanobot, thanks for the modification, but after testing I think HDR modification also makes the night sky (at mid night) brighter which is a bit unrealistic in my opinion

Image
Image

You have any idea to fix that ?
Same here, the mod is perfect for day time but the night is too bright.
shermank
Posts: 335
Joined: Thu Nov 28, 2013 6:17 pm

Re: Very dark cockpit in 5.2

Post by shermank »

Thanks Bio....I appreciate the tip.

Sherm
Hazzanz
Posts: 11
Joined: Sun Mar 08, 2015 5:48 am

Re: Very dark cockpit in 5.2

Post by Hazzanz »

Can anyone confirm if this works in 5.2 HF1?
B777ER
Posts: 106
Joined: Sat May 14, 2016 2:45 pm

Re: Very dark cockpit in 5.2

Post by B777ER »

Hazzanz wrote: Fri Jul 02, 2021 11:10 pm Can anyone confirm if this works in 5.2 HF1?
I tried it. All you get is a black screen now. This mod no longer works.
sincedric
Posts: 25
Joined: Wed Aug 09, 2017 10:28 am

Re: Very dark cockpit in 5.2

Post by sincedric »

B777ER wrote: Sun Jul 04, 2021 12:29 am
Hazzanz wrote: Fri Jul 02, 2021 11:10 pm Can anyone confirm if this works in 5.2 HF1?
I tried it. All you get is a black screen now. This mod no longer works.
Works perfectly fine here with HF1
shermank
Posts: 335
Joined: Thu Nov 28, 2013 6:17 pm

Re: Very dark cockpit in 5.2

Post by shermank »

Trying a couple of things to reduce dark cockpit, in options, Lighting. Uncheck the Cockpit Receive Shadows box...made a dramatic difference for me.

Sherm
Post Reply