Better ambient light for the nether. slightly better specular reflection of fog for the end

This commit is contained in:
Xonk
2023-07-29 21:26:04 -04:00
parent 234b55070a
commit 6d73d842cf
10 changed files with 80 additions and 38 deletions

View File

@ -44,11 +44,9 @@ vec3 DoAmbientLighting_Nether(vec3 FogColor, vec3 TorchColor, float Lightmap, ve
LavaGlow *= clamp(exp2(-max((WorldPos.y - 50.0) / 5,0.0)),0.0,1.0);
LavaGlow *= pow(Lightmap,0.2);
vec3 FogTint = FogColor*clamp(1.1 + dot(Normal,np3),0.0,1.0) * 0.05;
FogColor = max(FogColor, vec3(0.05) * (MIN_LIGHT_AMOUNT*0.01 + nightVision*0.5) );
vec3 AmbientLight = max(vec3(0.05), (MIN_LIGHT_AMOUNT*0.01 + nightVision*0.5) );
return AmbientLight + FogTint + TorchLight + LavaGlow;
return FogColor + TorchLight ;
}
#endif

View File

@ -58,7 +58,7 @@ vec4 GetVolumetricFog(
vec3 dV = fragposition-start;
vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz);
float maxLength = min(length(dVWorld),far)/length(dVWorld);
float maxLength = min(length(dVWorld),far*25)/length(dVWorld);
dV *= maxLength;
dVWorld *= maxLength;
@ -80,7 +80,8 @@ vec4 GetVolumetricFog(
vec3 vL0 = vec3(1.0,0.4,0.2) * exp(fireLight * -25) * exp(max(progressW.y-30,0.0) / -10) * 25;
vL0 += vec3(0.8,0.8,1.0) * (1.0 - exp(Density * -1)) / 10 ;
// do background fog lighting
// do background fog lighting
float Air = 0.01;
vec3 vL1 = fogcolor / 20.0;

View File

@ -9,6 +9,7 @@ vec2 sphereToCarte(vec3 dir) {
float lonlat = atan(-dir.x, -dir.z);
return vec2(lonlat * (0.5/pi) +0.5,0.5*dir.y+0.5);
}
vec3 skyFromTex(vec3 pos,sampler2D sampler){
vec2 p = sphereToCarte(pos);
return texture2D(sampler,p*texelSize*256.+vec2(18.5,1.5)*texelSize).rgb;
@ -17,6 +18,8 @@ vec3 skyFromTexLOD(vec3 pos,sampler2D sampler, float LOD){
vec2 p = sphereToCarte(pos);
return texture2DLod(sampler,p*texelSize*256.+vec2(18.5,1.5)*texelSize,LOD).rgb;
}
float w0(float a)
{
return (1.0/6.0)*(a*(a*(-a + 3.0) - 3.0) + 1.0);
@ -87,5 +90,14 @@ vec4 skyCloudsFromTex(vec3 pos,sampler2D sampler){
}
vec4 skyCloudsFromTexLOD(vec3 pos,sampler2D sampler, float LOD){
vec2 p = sphereToCarte(pos);
return texture2DLod(sampler,p*texelSize*256.+vec2(18.5+257.,1.5)*texelSize,LOD);
}
return texture2DLod(sampler,p*texelSize*256. + vec2(18.5 + 257., 1.5)*texelSize,LOD);
}
// vec2 p = clamp(floor(gl_FragCoord.xy-vec2(18.+257,1.))/256.+tempOffsets/256.,0.0,1.0);
// vec2 p = clamp(floor(gl_FragCoord.xy-vec2(256*0.75,256*0.25))/150.+tempOffsets/150.,0.0,1.0);
// vec2 p = clamp(floor(gl_FragCoord.xy-fogPos)/256.+tempOffsets/256.,-0.33,1.0);
vec4 skyCloudsFromTexLOD2(vec3 pos,sampler2D sampler, float LOD){
vec2 p = sphereToCarte(pos);
return texture2DLod(sampler,p*texelSize*256. + vec2(256.0 - 256.0*0.12,1.5)*texelSize,LOD);
}

View File

@ -230,8 +230,13 @@ void DoSpecularReflections(
// --------------- BACKGROUND REFLECTIONS
// apply background reflections to the final color. make sure it does not exist based on the lightmap
#ifdef Sky_reflection
if(hasReflections) Background_Reflection = (skyCloudsFromTexLOD(L, colortex4, sqrt(Roughness) * 9.0).rgb / 30.0) * Metals;
#ifndef OVERWORLD
if(hasReflections) Background_Reflection = (skyCloudsFromTexLOD2(L, colortex4, sqrt(Roughness) * 6.0).rgb / 30.0) * Metals;
#else
if(hasReflections) Background_Reflection = (skyCloudsFromTexLOD(L, colortex4, sqrt(Roughness) * 9.0).rgb / 30.0) * Metals;
#endif
// take fresnel and lightmap levels into account and write to the final color
Final_Reflection = mix_vec3(Output, Background_Reflection, Lightmap * RayContribution);
#endif