fix atmosphere haze absorbance. fix small specular reflection issue

This commit is contained in:
Xonk
2024-07-07 16:29:14 -04:00
parent 6df9b1624a
commit 396c9edba7
7 changed files with 23 additions and 17 deletions

View File

@ -68,7 +68,7 @@ vec4 GetVolumetricFog(
vec3 LightColor,
vec3 AmbientColor,
vec3 AveragedAmbientColor,
inout vec3 cloudDepth
inout float atmosphereAlpha
){
#ifndef TOGGLE_VL_FOG
return vec4(0.0,0.0,0.0,1.0);
@ -266,6 +266,7 @@ vec4 GetVolumetricFog(
vec3 Atmosphere = (LightSourcePhased * sh * (rayL*rL + sunPhase*m) + AveragedAmbientColor * (rL+m) * (lightLevelZero*0.99 + 0.01)) * inACave;
color += (Atmosphere - Atmosphere * atmosphereVolumeCoeff) / (rL+m+1e-6) * atmosphereAbsorbance * totalAbsorbance;
atmosphereAbsorbance *= dot(atmosphereVolumeCoeff, vec3(0.33333));
//------------------------------------
//------ LPV FOG EFFECT
//------------------------------------
@ -335,6 +336,7 @@ vec4 GetVolumetricFog(
if (totalAbsorbance < 1e-5) break;
#endif
}
atmosphereAlpha = atmosphereAbsorbance;
return vec4(color, totalAbsorbance);
}

View File

@ -1,4 +1,4 @@
#define SHADER_VERSION_LABEL 477 // [477]
#define SHADER_VERSION_LABEL 478 // [478]
#define saturate(x) clamp(x,0.0,1.0)

View File

@ -243,7 +243,7 @@ void DoSpecularReflections(
#ifdef Sky_reflection
#ifdef OVERWORLD_SHADER
if(hasReflections) Background_Reflection = (skyCloudsFromTexLOD(L, colortex4, sqrt(Roughness) * 9.0).rgb / 30.0) * Metals ;
if(hasReflections) Background_Reflection = (skyCloudsFromTex(L, colortex4).rgb / 30.0) * Metals ;
#else
if(hasReflections) Background_Reflection = (skyCloudsFromTexLOD2(L, colortex4, sqrt(Roughness) * 6.0).rgb / 30.0) * Metals;
#endif