From d9398d26ef4313bd31d9a8f784b9a5c3613790a4 Mon Sep 17 00:00:00 2001 From: Xonk Date: Wed, 28 Jun 2023 18:59:21 -0400 Subject: [PATCH] sandstorms, snowstorms (only in snowy mountains), make snow not exist in hot areas/low moisture areas --- shaders/composite3.fsh | 3 ++- shaders/lib/climate_settings.glsl | 38 ++++++++++++------------------- shaders/lib/volumetricFog.glsl | 12 ++++++---- shaders/shaders.properties | 27 ++++++++++++++-------- 4 files changed, 41 insertions(+), 39 deletions(-) diff --git a/shaders/composite3.fsh b/shaders/composite3.fsh index 98070d6..d9ba03a 100644 --- a/shaders/composite3.fsh +++ b/shaders/composite3.fsh @@ -50,6 +50,7 @@ uniform float blindness; uniform float darknessFactor; uniform float darknessLightFactor; + #include "lib/waterBump.glsl" #include "/lib/res_params.glsl" @@ -283,7 +284,7 @@ void main() { // underwater fog if (isEyeInWater == 1){ - float fogfade = clamp( exp(length(p3) / -10) ,0.0,1.0); + float fogfade = clamp( exp(length(fragpos) / -10) ,0.0,1.0); color.rgb = color.rgb * fogfade ; vl.a *= fogfade ; } diff --git a/shaders/lib/climate_settings.glsl b/shaders/lib/climate_settings.glsl index 59c29bb..1a0c00c 100644 --- a/shaders/lib/climate_settings.glsl +++ b/shaders/lib/climate_settings.glsl @@ -1,20 +1,6 @@ // this file contains all things for seasons, weather, and biome specific settings. // i gotta start centralizing shit someday. - -// uniform float Day; - -// // it's so symmetrical~ - -// float day0 = clamp(clamp(Day, 0.0,1.0)*clamp(2-Day, 0.0,1.0),0.0,1.0); -// float day1 = clamp(clamp(Day-1, 0.0,1.0)*clamp(3-Day, 0.0,1.0),0.0,1.0); -// float day2 = clamp(clamp(Day-2, 0.0,1.0)*clamp(4-Day, 0.0,1.0),0.0,1.0); -// float day3 = clamp(clamp(Day-3, 0.0,1.0)*clamp(5-Day, 0.0,1.0),0.0,1.0); -// float day4 = clamp(clamp(Day-4, 0.0,1.0)*clamp(6-Day, 0.0,1.0),0.0,1.0); -// float day5 = clamp(clamp(Day-5, 0.0,1.0)*clamp(7-Day, 0.0,1.0),0.0,1.0); -// float day6 = clamp(clamp(Day-6, 0.0,1.0)*clamp(8-Day, 0.0,1.0),0.0,1.0); -// float day7 = clamp(clamp(Day-7, 0.0,1.0)*clamp(9-Day, 0.0,1.0),0.0,1.0); - /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// ///////////////////////////////// SEASONS ///////////////////////////////////// @@ -26,6 +12,7 @@ #ifdef SEASONS_VSH uniform int worldDay; + uniform float noPuddleAreas; void YearCycleColor ( inout vec3 FinalColor, @@ -85,7 +72,7 @@ // this is to make snow only exist in winter float FallToWinter_snowfall = mix(0.0, 1.0, AutumnTime); float WinterToSpring_snowfall = mix(FallToWinter_snowfall, 0.0, WinterTime); - SnowySeason = clamp(pow(sin(WinterToSpring_snowfall*SeasonLength)*0.5+0.5,5),0,1) * WinterToSpring_snowfall; + SnowySeason = clamp(pow(sin(WinterToSpring_snowfall*SeasonLength)*0.5+0.5,5),0,1) * WinterToSpring_snowfall * noPuddleAreas; #else SnowySeason = 0.0; #endif @@ -160,23 +147,26 @@ #ifdef Biome_specific_environment uniform float isJungles; uniform float isSwamps; - uniform float isLush; - uniform float isDeserts; + // uniform float isLush; + // uniform float isDeserts; + + uniform float sandStorm; + uniform float snowStorm; void BiomeFogColor( inout vec3 FinalFogColor ){ // this is a little complicated? lmao vec3 BiomeColors; - BiomeColors.r = isSwamps*0.7 + isJungles*0.5; - BiomeColors.g = isSwamps*1.0 + isJungles*1.0; - BiomeColors.b = isSwamps*0.35 + isJungles*0.8; + BiomeColors.r = isSwamps*0.7 + isJungles*0.5 + sandStorm*1.0 + snowStorm*0.5; + BiomeColors.g = isSwamps*1.0 + isJungles*1.0 + sandStorm*0.5 + snowStorm*0.6; + BiomeColors.b = isSwamps*0.35 + isJungles*0.8 + sandStorm*0.3 + snowStorm*1.0; // insure the biome colors are locked to the fog shape and lighting, but not its orignal color. BiomeColors *= dot(FinalFogColor,vec3(0.21, 0.72, 0.07)); // these range 0.0-1.0. they will never overlap. - float Inbiome = isJungles+isSwamps; + float Inbiome = isJungles+isSwamps+sandStorm; // interpoloate between normal fog colors and biome colors. the transition speeds are conrolled by the biome uniforms. FinalFogColor = mix(FinalFogColor, BiomeColors, Inbiome); @@ -187,11 +177,11 @@ inout vec4 CloudyDensity ){ // these range 0.0-1.0. they will never overlap. - float Inbiome = isJungles+isSwamps; + float Inbiome = isJungles+isSwamps+sandStorm+snowStorm; vec2 BiomeFogDensity; // x = uniform || y = cloudy - BiomeFogDensity.x = isSwamps*1 + isJungles*5; - BiomeFogDensity.y = isSwamps*5 + isJungles*2; + BiomeFogDensity.x = isSwamps*1 + isJungles*5 + sandStorm*15 + snowStorm*15; + BiomeFogDensity.y = isSwamps*5 + isJungles*2 + sandStorm*255 + snowStorm*100; UniformDensity = mix(UniformDensity, vec4(BiomeFogDensity.x), Inbiome); CloudyDensity = mix(CloudyDensity, vec4(BiomeFogDensity.y), Inbiome); diff --git a/shaders/lib/volumetricFog.glsl b/shaders/lib/volumetricFog.glsl index 52408e8..2fe93dd 100644 --- a/shaders/lib/volumetricFog.glsl +++ b/shaders/lib/volumetricFog.glsl @@ -30,19 +30,22 @@ float cloudVol(in vec3 pos){ float mult = exp( -max((pos.y - SEA_LEVEL) / 35.,0.0)); - - float fog_shape = 1.0 - densityAtPosFog(samplePos * 24.0); - float fog_eroded = 1.0 - densityAtPosFog( samplePos2 * 200.0); + float fog_shape = 1.0 - densityAtPosFog(samplePos * 24.0 ); + float fog_eroded = 1.0 - densityAtPosFog(samplePos2 * 200.0 ); // float CloudyFog = max( (fog_shape*2.0 - fog_eroded*0.5) - 1.2, max(fog_shape-0.8,0.0)) * mult; float heightlimit = exp2( -max((pos.y - SEA_LEVEL) / 25.,0.0)); float CloudyFog = max((fog_shape*1.2 - fog_eroded*0.2) - 0.75,0.0) * heightlimit ; + float UniformFog = exp2( -max((pos.y - SEA_LEVEL) / 25.,0.0)); float RainFog = max(fog_shape*10. - 7.,0.5) * exp2( -max((pos.y - SEA_LEVEL) / 25.,0.0)) * 5. * rainStrength * noPuddleAreas * RainFog_amount; + // sandstorms and snowstorms + if(sandStorm > 0 || snowStorm > 0) CloudyFog = mix(CloudyFog, max(densityAtPosFog((samplePos2 - vec3(frameTimeCounter,0,frameTimeCounter)*10) * 100.0 ) - 0.2,0.0) * heightlimit, sandStorm+snowStorm); + TimeOfDayFog(UniformFog, CloudyFog); return CloudyFog + UniformFog + RainFog; @@ -229,6 +232,7 @@ vec4 InsideACloudFog( vec3 lightningColor = vec3(Lightning_R,Lightning_G,Lightning_B) * 255.0 * lightningFlash * max(eyeBrightnessSmooth.y,0)/240.; + #ifdef ReflectedFog lightningColor *= 0.01; #endif @@ -313,7 +317,7 @@ vec4 InsideACloudFog( vec3 AtmosphericFog = Fog_SkyCol * (rL+m) ; // extra fog effects - vec3 rainRays = ((Fog_SunCol/5)*Shadows_for_Fog) * (rayL*phaseg(SdotV,0.5)) * clamp(pow(WsunVec.y,5)*2,0.0,1.0) * rainStrength * noPuddleAreas * RainFog_amount; + vec3 rainRays = ((Fog_SunCol/5)*Shadows_for_Fog) * (rayL*phaseg(SdotV,0.7)) * clamp(pow(WsunVec.y,5)*2,0.0,1.0) * rainStrength * noPuddleAreas * RainFog_amount; vec3 CaveRays = (Fog_SunCol*Shadows_for_Fog) * phaseg(SdotV,0.7) * 0.001 * (1.0 - lightleakfix); vec3 vL0 = (DirectLight + AmbientLight + AtmosphericFog + rainRays ) * lightleakfix ; diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 6ef1aac..1efb662 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -267,21 +267,28 @@ uniform.float.Cloudy_Den = smooth(5, if( \ # Biome uniforms -uniform.float.isJungles = smooth(6, if(in(biome,23,24,25), 1,0), 25,25) -uniform.float.isSwamps = smooth(7, if(in(biome,6,7), 1,0), 25,25) + +variable.int.BiomeTransitionTime = 30 + +uniform.float.isJungles = smooth(6, if(in(biome,23,24,25), 1,0), BiomeTransitionTime,BiomeTransitionTime) +uniform.float.isSwamps = smooth(7, if(in(biome,6,7), 1,0), BiomeTransitionTime,BiomeTransitionTime) + +uniform.float.noPuddleAreas = smooth(8, if(in(biome,5,16,17,18,26, 27, 28, 3, 4, 16,31,32,33,34, 37, 39, 48), 0,1), 5,5) + +uniform.float.sandStorm = smooth(9, if(in(biome,5,26,27,28), rainStrength,0), 5,5) +uniform.float.snowStorm = smooth(10, if(in(biome,31,32,33,34), rainStrength,0), 5,5) -uniform.float.isLush = smooth(8, if(in(biome,10,50), 1,0), 25,25) -uniform.float.isDeserts = smooth(9, if(in(biome,5), 1,0), 25,25) +# uniform.float.isLush = smooth(8, if(in(biome,10,50), 1,0), BiomeTransitionTime,BiomeTransitionTime) +# uniform.float.isDeserts = smooth(9, if(in(biome,5), 1,0), BiomeTransitionTime,BiomeTransitionTime) -uniform.float.isWastes = smooth(10, if(in(biome,51), 1,0), 5, 5) -uniform.float.isWarpedForest = smooth(11, if(in(biome,52), 1,0), 5, 5) -uniform.float.isCrimsonForest = smooth(12, if(in(biome,53), 1,0), 5, 5) -uniform.float.isSoulValley = smooth(13, if(in(biome,54), 1,0), 5, 5) -uniform.float.isBasaltDelta = smooth(14, if(in(biome,55), 1,0), 5, 5) +# uniform.float.isWastes = smooth(10, if(in(biome,51), 1,0), BiomeTransitionTime, BiomeTransitionTime) +# uniform.float.isWarpedForest = smooth(11, if(in(biome,52), 1,0), BiomeTransitionTime, BiomeTransitionTime) +# uniform.float.isCrimsonForest = smooth(12, if(in(biome,53), 1,0), BiomeTransitionTime, BiomeTransitionTime) +# uniform.float.isSoulValley = smooth(13, if(in(biome,54), 1,0), BiomeTransitionTime, BiomeTransitionTime) +# uniform.float.isBasaltDelta = smooth(14, if(in(biome,55), 1,0), BiomeTransitionTime, BiomeTransitionTime) -uniform.float.noPuddleAreas = smooth(15, if(in(biome,5,16,17,18,26, 27, 28, 3, 4, 16, 37, 39, 48), 0,1), 5,5) # uniform.float.ifEndBoss = smooth(if(bossBattle == 2, 1, 0 ), 1, 1)