tiny tweak to nether slighting to make it more stable

This commit is contained in:
Xonk 2023-07-30 22:56:57 -04:00
parent b11b795160
commit 5a08247083
5 changed files with 14 additions and 39 deletions

View File

@ -8,7 +8,7 @@ const bool colortex5MipmapEnabled = true;
const bool colortex12MipmapEnabled = true;
// #ifndef Rough_reflections
// const bool colortex4MipmapEnabled = true;
const bool colortex4MipmapEnabled = true;
// #endif
const bool shadowHardwareFiltering = true;

View File

@ -156,7 +156,6 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150. ;
if(viewVector.y < -0.025) sky = sky * clamp( exp(viewVector.y) - 1.0,0.25,1.0) ;
vec4 clouds = renderClouds(mat3(gbufferModelView)*viewVector*1024.,vec2(fract(frameCounter/1.6180339887),1-fract(frameCounter/1.6180339887)), sunColor, moonColor, averageSkyCol*5.0);
sky = sky*clouds.a + clouds.rgb/5.0;
@ -164,7 +163,6 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+
vec4 VL_Fog = getVolumetricRays(mat3(gbufferModelView)*viewVector*1024., fract(frameCounter/1.6180339887), averageSkyCol);
sky = sky*VL_Fog.a + VL_Fog.rgb*20;
// if(viewVector.y < -0.025) sky *= clamp( viewVector.y,0.0,1.0) ;
gl_FragData[0] = vec4(sky,1.0);
}

View File

@ -305,6 +305,10 @@ void main() {
else Albedo.a = 0.0;
#endif
#ifdef WhiteWorld
Albedo.rgb = vec3(1.0);
#endif
////////////////////////////////
//////////////////////////////// NORMAL
////////////////////////////////

View File

@ -469,24 +469,14 @@ void main() {
// vec3 fogColor = (gl_Fog.color.rgb / max(pow(dot(gl_Fog.color.rgb,vec3(0.3333)),1.1),0.01) ) ;
// vec3 FogColor = (gl_Fog.color.rgb / max(dot(gl_Fog.color.rgb,vec3(0.3333)),0.01) );
// vec3 AmbientLightColor = skyCloudsFromTexLOD2(normal, colortex4, 6).rgb / 10.0;
vec3 AmbientLightColor = skyCloudsFromTexLOD2(normal, colortex4, 6).rgb / 10;
vec3 up = skyCloudsFromTexLOD2( vec3(0,1,0), colortex4, 6).rgb/10;
vec3 down = skyCloudsFromTexLOD2(-vec3(0,1,0), colortex4, 6).rgb/10;
vec3 left = skyCloudsFromTexLOD2( vec3(1,0,0), colortex4, 6).rgb/10;
vec3 right = skyCloudsFromTexLOD2(-vec3(1,0,0), colortex4, 6).rgb/10;
vec3 front = skyCloudsFromTexLOD2( vec3(0,0,1), colortex4, 6).rgb/10;
vec3 back = skyCloudsFromTexLOD2(-vec3(0,0,1), colortex4, 6).rgb/10;
vec3 zero = vec3(0.0);
up = mix(zero, up, pow(max( normal.y,0),2));
down = mix(zero, down, pow(max(-normal.y,0),2));
left = mix(zero, left, pow(max( normal.x,0),4));
right = mix(zero, right, pow(max(-normal.x,0),4));
front = mix(zero, front, pow(max( normal.z,0),4));
back = mix(zero, back, pow(max(-normal.z,0),4));
vec3 AmbientLightColor = up + down + left + right + front + back;
vec3 up = skyCloudsFromTexLOD2(vec3( 0, 1, 0), colortex4, 6).rgb / 10;
vec3 down = skyCloudsFromTexLOD2(vec3( 0,-1, 0), colortex4, 6).rgb / 10;
up *= pow( max( slopednormal.y, 0), 2);
down *= pow( max(-slopednormal.y, 0), 2);
AmbientLightColor += up + down;
// do all ambient lighting stuff
vec3 Indirect_lighting = DoAmbientLighting_Nether(AmbientLightColor, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, normal, np3, p3 );

View File

@ -415,40 +415,23 @@ void main() {
p3 += gbufferModelViewInverse[3].xyz;
// do all ambient lighting stuff
vec3 AO = vec3( exp( (vanilla_AO*vanilla_AO) * -5) ) ;
vec3 Indirect_lighting = DoAmbientLighting_End(gl_Fog.color.rgb, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, normal, np3) ;
// Indirect_lighting = vec3(TORCH_R,TORCH_G,TORCH_B) * curveinvert(clamp(lightmap.x,0.0,1.0),2);
// float ambientfogshadow = GetCloudShadow2(p3+cameraPosition);
// Indirect_lighting *= ambientfogshadow;
vec3 Indirect_lighting = DoAmbientLighting_End(gl_Fog.color.rgb, vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, normal, np3);
vec3 LightColor = LightSourceColor(clamp(sqrt(length(p3+cameraPosition) / 150.0 - 1.0) ,0.0,1.0));
vec3 LightPos = LightSourcePosition(p3+cameraPosition, cameraPosition);
float LightFalloff = max(exp2(4.0 + length(LightPos) / -25),0.0);
// float LightFalloff = max(1.0-length(LightPos)/255,0.0);
// LightFalloff = pow(1.0-pow(1.0-LightFalloff,0.5),2.0);
// LightFalloff *= 10.0;
// float LightFalloff = max(1.0-length(LightPos)/250,0.0);
// float N = 2.50;
// LightFalloff = pow(1.0-pow(1.0-LightFalloff,1.0/N),N);
// LightFalloff *= 10.0;
// 0.5 added because lightsources are always high radius.
float NdotL = clamp( dot(normal,normalize(-LightPos)),0.0,1.0);
NdotL = clamp((-15 + NdotL*255.0) / 240.0 ,0.0,1.0);
float fogshadow = GetCloudShadow(p3+cameraPosition, LightPos, blueNoise());
vec3 LightSource = (LightColor * max(LightColor - (1-fogshadow) ,0.0)) * LightFalloff * NdotL ;
vec3 LightSource = (LightColor * max(LightColor - (1-fogshadow) ,0.0)) * LightFalloff * NdotL;
// vec3 LightSource = LightColor * fogshadow * LightFalloff * NdotL ;
float LightFalloff2 = max(1.0-length(LightPos)/120,0.0);
LightFalloff2 = pow(1.0-pow(1.0-LightFalloff2,0.5),2.0);
LightFalloff2 *= 25;