Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Moon/aircraft brightness - how to get a black night 5.2 HF1

Featured Replies

Hi all,

I was looking at this thread trying to get rid of my wings being visible on a moonless night.  Whilst I can get them darker, I cannot get them to go black/pretty much invisible like in P3D v4.

Has anyone got any advice on making the nights actually pitch black when there is no moon with regard to P3D 5.2 HF1.  Any additional bits of shaders I need to modify?

I have tried with envshade and with stock shaders, but cannot seem to get what I want - that is a black night where you can't see the wings of the aircraft at night on a moonless night.  Also runway is slightly lit up by a non-existent moon.

Please help me!  I hate bright nights!  PS I am not using EA, have pure black night sky textures and have tried with/without dynamic reflections.

Cheers,
Rudy

Edited by VHOJT

Try with EnvShade. You can adjust Night darkness.

5950x3d 5.4-5.7 GHz - Asus ROG 870 Crosshair Apex - GSkill Neo 2x 24 Gb 6000 mhz / cas 26 -  MSI RTX 5090 Gaming Trio OC - 1x SSD M2 6000 2TB - 1x SSD M2 2800/1800 1Tb -  Corsair 5400  case - Corsair 360 liquid cooling set  - 3x 75’ TCL tv.

13600  6 cores @ 5.1 GHz / 8 cores @ 4.0 GHz (hypterthreading on) - Asus ROG Strix Gaming D - GSkill Trident 4x Gb 3200 MHz cas 15 - Asus TUF RTX 4080 16 Gb  - 1x SSD M2 2800/1800 2TB - 2x  Sata 600 SSD 500 Mb - Corsair D4000 Airflow case - NXT Krajen Z63 AIO liquide cooling - 

FOV : 200 degrees

My flightsim vids :  https://www.youtube.com/user/fswidesim/videos?shelf_id=0&sort=dd&view=0

 

  • Author
5 hours ago, GSalden said:

Try with EnvShade. You can adjust Night darkness.

Can you?  I didn't see a slider for that?

  • Author

Ah yes - HDR night darkness. I have tried turning that to minimum, clearing shaders.  But not much change unfortunately.  Runway and aircraft wings still visible.

Even tried manually putting in a value of -2.00 (far below 0.5).

Why is it the wings are still bright with no moon?

Thanks for your help.

Cheers,
Rudy

This is July 10th, so should be a moonless night.

https://www.dropbox.com/s/kfyyxgd6vr7im7l/2021-7-9_10-0-59-360.jpg?dl=0

 

 

Edited by VHOJT

  • Commercial Member

That is one thing I wish Envshade would do, allow sliders to have a much larger range of values.

Kyle Weber (Private Pilot, ASEL; Flight Test Engineer)
Check out my repaints and downloads, all right here on AVSIM

  • Author
12 hours ago, CaptKornDog said:

That is one thing I wish Envshade would do, allow sliders to have a much larger range of values.

Assuming you know what to look for (which can be difficult - but made easier by a program like Winmerge) - you can find what each slider changes and adjust manually in the shader files.

So am I to assume that no-one else finds a glowing aircraft annoying on a moonless night?  Surely @Pilot53 @aiRoNe_fx must be finding this annoying?  Even the runway/terrain are slightly glowing.

 

 

  • Commercial Member
55 minutes ago, VHOJT said:

Assuming you know what to look for (which can be difficult - but made easier by a program like Winmerge) - you can find what each slider changes and adjust manually in the shader files.

So am I to assume that no-one else finds a glowing aircraft annoying on a moonless night?  Surely @Pilot53 @aiRoNe_fx must be finding this annoying?  Even the runway/terrain are slightly glowing.

 

 

Right.  Then if you make any changes to Envshade, it overwrites it.  So, while possible, cumbersome.  And I'm not an expert on the fx file intricacies to begin with.

Kyle Weber (Private Pilot, ASEL; Flight Test Engineer)
Check out my repaints and downloads, all right here on AVSIM

  • Author
15 minutes ago, CaptKornDog said:

Right.  Then if you make any changes to Envshade, it overwrites it.  So, while possible, cumbersome.  And I'm not an expert on the fx file intricacies to begin with.

Spot on - it would be a pain.

If you're not using EA then it's more tangible, as you can directly edit the HLSL code within the ShadersHLSL folder. However EA skies or clouds I don't think can be easily edited, since they are compiled DirectX shaders. Most parameters of EA cannot be changed, some however can be. Though I don't know if terrain brightness is one of them. 

If you're NOT using EA and just using the original shaders:

Backup your ShaderHLSL folder. Open the folder and find "GPUTerrain.fx". Open the file and search for the comment: 

