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

@ -412,7 +412,9 @@ void main() {
#endif
#ifdef OVERWORLD_SHADER
vec4 VolumetricFog = GetVolumetricFog(viewPos0, vec2(noise_2,noise_1), directLightColor, indirectLightColor, averageSkyCol_Clouds/30.0, cloudDepth);
float atmosphereAlpha = 1.0;
vec4 VolumetricFog = GetVolumetricFog(viewPos0, vec2(noise_2,noise_1), directLightColor, indirectLightColor, averageSkyCol_Clouds/30.0, atmosphereAlpha);
VolumetricClouds.a *= atmosphereAlpha;
#endif
#if defined NETHER_SHADER || defined END_SHADER
@ -420,7 +422,7 @@ void main() {
#endif
#if defined OVERWORLD_SHADER && defined CLOUDS_INTERSECT_TERRAIN
VolumetricFog = vec4(VolumetricClouds.rgb * VolumetricFog.a + VolumetricFog.rgb, VolumetricFog.a);
VolumetricFog = vec4(VolumetricClouds.rgb * VolumetricFog.a * atmosphereAlpha + VolumetricFog.rgb, VolumetricFog.a);
#endif
gl_FragData[0] = clamp(VolumetricFog, 0.0, 65000.0);

View File

@ -473,6 +473,8 @@ void main() {
vl.a = 1.0;
}
#endif
// if(texcoord.x > 0.5 )color.rgb = skyCloudsFromTex(np3, colortex4).rgb/30.0;
gl_FragData[0].r = bloomyFogMult; // pass fog alpha so bloom can do bloomy fog
gl_FragData[1].rgb = clamp(color.rgb, 0.0,68000.0);

View File

@ -278,25 +278,23 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition) ;// * ( float(sunElevation > 1e-5)*2.0-1.0 );
vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.0;
sky = mix(dot(sky, vec3(0.333)) * vec3(0.5), sky, pow(clamp(viewVector.y+1.0,0.0,1.0),5));
vec3 suncol = lightSourceColor;
#ifdef ambientLight_only
suncol = vec3(0.0);
#endif
vec3 cloudDepth = vec3(0.0);
vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol*2.0, skyGroundCol/30.0, cloudDepth);
float atmosphereAlpha = 1.0;
vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol*2.0, skyGroundCol/30.0, averageSkyCol_Clouds*5.0, atmosphereAlpha);
vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol*2.0, skyGroundCol/30.0,cloudDepth);
sky = sky*clouds.a + clouds.rgb / 5.0;
sky = mix(dot(sky, vec3(0.333)) * vec3(0.5), sky, pow(clamp(viewVector.y+1.0,0.0,1.0),5));
vec4 VL_Fog = GetVolumetricFog(mat3(gbufferModelView)*viewVector*1024., vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), suncol*1.75, skyGroundCol/30.0, averageSkyCol_Clouds/30.0,cloudDepth);
sky = sky*clouds.a + clouds.rgb / 5.0;
sky *= atmosphereAlpha;
sky = sky * VL_Fog.a + VL_Fog.rgb / 5.0;
// if(p.y < 0.05) sky = averageSkyCol_Clouds;
gl_FragData[0] = vec4(sky,1.0);
}
#endif

View File

@ -379,10 +379,12 @@ void main() {
VolumetricClouds = renderClouds(viewPos1, vec2(noise_1,noise_2), directLightColor, indirectLightColor, cloudDepth);
#endif
VolumetricFog2 = GetVolumetricFog(viewPos1, vec2(noise_1, noise_2), directLightColor, indirectLightColor,indirectLightColor_dynamic,cloudDepth);
float atmosphereAlpha = 1.0;
VolumetricFog2 = GetVolumetricFog(viewPos1, vec2(noise_1, noise_2), directLightColor, indirectLightColor,indirectLightColor_dynamic, atmosphereAlpha);
VolumetricClouds.a *= atmosphereAlpha;
#if defined CLOUDS_INTERSECT_TERRAIN
VolumetricFog2 = vec4(VolumetricClouds.rgb * VolumetricFog2.a + VolumetricFog2.rgb, VolumetricFog2.a*VolumetricClouds.a);
VolumetricFog2 = vec4(VolumetricClouds.rgb * VolumetricFog2.a * atmosphereAlpha + VolumetricFog2.rgb, VolumetricFog2.a*VolumetricClouds.a);
#endif
}
#endif