diff --git a/shaders/lib/nether_fog.glsl b/shaders/lib/nether_fog.glsl index 8a49d85..e2efd0f 100644 --- a/shaders/lib/nether_fog.glsl +++ b/shaders/lib/nether_fog.glsl @@ -13,27 +13,27 @@ float densityAtPosFog(in vec3 pos){ } float cloudVol(in vec3 pos){ - + float Output = 0.0; vec3 samplePos = pos*vec3(1.0,1./48.,1.0); - float finalfog = exp(max(100-pos.y,0.0) / -15) ; + float Wind = pow(max(pos.y-30,0.0) / 15.0,2.1); - float floorfog = pow(exp(max(pos.y-30,0.0) / -3.0),2); + float Plumes = texture2D(noisetex, (samplePos.xz + Wind)/256.0).b; + float floorPlumes = clamp(0.3 - exp(Plumes * -6),0,1); + Plumes *= Plumes; + float Erosion = densityAtPosFog(samplePos * 400 - frameTimeCounter*10 - Wind*10) *0.7+0.3 ; - float wind = pow(max(pos.y - 30,0.0) / 15.0,2.1); + // float maxdist = clamp((12 * 8) - length(pos - cameraPosition),0.0,1.0); - float noise_1 = pow(1-texture2D(noisetex, samplePos.xz/256.0 + wind/200).b,2.0); - float noise_2 = pow(densityAtPosFog(samplePos*256 - frameTimeCounter*10 + wind*10),1) * 0.75 +0.25; + float RoofToFloorDensityFalloff = exp(max(100-pos.y,0.0) / -15); + float FloorDensityFalloff = pow(exp(max(pos.y-31,0.0) / -3.0),2); + float RoofDensityFalloff = exp(max(120-pos.y,0.0) / -10); - float rooffog = exp(max(100-pos.y,0.0) / -5); - - float maxdist = clamp((12 * 8) - length(pos - cameraPosition),0.0,1.0); - - finalfog = max((finalfog - noise_1*noise_2 - rooffog) * maxdist, max(floorfog - noise_2*0.2,0.0)) ; + Output = max((RoofToFloorDensityFalloff - Plumes * (1.0-Erosion)) * 2.0, clamp((FloorDensityFalloff - floorPlumes*0.5) * Erosion ,0.0,1.0) ); - return finalfog; + return Output; } vec4 GetVolumetricFog( @@ -72,23 +72,24 @@ vec4 GetVolumetricFog( float dd = pow(expFactor, float(i+dither)/float(SAMPLES)) * log(expFactor) / float(SAMPLES)/(expFactor-1.0); vec3 progress = start.xyz + d*dV; vec3 progressW = gbufferModelViewInverse[3].xyz+cameraPosition + d*dVWorld; - - float Density = cloudVol(progressW); - Density *= exp(max(progressW.y-80,0.0) / -5); - + + // do main lighting + float Density = cloudVol(progressW) * pow(exp(max(progressW.y-65,0.0) / -15),2); + float fireLight = cloudVol(progressW - vec3(0,1,0)); + + vec3 vL0 = vec3(1.0,0.5,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 float Air = 0.01; - - // vec3 vL0 = vec3(TORCH_R,TORCH_G,TORCH_B) * exp(max(progressW.y-30,0.0) / -10.0); - vec3 vL0 = vec3(TORCH_R,TORCH_G,TORCH_B) * exp(Density * -50) * exp(max(progressW.y-30,0.0) / -10.0)*25 ; - - vL0 += (vec3(0.5,0.5,1.0)/ 5) * exp(max(100-progressW.y,0.0) / -15.0) * (1.0 - exp(Density * -1)); - vec3 vL1 = fogcolor / 20.0; vL += (vL0 - vL0*exp(-Density*dd*dL)) * absorbance; vL += (vL1 - vL1*exp(-Air*dd*dL)) * absorbance; absorbance *= exp(-(Density+Air)*dd*dL); + + if (absorbance < 1e-5) break; } return vec4(vL,absorbance); } \ No newline at end of file diff --git a/shaders/lib/specular.glsl b/shaders/lib/specular.glsl index 9bf3363..0285c0a 100644 --- a/shaders/lib/specular.glsl +++ b/shaders/lib/specular.glsl @@ -76,7 +76,7 @@ vec3 rayTraceSpeculars(vec3 dir, vec3 position, float dither, float quality, boo direction.xy = normalize(direction.xy); //get at which length the ray intersects with the edge of the screen - vec3 maxLengths = (step(0.,direction)-clipPosition) / direction; + vec3 maxLengths = (step(0.0,direction)-clipPosition) / direction; float mult = min(min(maxLengths.x,maxLengths.y),maxLengths.z); vec3 stepv = direction * mult / quality*vec3(RENDER_SCALE,1.0); @@ -87,9 +87,9 @@ vec3 rayTraceSpeculars(vec3 dir, vec3 position, float dither, float quality, boo float maxZ = spos.z; spos.xy += TAA_Offset*texelSize*0.5/RENDER_SCALE; - float depthcancleoffset = pow(1.0-(quality/reflection_quality),1); + float depthcancleoffset = pow(1.0-(quality/reflection_quality),1.0); - float dist = 1.0 + clamp(position.z*position.z/50.0,0,2); // shrink sample size as distance increases + float dist = 1.0 + clamp(position.z*position.z/50.0,0.0,2.0); // shrink sample size as distance increases for (int i = 0; i <= int(quality); i++) { vec2 testthing = hand ? spos.xy*texelSize : spos.xy/texelSize/4.0; // fix for ssr on hand diff --git a/shaders/world-1/composite2.fsh b/shaders/world-1/composite2.fsh index b1c01e9..1332371 100644 --- a/shaders/world-1/composite2.fsh +++ b/shaders/world-1/composite2.fsh @@ -15,6 +15,7 @@ flat varying vec2 TAA_Offset; flat varying float tempOffsets; const bool colortex5MipmapEnabled = true; +const bool colortex4MipmapEnabled = true; uniform sampler2D colortex0;//clouds uniform sampler2D colortex1;//albedo(rgb),material(alpha) RGBA16