//Calculate the final ambient / diffuse coloring for the sun and moon.

Just below that comment you'll see two more lines. 

const float3 finalSunColor =...
const float3 finalMoonColor =...

The line you need to edit is const float3 finalMoonColor.

By default it should be:

const float3 finalMoonColor = (moonAmbient + (moonDiffuse * (moonContrib * shadowContrib)));

Add multipliers to the "moonDiffuse" to lower the diffuse brightness. In this case:

const float3 finalMoonColor = (moonAmbient + (moonDiffuse * 0.3 * (moonContrib * shadowContrib)));

Save the file. 

I'm not sure about EA skies, since I'm not very well versed with that shader yet.

Edited by arwasairl

6 hours ago, arwasairl said:

If you're not using EA then it's more tangible, as you can directly edit the HLSL code within the ShadersHLSL folder. However EA skies or clouds I don't think can be easily edited, since they are compiled DirectX shaders. Most parameters of EA cannot be changed, some however can be. Though I don't know if terrain brightness is one of them. 

If you're NOT using EA and just using the original shaders:

Backup your ShaderHLSL folder. Open the folder and find "GPUTerrain.fx". Open the file and search for the comment: 


//Calculate the final ambient / diffuse coloring for the sun and moon.

Just below that comment you'll see two more lines. 


const float3 finalSunColor =...
const float3 finalMoonColor =...

The line you need to edit is const float3 finalMoonColor.

By default it should be:


const float3 finalMoonColor = (moonAmbient + (moonDiffuse * (moonContrib * shadowContrib)));

Add multipliers to the "moonDiffuse" to lower the diffuse brightness. In this case:


const float3 finalMoonColor = (moonAmbient + (moonDiffuse * 0.3 * (moonContrib * shadowContrib)));

Save the file. 

I'm not sure about EA skies, since I'm not very well versed with that shader yet.

The file "GPUTerrain.fx" doesn't exist on my v5 installation, i think it was a file from v4. Do you know which file i have to edit instead? I think this is not possible anymore, searched for that line in every .fx file in ShadersHLSL

14 hours ago, VHOJT said:

Assuming you know what to look for (which can be difficult - but made easier by a program like Winmerge) - you can find what each slider changes and adjust manually in the shader files.

So am I to assume that no-one else finds a glowing aircraft annoying on a moonless night?  Surely @Pilot53 @aiRoNe_fx must be finding this annoying?  Even the runway/terrain are slightly glowing.

 

 

Yes you are right, I find it and everything else about P3D's lighting engine so annoying I have given up on p3d and moved on to msfs now that the pmdg dc6 is out.  Its more than enough enjoyment to hold me over until the jets are completed.  Im just done with the tweaking and the bad unrealistic lighting, clouds, weather, and atmospherics.  Sorry I cant be of more help, but I've tried asking questions on the LM forum about various tweaks and shader code but it falls on deaf ears.  

Edited by Pilot53

 

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

 

5 hours ago, user823459 said:

The file "GPUTerrain.fx" doesn't exist on my v5 installation, i think it was a file from v4. Do you know which file i have to edit instead? I think this is not possible anymore, searched for that line in every .fx file in ShadersHLSL

Yeah it had completely gone over my head that the default shaders have been completely changed since v4. 

v5 has changed the moon lighting technique from ambient/diffuse to directional lighting. Instead of it being a constant, (before it was assigned as a floating-point constant, so you can't change it's value after it had been initialized) v5 now has changed it to a floating point value. It now no longer calculates shadows and brightness in the same line, instead it is now

//File is Terrain.fx

//Calculate direct lighting from sun and moon.
float3 sunContrib = DirectionalLightingPBR(cb_mSun, pbrValues);
float3 moonContrib = DirectionalLightingPBR(cb_mMoon, pbrValues);
	
	color.rgb = (sunContrib + moonContrib)* shadowContrib;

Judging by the name of the variable, I'm assuming moonContrib is the amount of contribution the moon has to the directional lighting. However I don't know if it's possible to just add a multiplier, but you can try:

float3 moonContrib = DirectionalLightingPBR(cb_mMoon * 0.3, pbrValues);

If that doesn't work, some other values of interest is in PBRBase.fx; there is the same exact 3 lines on line 480.
On line 718 of General.fx, there are two lines reading:

const float3 sunDiffuse = cb_mSun.mDiffuse.xyz;
const float3 moonDiffuse = cb_mMoon.mDiffuse.xyz;

You can try to play with those as well.

  • Author

Hello all!

Thanks for your kind advice so far.

