From 4ad17fc9aa6bfa04d7f6598341dab26d052221d6 Mon Sep 17 00:00:00 2001 From: Xonk Date: Wed, 10 Jan 2024 19:47:27 -0500 Subject: [PATCH] add "atmosphere ground" setting. this is to make the dark bottom of the sky optional. --- shaders/dimensions/composite3.fsh | 10 ++++++++-- shaders/dimensions/deferred.fsh | 1 - shaders/lang/en_us.lang | 3 +++ shaders/lib/ROBOBO_sky.glsl | 7 ++++++- shaders/lib/settings.glsl | 1 + shaders/lib/volumetricClouds.glsl | 14 ++++++++++++-- shaders/shaders.properties | 20 +++----------------- 7 files changed, 33 insertions(+), 23 deletions(-) diff --git a/shaders/dimensions/composite3.fsh b/shaders/dimensions/composite3.fsh index 370626c..97abef8 100644 --- a/shaders/dimensions/composite3.fsh +++ b/shaders/dimensions/composite3.fsh @@ -254,8 +254,14 @@ void main() { if(z >= 1.0 || isEyeInWater != 0) fog = 0.0; if(lightleakfixfast < 1.0) fog *= lightleakfix; + + #ifdef SKY_GROUND + vec3 borderFogColor = skyGroundColor; + #else + vec3 borderFogColor = skyFromTex(np3, colortex4)/30.0; + #endif - color.rgb = mix(color.rgb, skyGroundColor, fog); + color.rgb = mix(color.rgb, borderFogColor, fog); #endif if (TranslucentShader.a > 0.0){ @@ -266,7 +272,7 @@ void main() { color = color*(1.0-TranslucentShader.a) + TranslucentShader.rgb; #ifdef BorderFog - color.rgb = mix(color.rgb, skyGroundColor, fog); + color.rgb = mix(color.rgb, borderFogColor, fog); #endif } diff --git a/shaders/dimensions/deferred.fsh b/shaders/dimensions/deferred.fsh index 5fac5e5..4824685 100644 --- a/shaders/dimensions/deferred.fsh +++ b/shaders/dimensions/deferred.fsh @@ -277,7 +277,6 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+ vec3 temp = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy),0).rgb; vec3 curr = gl_FragData[0].rgb*150.; - gl_FragData[0].rgb = clamp(mix(temp, curr, mixhistory),0.0,65000.); diff --git a/shaders/lang/en_us.lang b/shaders/lang/en_us.lang index 1282de4..f4bf3b2 100644 --- a/shaders/lang/en_us.lang +++ b/shaders/lang/en_us.lang @@ -499,6 +499,7 @@ screen.Post_Processing.comment = Configure settings for all post processing effe option.SCALE_FACTOR.comment = Configure from what fraction of your resolution to upscale from. Below 0.5 is not recommended at all i only have it as an option because it's funny :P option.RESOURCEPACK_SKY.comment = Toggle resourcepack sky support. Configure settings to use the whole resourcepack sky, or keep the shader's sun and moon. §aPERFORMANCE COST:§r very low +option.SKY_GROUND = Atmosphere ground option.MATERIAL_AO.comment = Toggle the use of ambient occlusion based on what the resourcepack provides. §aPERFORMANCE COST:§r very low option.WATER_WAVE_STRENGTH.comment = configure how strong the waves appear. @@ -521,3 +522,5 @@ option.CloudLayer2.comment = Toggle the layer of clouds that are very h option.CloudLayer2_coverage.comment = Configure how much of the sky these clouds cover. option.CloudLayer2_density.comment = Configure how dense, or thick these clouds are. option.CloudLayer2_height.comment = Configure the height at which these clouds fly at. §cTHESE CANNOT BE LOWER THAN THE LARGE CLOUDS§r + +option.SKY_GROUND.comment = §bWhat is this?§r This is the dark bottom half of the sky that WOULD be the ground, if minecraft had infinite render distance. §aPERFORMANCE COST:§r very very low. §cdisabling this is very slightly slower than having it on due to extra math.§r diff --git a/shaders/lib/ROBOBO_sky.glsl b/shaders/lib/ROBOBO_sky.glsl index 341b678..eebd1a7 100644 --- a/shaders/lib/ROBOBO_sky.glsl +++ b/shaders/lib/ROBOBO_sky.glsl @@ -95,7 +95,12 @@ vec3 sky_transmittance(vec3 position, vec3 direction, const float steps) { vec3 calculateAtmosphere(vec3 background, vec3 viewVector, vec3 upVector, vec3 sunVector, vec3 moonVector, out vec2 pid, out vec3 transmittance, const int iSteps, float noise) { const int jSteps = 4; - float planetGround = exp(-100 * pow(max(-viewVector.y*5 + 0.1,0.0),2)); // darken the ground in the sky. + #ifdef SKY_GROUND + float planetGround = exp(-100 * pow(max(-viewVector.y*5 + 0.1,0.0),2)); // darken the ground in the sky. + #else + float planetGround = pow(clamp(viewVector.y+1.0,0.0,1.0),2); // darken the ground in the sky. + #endif + float GroundDarkening = max(planetGround * 0.7+0.3,clamp(sunVector.y*2.0,0.0,1.0)); vec3 viewPos = (sky_planetRadius + eyeAltitude) * upVector; diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index eb1318c..f93ad6b 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -319,6 +319,7 @@ uniform int moonPhase; #endif +#define SKY_GROUND //////////////////////////////////////// diff --git a/shaders/lib/volumetricClouds.glsl b/shaders/lib/volumetricClouds.glsl index f36cd8d..d550f7e 100644 --- a/shaders/lib/volumetricClouds.glsl +++ b/shaders/lib/volumetricClouds.glsl @@ -434,8 +434,13 @@ vec4 renderClouds( // use this to blend into the atmosphere's ground. vec3 approxdistance = normalize(dV_view); - float distantfog = mix(1.0, max(1.0 - clamp(exp2(pow(abs(approxdistance.y),1.5) * -35.0),0.0,1.0),0.0), heightRelativeToClouds); - // distantfog = 1; + #ifdef SKY_GROUND + float distantfog = mix(1.0, max(1.0 - clamp(exp2(pow(abs(approxdistance.y),1.5) * -35.0),0.0,1.0),0.0), heightRelativeToClouds); + #else + float distantfog = 1.0; + float distantfog2 = mix(1.0, max(1.0 - clamp(exp(pow(abs(approxdistance.y),1) * -35.0),0.0,1.0),0.0), heightRelativeToClouds); + #endif + // terrible fake rayleigh scattering vec3 rC = vec3(sky_coefficientRayleighR*1e-6, sky_coefficientRayleighG*1e-5, sky_coefficientRayleighB*1e-5)*3; float atmosphere = exp(abs(approxdistance.y) * -5.0); @@ -538,6 +543,11 @@ vec4 renderClouds( if(!below_Layer2) color = color * layer2.a + layer2.rgb; #endif + #ifndef SKY_GROUND + color = color * distantfog2; + total_extinction = mix(1.0, total_extinction, distantfog2); + #endif + return vec4(color, total_extinction); // return mix(vec4(color, total_extinction),vec4(0.0,0.0,0.0,1.0),exp(abs(approxdistance.y) * -1) * (1-clamp(1.0-max(cameraPosition.y - LAYER2_HEIGHT,0.0) / 1000.0 ,0.0,1.0))); } diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 4568777..8bf708b 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -123,7 +123,7 @@ PhysicsMod_support [LabPBR] ######## WORLD screen.World.columns=1 - screen.World = [Water] [Waving_Stuff] [LabPBR] RESOURCEPACK_SKY AEROCHROME_MODE AEROCHROME_PINKNESS AEROCHROME_WOOL_ENABLED + screen.World = [Water] [Waving_Stuff] [LabPBR] SKY_GROUND RESOURCEPACK_SKY AEROCHROME_MODE AEROCHROME_PINKNESS AEROCHROME_WOOL_ENABLED ### SPECULARS screen.Reflections.columns=2 screen.Reflections = Specular_Reflections Sun_specular_Strength Screen_Space_Reflections reflection_quality Rough_reflections Roughness_Threshold Sky_reflection Dynamic_SSR_quality @@ -169,15 +169,9 @@ PhysicsMod_support [LabPBR] ######## ATMOSPHERICS - screen.Atmospherics.columns=1 - screen.Atmospherics = [Sky] [Fog] [Clouds] Altostratus Cumulus_Clouds Allow_Vanilla_sky - - ### SKY - screen.Sky.columns=1 - screen.Sky = [Sky_coefficients] [Sun_and_Moon_Colors] sunPathRotation - screen.Sky_coefficients.columns=1 - screen.Sky_coefficients = Sky_Brightness sky_mieg sky_coefficientRayleighR sky_coefficientRayleighG sky_coefficientRayleighB sky_coefficientMieR sky_coefficientMieG sky_coefficientMieB + # screen.Sky_coefficients.columns=1 + # screen.Sky_coefficients = Sky_Brightness sky_mieg sky_coefficientRayleighR sky_coefficientRayleighG sky_coefficientRayleighB sky_coefficientMieR sky_coefficientMieG sky_coefficientMieB ### CLOUDS screen.Clouds.columns = 3 @@ -190,16 +184,8 @@ PhysicsMod_support [LabPBR] CloudLayer0_density CloudLayer1_density CloudLayer2_density \ CloudLayer0_height CloudLayer1_height CloudLayer2_height - ### FOG screen.Fog.columns=2 - - # screen.Fog = VL_RENDER_RESOLUTION VL_SAMPLES FOG_START_HEIGHT \ - # Haze_amount RainFog_amount BLOOMY_FOG \ - # BorderFog PER_BIOME_ENVIRONMENT RAYMARCH_CLOUDS_WITH_FOG \ - # [Cave_Fog] [TOD_fog] [END_AND_NETHER_FOG] - - screen.Fog = VL_RENDER_RESOLUTION VL_SAMPLES \ FOG_START_HEIGHT BLOOMY_FOG \ \