smaller water fog tweaks. fix wrong normal usage in some parts of forward rendering

This commit is contained in:
Xonk
2025-03-11 18:50:00 -04:00
parent 196f0c2fcc
commit 01387e8720
4 changed files with 29 additions and 122 deletions

View File

@ -517,6 +517,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
TangentNormal = NormalTex.xy;
normal = applyBump(tbnMatrix, NormalTex.xyz, 1.0);
worldSpaceNormal = normalize(viewToWorld(normal).xyz);
// TangentNormal = clamp(TangentNormal + (blueNoise()*2.0-1.0)*0.005,-1.0,1.0);
float nameTagMask = 0.0;
@ -605,7 +606,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
#endif
#ifdef NETHER_SHADER
Indirect_lighting = volumetricsFromTex(normalize(worldSpaceNormal), colortex4, 0).rgb / 1200.0 / 1.5;
Indirect_lighting = volumetricsFromTex(worldSpaceNormal, colortex4, 0).rgb / 1200.0 / 1.5;
#endif
#ifdef END_SHADER
@ -634,12 +635,12 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
#ifdef IS_LPV_ENABLED
vec3 normalOffset = vec3(0.0);
if (any(greaterThan(abs(worldSpaceNormal), vec3(1.0e-6))))
if (any(greaterThan(abs(viewToWorld(normalMat.xyz).xyz), vec3(1.0e-6))))
normalOffset = 0.5*worldSpaceNormal;
#if LPV_NORMAL_STRENGTH > 0
if (any(greaterThan(abs(normal), vec3(1.0e-6)))) {
vec3 texNormalOffset = -normalOffset + viewToWorld(normal);
vec3 texNormalOffset = -normalOffset + worldSpaceNormal;
normalOffset = mix(normalOffset, texNormalOffset, (LPV_NORMAL_STRENGTH*0.01));
}
#endif
@ -653,7 +654,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
vec4 flashLightSpecularData = vec4(0.0);
#ifdef FLASHLIGHT
Indirect_lighting += calculateFlashlight(FragCoord.xy*texelSize/RENDER_SCALE, viewPos, vec3(0.0), viewToWorld(normalize(normal)), flashLightSpecularData, false);
Indirect_lighting += calculateFlashlight(FragCoord.xy*texelSize/RENDER_SCALE, viewPos, vec3(0.0), worldSpaceNormal, flashLightSpecularData, false);
#endif
vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo;
@ -708,7 +709,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
#endif
vec3 specularReflections = specularReflections(viewPos, normalize(feetPlayerPos), WsunVec, vec3(blueNoise(), vec2(interleaved_gradientNoise_temporal())), viewToWorld(normal), roughness, f0, Albedo, FinalColor*gl_FragData[0].a, DirectLightColor * Shadows, lightmap.y, isHand, reflectance, flashLightSpecularData);
vec3 specularReflections = specularReflections(viewPos, normalize(feetPlayerPos), WsunVec, vec3(blueNoise(), vec2(interleaved_gradientNoise_temporal())), worldSpaceNormal, roughness, f0, Albedo, FinalColor*gl_FragData[0].a, DirectLightColor * Shadows, lightmap.y, isHand, reflectance, flashLightSpecularData);
gl_FragData[0].a = gl_FragData[0].a + (1.0-gl_FragData[0].a) * reflectance;
@ -748,7 +749,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 )
if(gl_FragCoord.x*texelSize.x < 0.47) gl_FragData[0] = vec4(0.0);
#endif
#if DEBUG_VIEW == debug_NORMALS
gl_FragData[0].rgb = viewToWorld(normalize(normal.xyz)) * 0.1;
gl_FragData[0].rgb = worldSpaceNormal * 0.1;
gl_FragData[0].a = 1;
#endif
#if DEBUG_VIEW == debug_INDIRECT