I have had an extensive play around with the moon values, and I THINK I have to the conclusion that perhaps the moon is not to blame in the case of the aircraft wings (test case the is the FSL A320). 

I can adjust the moon brightness in the PBRBase.fx file such that I get a very bright wing on a moonlit night, or a darker wing (tiny multiplier).

float3 moonContrib = DirectionalLightingPBR(cb_mMoon, pbrValues) * 0.1 for dark

float3 moonContrib = DirectionalLightingPBR(cb_mMoon, pbrValues) * 20; for very bright.

An a moonless night, this has no effect.  On a night with moon, this has an effect.

No matter how you multiply it, there is still a residual "glow" of the wing on a moonless night.

So something else that I suspsect is not the moon is having an effect on how the wing is displayed at night.  Which is where I am now starting to get in over my head - could it be some sort of shadow etc.?

Cheers,
Rudy

 

 

  • Author
On 7/11/2021 at 3:35 AM, arwasairl said:

Yeah it had completely gone over my head that the default shaders have been completely changed since v4. 

v5 has changed the moon lighting technique from ambient/diffuse to directional lighting. Instead of it being a constant, (before it was assigned as a floating-point constant, so you can't change it's value after it had been initialized) v5 now has changed it to a floating point value. It now no longer calculates shadows and brightness in the same line, instead it is now


//File is Terrain.fx

//Calculate direct lighting from sun and moon.
float3 sunContrib = DirectionalLightingPBR(cb_mSun, pbrValues);
float3 moonContrib = DirectionalLightingPBR(cb_mMoon, pbrValues);
	
	color.rgb = (sunContrib + moonContrib)* shadowContrib;

Judging by the name of the variable, I'm assuming moonContrib is the amount of contribution the moon has to the directional lighting. However I don't know if it's possible to just add a multiplier, but you can try:


float3 moonContrib = DirectionalLightingPBR(cb_mMoon * 0.3, pbrValues);

If that doesn't work, some other values of interest is in PBRBase.fx; there is the same exact 3 lines on line 480.
On line 718 of General.fx, there are two lines reading:


const float3 sunDiffuse = cb_mSun.mDiffuse.xyz;
const float3 moonDiffuse = cb_mMoon.mDiffuse.xyz;

You can try to play with those as well.

 

 

Hello all!

Thanks for your kind advice so far.

I have had an extensive play around with the moon values, and I THINK I have to the conclusion that perhaps the moon is not to blame in the case of the aircraft wings (test case the is the FSL A320). 

I can adjust the moon brightness in the PBRBase.fx file such that I get a very bright wing on a moonlit night, or a darker wing (tiny multiplier).

float3 moonContrib = DirectionalLightingPBR(cb_mMoon, pbrValues) * 0.1 for dark

float3 moonContrib = DirectionalLightingPBR(cb_mMoon, pbrValues) * 20; for very bright.

An a moonless night, this has no effect.  On a night with moon, this has an effect.

No matter how you multiply it, there is still a residual "glow" of the wing on a moonless night.  Tried adjusting the other moon values in other .fx files as well simulataneously, which had no effect.

So something else that I suspsect is not the moon is having an effect on how the wing is displayed at night.  Which is where I am now starting to get in over my head - could it be some sort of shadow etc.?

Cheers,
Rudy

Edited by VHOJT

12 hours ago, VHOJT said:

 

 

Hello all!

Thanks for your kind advice so far.

I have had an extensive play around with the moon values, and I THINK I have to the conclusion that perhaps the moon is not to blame in the case of the aircraft wings (test case the is the FSL A320). 

I can adjust the moon brightness in the PBRBase.fx file such that I get a very bright wing on a moonlit night, or a darker wing (tiny multiplier).

float3 moonContrib = DirectionalLightingPBR(cb_mMoon, pbrValues) * 0.1 for dark

float3 moonContrib = DirectionalLightingPBR(cb_mMoon, pbrValues) * 20; for very bright.

An a moonless night, this has no effect.  On a night with moon, this has an effect.

No matter how you multiply it, there is still a residual "glow" of the wing on a moonless night.  Tried adjusting the other moon values in other .fx files as well simulataneously, which had no effect.

So something else that I suspsect is not the moon is having an effect on how the wing is displayed at night.  Which is where I am now starting to get in over my head - could it be some sort of shadow etc.?

Cheers,
Rudy

My guess is that v5 uses some kind of IBL or irradiance, and the moon contribution takes over when the moon is visible. But when the moon isn't there, it treats the environment as a light source. That's just a theory though, you might want to chock it up with LM about that.

You can look at line 283 of FuncLibrary.fxh, and see what you can do with that.

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.