From 72c77f55a120514929b3fc3c9402f5549bb3237e Mon Sep 17 00:00:00 2001 From: Xonk Date: Fri, 16 Jun 2023 00:01:03 -0400 Subject: [PATCH] make puddles go away in places it shouldnt be --- shaders/composite1.fsh | 13 +++++++++++-- shaders/composite1.vsh | 10 ++++++---- shaders/composite11.fsh | 2 +- shaders/composite3.fsh | 14 ++++++++++---- shaders/gbuffers_all_particles.fsh | 2 +- shaders/gbuffers_all_solid.fsh | 10 ++++++---- shaders/gbuffers_all_solid.vsh | 10 +++++++--- shaders/gbuffers_all_translucent.fsh | 6 +++++- shaders/lib/settings.glsl | 2 +- shaders/lib/volumetricClouds.glsl | 5 ++++- shaders/lib/volumetricFog.glsl | 4 +++- shaders/shaders.properties | 13 +++++++++++-- 12 files changed, 66 insertions(+), 25 deletions(-) diff --git a/shaders/composite1.fsh b/shaders/composite1.fsh index 377bf33..4b9b3da 100644 --- a/shaders/composite1.fsh +++ b/shaders/composite1.fsh @@ -1062,8 +1062,17 @@ void main() { #ifdef Seasons #ifdef Snowy_Winter - vec3 snow_p3 = p3 + cameraPosition; - float SnowPatches = densityAtPosSNOW(vec3(snow_p3.x,snow_p3.y/48.,snow_p3.z) *250); + + vec3 snow_p3 = p3 + cameraPosition ; + + snow_p3 /= 75.0; + + float resolution = 1000.; + snow_p3 = (fract(snow_p3 * resolution) / resolution) - snow_p3; + + float SnowPatches = texture2D(noisetex, snow_p3.xz).r; + // float SnowPatches = densityAtPosSNOW(snow_p3); + SnowPatches = 1.0 - clamp( exp(pow(SnowPatches,3.5) * -100.0) ,0,1); SnowPatches *= clamp(sqrt(normal.y),0,1) * clamp(pow(lightmap.y,25)*25,0,1); diff --git a/shaders/composite1.vsh b/shaders/composite1.vsh index 5a2e718..a2305be 100644 --- a/shaders/composite1.vsh +++ b/shaders/composite1.vsh @@ -72,9 +72,11 @@ void main() { WinterTimeForSnow = 0.0; - #ifdef Snowy_Winter - vec3 color1 = vec3(0.0); - vec3 color2 = color1; - YearCycleColor(color1, color2, WinterTimeForSnow); + #ifdef Seasons + #ifdef Snowy_Winter + vec3 color1 = vec3(0.0); + vec3 color2 = color1; + YearCycleColor(color1, color2, WinterTimeForSnow); + #endif #endif } diff --git a/shaders/composite11.fsh b/shaders/composite11.fsh index 4b457bd..be4695d 100644 --- a/shaders/composite11.fsh +++ b/shaders/composite11.fsh @@ -118,7 +118,7 @@ void main() { float lightleakfix = clamp(eyeBrightnessSmooth.y/240.0,0.0,1.0); - col = (mix(col,bloom,VL_abs)+bloom*lightScat)* mix(exposure.rgb,min(exposure.rgb,0.01), 0); + col = (mix(col,bloom,VL_abs)+bloom * lightScat)* mix(exposure.rgb,min(exposure.rgb,0.01), 0); //Purkinje Effect float lum = dot(col,vec3(0.15,0.3,0.55)); diff --git a/shaders/composite3.fsh b/shaders/composite3.fsh index 2b1a5c0..9819f08 100644 --- a/shaders/composite3.fsh +++ b/shaders/composite3.fsh @@ -184,7 +184,12 @@ void main() { // vec4 vl = texture2D(colortex0,texcoord * 0.5); - + ////// --------------- UNPACK OPAQUE GBUFFERS --------------- ////// + vec4 data_opaque = texture2D(colortex1,texcoord); + vec4 dataUnpacked1 = vec4(decodeVec2(data_opaque.z),decodeVec2(data_opaque.w)); // normals, lightmaps + // vec4 dataUnpacked2 = vec4(decodeVec2(data.z),decodeVec2(data.w)); + + vec2 lightmap = dataUnpacked1.yz; ////// --------------- UNPACK TRANSLUCENT GBUFFERS --------------- ////// @@ -275,11 +280,12 @@ void main() { color *= vl.a; color += vl.rgb; - float rainDrops = clamp(texture2D(colortex9,texcoord).a, 0.0,1.0); // bloomy rain effect + +// bloomy rain effect + float rainDrops = clamp(texture2D(colortex9,texcoord).a, 0.0,1.0); + if(rainDrops > 0.0) vl.a *= clamp(1.0 - pow(rainDrops*5.0,2),0.0,1.0); - - if(rainDrops > 0.0) vl.a *= clamp(1.0 - rainDrops ,0.,1.); // bloomy rain effect gl_FragData[0].r = vl.a; /// lava. diff --git a/shaders/gbuffers_all_particles.fsh b/shaders/gbuffers_all_particles.fsh index 826f573..4437baf 100644 --- a/shaders/gbuffers_all_particles.fsh +++ b/shaders/gbuffers_all_particles.fsh @@ -105,7 +105,7 @@ void main() { float cloudOcclusion = 0.0; if(TEXTURE.a > 0.0) cloudOcclusion = 1.0 - GetCloudSkyOcclusion(p3 + cameraPosition)*0.9; - gl_FragData[1].a = TEXTURE.a * cloudOcclusion; // for bloomy rain and stuff + gl_FragData[1].a = TEXTURE.a * cloudOcclusion ; // for bloomy rain and stuff #ifndef WEATHER diff --git a/shaders/gbuffers_all_solid.fsh b/shaders/gbuffers_all_solid.fsh index 07d8cbd..844a4aa 100644 --- a/shaders/gbuffers_all_solid.fsh +++ b/shaders/gbuffers_all_solid.fsh @@ -87,6 +87,7 @@ flat varying float HELD_ITEM_BRIGHTNESS; #define ENTITY_PHYSICSMOD_SNOW 829925 #endif +uniform float noPuddleAreas; // float interleaved_gradientNoise(){ @@ -262,14 +263,15 @@ void main() { float torchlightmap = lmtexcoord.z; #ifdef Hand_Held_lights - if(HELD_ITEM_BRIGHTNESS > 0.0) torchlightmap = mix(torchlightmap, HELD_ITEM_BRIGHTNESS, clamp( max(1.0-length(fragpos)/10,0.0) * 0.7 ,0.0,1.0)); + // if(HELD_ITEM_BRIGHTNESS > 0.0) torchlightmap = mix(torchlightmap, HELD_ITEM_BRIGHTNESS, clamp( max(1.0-length(fragpos)/10,0.0) * 0.7 ,0.0,1.0)); + if(HELD_ITEM_BRIGHTNESS > 0.0) torchlightmap = clamp(torchlightmap + HELD_ITEM_BRIGHTNESS * clamp( max(1.0-length(fragpos)/10,0.0) * 0.7 ,0.0,1.0),0.0,1.0); #endif float lightmap = clamp( (lmtexcoord.w-0.8) * 10.0,0.,1.); - float rainfall = rainStrength ; + float rainfall = rainStrength * noPuddleAreas; float Puddle_shape = 0.; #ifndef ENTITIES @@ -454,7 +456,7 @@ void main() { if(SpecularTex.g < 229.5/255.0) Albedo.rgb = mix(Albedo.rgb, vec3(0), Puddle_shape*porosity); #endif - vec4 data1 = clamp(encode(viewToWorld(normal), (blueNoise()*vec2(torchlightmap,lmtexcoord.w)/30.0) + vec2(torchlightmap,lmtexcoord.w)),0.,1.0); + vec4 data1 = clamp(encode(viewToWorld(normal), (blueNoise()*vec2(torchlightmap,lmtexcoord.w)/(30.0 * (1+ (1-RENDER_SCALE.x)))) + vec2(torchlightmap,lmtexcoord.w)),0.,1.0); gl_FragData[0] = vec4(encodeVec2(Albedo.x,data1.x),encodeVec2(Albedo.y,data1.y),encodeVec2(Albedo.z,data1.z),encodeVec2(data1.w,Albedo.w)); gl_FragData[1].a = 0.0; @@ -598,7 +600,7 @@ void main() { //////////////////////////////// // vec4 data1 = clamp( encode(viewToWorld(normal), (blueNoise()*lmtexcoord.zw/30.0) + lmtexcoord.zw), 0.0, 1.0); - vec4 data1 = clamp( encode(viewToWorld(normal), (blueNoise()*vec2(torchlightmap,lmtexcoord.w)/30.0) + vec2(torchlightmap,lmtexcoord.w)), 0.0, 1.0); + vec4 data1 = clamp( encode(viewToWorld(normal), (blueNoise()*vec2(torchlightmap,lmtexcoord.w)/ (30.0 * (1+ (1-RENDER_SCALE.x))) ) + vec2(torchlightmap,lmtexcoord.w)), 0.0, 1.0); gl_FragData[0] = vec4(encodeVec2(Albedo.x,data1.x), encodeVec2(Albedo.y,data1.y), encodeVec2(Albedo.z,data1.z), encodeVec2(data1.w,Albedo.w)); diff --git a/shaders/gbuffers_all_solid.vsh b/shaders/gbuffers_all_solid.vsh index 16dbb0d..9673f80 100644 --- a/shaders/gbuffers_all_solid.vsh +++ b/shaders/gbuffers_all_solid.vsh @@ -207,12 +207,14 @@ void main() { blockID = mc_Entity.x; velocity = at_velocity; + NameTags = 0; + // #ifdef ENTITIES -// NameTags = 0; // // try and single out nametag text and then discard nametag background -// if( dot(gl_Color.rgb, vec3(0.35)) < 1.0) NameTags = 1; -// if(gl_Color.a >= 0.24 && gl_Color.a <= 0.25 ) gl_Position = vec4(10,10,10,1); +// // if( dot(gl_Color.rgb, vec3(1.0/3.0)) < 1.0) NameTags = 1; +// // if(gl_Color.a < 1.0) NameTags = 1; +// // if(gl_Color.a >= 0.24 && gl_Color.a <= 0.25 ) gl_Position = vec4(10,10,10,1); // #endif @@ -220,6 +222,8 @@ void main() { /////// ----- EMISSIVE STUFF ----- /////// EMISSIVE = 0.0; + // if(NameTags > 0) EMISSIVE = 0.9; + // normal block lightsources if(mc_Entity.x == 10005) EMISSIVE = 0.3; diff --git a/shaders/gbuffers_all_translucent.fsh b/shaders/gbuffers_all_translucent.fsh index 4d51c66..04ea316 100644 --- a/shaders/gbuffers_all_translucent.fsh +++ b/shaders/gbuffers_all_translucent.fsh @@ -404,7 +404,11 @@ if (gl_FragCoord.x * texelSize.x < RENDER_SCALE.x && gl_FragCoord.y * texelSize vec3 ambientCoefs = WS_normal/dot(abs(WS_normal),vec3(1.)); float skylight = clamp(abs(ambientCoefs.y+1),0.35,2.0) ; - vec3 Indirect_lighting = DoAmbientLighting(avgAmbient, vec3(TORCH_R,TORCH_G,TORCH_B), lmtexcoord.zw, skylight); + vec2 lightmaps2 = lmtexcoord.zw; + + + + vec3 Indirect_lighting = DoAmbientLighting(avgAmbient, vec3(TORCH_R,TORCH_G,TORCH_B), lightmaps2, skylight); vec3 Direct_lighting = DoDirectLighting(lightCol.rgb/80.0, Shadows, NdotL, 0.0); vec3 FinalColor = (Direct_lighting + Indirect_lighting) * Albedo; diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index fa9c5c0..40556ac 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -30,7 +30,7 @@ #define AmbientLight_G 0.86 // [0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0] #define AmbientLight_B 1.0 // [0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.18 0.19 0.2 0.21 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 0.3 0.31 0.32 0.33 0.34 0.35 0.36 0.37 0.38 0.39 0.4 0.41 0.42 0.43 0.44 0.45 0.46 0.47 0.48 0.49 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.59 0.6 0.61 0.62 0.63 0.64 0.65 0.66 0.67 0.68 0.69 0.7 0.71 0.72 0.73 0.74 0.75 0.76 0.77 0.78 0.79 0.8 0.81 0.82 0.83 0.84 0.85 0.86 0.87 0.88 0.89 0.9 0.91 0.92 0.93 0.94 0.95 0.96 0.97 0.98 0.99 1.0] // #define BorderFog // aaaaaaaaaaaaaaaaaaaaaaa -#define MIN_LIGHT_AMOUNT 1.0 //[0.0 0.5 1.0 1.5 2.0 3.0 4.0 5.0] +#define MIN_LIGHT_AMOUNT 1.0 //[0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 4.0 5.0] // #define Glass_Tint // multiply the background through glass by the color of the glass for a strong tint. // #define ambientLight_only // THIS IS A DEBUG VIEW. turn the sunlight off. DOES NOT increase performance, the shadows are still working in the background #define SEPARATE_AO diff --git a/shaders/lib/volumetricClouds.glsl b/shaders/lib/volumetricClouds.glsl index 3fbf91c..ca84df1 100644 --- a/shaders/lib/volumetricClouds.glsl +++ b/shaders/lib/volumetricClouds.glsl @@ -23,11 +23,14 @@ uniform sampler2D colortex4;//Skybox #include "/lib/climate_settings.glsl" +// #ifdef Daily_Weather + // uniform float CloudHeight; +// #endif float CumulusHeight = Cumulus_height; float MaxCumulusHeight = CumulusHeight + 100; - float AltostratusHeight = 2000; + float rainCloudwetness = rainStrength; float cloud_movement = frameTimeCounter * Cloud_Speed; diff --git a/shaders/lib/volumetricFog.glsl b/shaders/lib/volumetricFog.glsl index 43944bb..85817a3 100644 --- a/shaders/lib/volumetricFog.glsl +++ b/shaders/lib/volumetricFog.glsl @@ -194,6 +194,8 @@ vec4 InsideACloudFog( SunColor = SunColor * clamp(dV_Sun.y ,0.0,1.0); MoonColor *= clamp(-dV_Sun.y,0.0,1.0); + if(dV_Sun.y/shadowStep < -0.1) dV_Sun = -dV_Sun; + vec3 Fog_SkyCol = SkyColor; vec3 Fog_SunCol = SunColor; @@ -295,7 +297,7 @@ vec4 InsideACloudFog( for (int j=0; j < 3; j++){ - vec3 shadowSamplePos = progress_view + (dV_Sun * 0.15) * (1 + Dither.y/2 + j); + vec3 shadowSamplePos = progress_view + (dV_Sun * 0.015) * (1 + Dither.y/2 + j); float shadow = GetCumulusDensity(shadowSamplePos, 0) * Cumulus_density; diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 600c85b..77c7019 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -201,7 +201,7 @@ screen = [Direct_Light] [World] [Ambient_light] [Fog] [Post_Processing] [Clouds] ######## moonphase based weather # in seconds... -variable.int.TransitionTime = 100 +variable.int.TransitionTime = 5 uniform.float.Cumulus_Cov = smooth(1, if( \ moonPhase == 0, 0.7, \ @@ -253,7 +253,15 @@ uniform.float.Cloudy_Den = smooth(5, if( \ moonPhase == 6, 5, \ 0 ), TransitionTime, TransitionTime) - +# uniform.float.CloudHeight = smooth(5, if( \ +# moonPhase == 0, 1.0, \ +# moonPhase == 1, 0.5, \ +# moonPhase == 2, 1.0, \ +# moonPhase == 3, 1.5, \ +# moonPhase == 4, 1.0, \ +# moonPhase == 5, 1.0, \ +# moonPhase == 6, 1.0, \ +# 1.0 ), TransitionTime, TransitionTime) # Biome uniforms @@ -271,6 +279,7 @@ 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.noPuddleAreas = smooth( 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)