From cfbdedfd4c31f48d1992c0bdb4ce2ba51d2a07f2 Mon Sep 17 00:00:00 2001 From: Xonk Date: Fri, 21 Jun 2024 15:07:03 -0400 Subject: [PATCH] make cave fog falloff do stuff. add option to use old cave detection methods --- shaders/dimensions/composite3.fsh | 2 +- shaders/lib/settings.glsl | 35 +++++++++++++++---------------- shaders/shaders.properties | 34 +++++++++++++++++------------- 3 files changed, 37 insertions(+), 34 deletions(-) diff --git a/shaders/dimensions/composite3.fsh b/shaders/dimensions/composite3.fsh index ecc4f9c..2a586fb 100644 --- a/shaders/dimensions/composite3.fsh +++ b/shaders/dimensions/composite3.fsh @@ -384,7 +384,7 @@ void main() { BiomeFogColor(cavefogCol); #endif - cavefogCol *= pow(1.0 - max(1.0 - linearDistance/far,0.0),2.0); + cavefogCol *= 1.0-pow(1.0-pow(1.0 - max(1.0 - linearDistance/far,0.0),2.0),CaveFogFallOff); cavefogCol *= exp(-7.0*clamp(normalize(np3).y*0.5+0.5,0.0,1.0)) * 0.999 + 0.001; float skyhole = pow(clamp(1.0-pow(max(np3.y - 0.6,0.0)*5.0,2.0),0.0,1.0),2); diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index 85e7ce8..71d9a37 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -1,4 +1,4 @@ -#define SHADER_VERSION_LABEL 460 // [460] +#define SHADER_VERSION_LABEL 462 // [462] #define saturate(x) clamp(x,0.0,1.0) @@ -197,7 +197,7 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0. #define CAVE_FOG #ifdef CAVE_FOG #endif -#define CaveFogFallOff 2.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 ] +#define CaveFogFallOff 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 CaveFogColor_R 0.1 // [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 CaveFogColor_G 0.2 // [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 CaveFogColor_B 0.5 // [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] @@ -688,6 +688,19 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) #define LIGHTING_EFFECTS_BLUR_FILTER +// #define OLD_BLOOM +// #define BLOOMY_PARTICLES +// #define ORIGINAL_CHOCAPIC_SKY +// #define CLOUDS_INFRONT_OF_WORLD +// #define LARGE_WAVE_DISPLACEMENT + +#define SELECT_BOX +#define SELECT_BOX_COL_R 0.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0] +#define SELECT_BOX_COL_G 0.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0] +#define SELECT_BOX_COL_B 0.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0] + +// #define OLD_CAVE_DETECTION + /////////////////////////////////////////// // ----- DISTANT HORIZONS SETTINGS ----- // /////////////////////////////////////////// @@ -742,7 +755,6 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) // ----- DEBUG SETTINGS ----- // //////////////////////////////// - #define debug_OFF 0 #define debug_SHADOWMAP 1 #define debug_NORMALS 2 @@ -755,21 +767,6 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) #define debug_TEMPORAL_REPROJECTION 9 #define DEBUG_VIEW debug_OFF // [debug_OFF debug_SHADOWMAP debug_NORMALS debug_SPECULAR debug_INDIRECT debug_DIRECT debug_VIEW_POSITION debug_DH_WATER_BLENDING debug_FILTERED_STUFF debug_TEMPORAL_REPROJECTION] -///////////////////////////////// -// ----- RANDOM SETTINGS ----- // -///////////////////////////////// - -// #define OLD_BLOOM -// #define BLOOMY_PARTICLES -// #define ORIGINAL_CHOCAPIC_SKY -// #define CLOUDS_INFRONT_OF_WORLD -// #define LARGE_WAVE_DISPLACEMENT - -#define SELECT_BOX -#define SELECT_BOX_COL_R 0.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0] -#define SELECT_BOX_COL_G 0.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0] -#define SELECT_BOX_COL_B 0.0 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0] - // fix settings #ifdef DH_SCREENSPACE_REFLECTIONS @@ -795,4 +792,6 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) #ifdef RENDER_PLAYER_SHADOWS #endif #ifdef LPV_VL_FOG_ILLUMINATION +#endif +#ifdef OLD_CAVE_DETECTION #endif \ No newline at end of file diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 545d93f..4d6b6fa 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -345,7 +345,7 @@ SHADER_VERSION_LABEL \ ######## MISC SETTINGS screen.Misc_Settings = [EXPERIMENTAL_STUFF] DEBUG_VIEW [the_end_orb] display_LUT WhiteWorld SSS_view ambientLight_only LIGHTNING_FLASH DISABLE_ENCHANT_GLINT DISABLE_VANILLA_EMISSIVES PARTICLE_RENDERING_FIX TRANSLUCENT_ENTITIES LIGHTING_EFFECTS_BLUR_FILTER [selection_box_outline] - screen.EXPERIMENTAL_STUFF = CLOUDS_INTERSECT_TERRAIN BLOOMY_PARTICLES ORIGINAL_CHOCAPIC_SKY BIOME_TINT_WATER HYPER_DETAILED_WAVES OLD_BLOOM PLANET_GROUND_BRIGHTNESS LIT_PARTICLE_BRIGHTNESS WATER_CAUSTICS_BRIGHTNESS + screen.EXPERIMENTAL_STUFF = CLOUDS_INTERSECT_TERRAIN BLOOMY_PARTICLES ORIGINAL_CHOCAPIC_SKY BIOME_TINT_WATER HYPER_DETAILED_WAVES OLD_BLOOM PLANET_GROUND_BRIGHTNESS LIT_PARTICLE_BRIGHTNESS WATER_CAUSTICS_BRIGHTNESS OLD_CAVE_DETECTION screen.the_end_orb.columns = 1 screen.the_end_orb = THE_ORB ORB_X ORB_Y ORB_Z ORB_ColMult ORB_R ORB_G ORB_B @@ -481,24 +481,28 @@ uniform.float.noPuddleAreas = smooth(if(in(biome, 3, 4, 16, 37, 39, 48, 49, 31, #endif #endif +#if defined OLD_CAVE_DETECTION + variable.bool.inTheDarkTimer = smooth(if(eyeBrightness.y < 0.01, 1.0, 0.0), 30.0, 1.0) > 0.99 -# the idea is to modulate the mood value between 0 - 1 -# then check if the modulated value is non-zero. when it goes back to zero, it will have a very slowly deteriorating value. -# that value immediately regenerates when it modulates to 1 again. this way, i can check if the mood is climbing by checking if the smoothed value is above zero. + uniform.float.caveDetection = smooth(if(inTheDarkTimer, 1.0, 0.0), 10.0, 0.5) +#else + # the idea is to modulate the mood value between 0 - 1 + # then check if the modulated value is non-zero. when it goes back to zero, it will have a very slowly deteriorating value. + # that value immediately regenerates when it modulates to 1 again. this way, i can check if the mood is climbing by checking if the smoothed value is above zero. -# doing this is just for readablity, not required. -variable.float.playerMoodPercent = playerMood*100.0 + 1.0 -# modulo 0 - 1 -variable.float.modMood = playerMoodPercent - floor(playerMoodPercent) + # doing this is just for readablity, not required. + variable.float.playerMoodPercent = playerMood*100.0 + 1.0 + # modulo 0 - 1 + variable.float.modMood = playerMoodPercent - floor(playerMoodPercent) -# check if mood is increasing. -# and only activate when mood is above the threshold (5% mood) -# make sure it degenerates slow enough that mood can reach 5% after the mood flips to 0% from 100% -variable.bool.moodIsClimbing = smooth(if(modMood > 0.50 && playerMoodPercent > 4.0, 1.0, eyeBrightness.x/240.0), 0.0, 10.0) > 0.1 - -# add one more check to turn it off when lightlevels are not zero -uniform.float.caveDetection = smooth(if(moodIsClimbing && eyeBrightness.y < 0.01, 1.0, 0.0), 3.0, 1.0) + # check if mood is increasing. + # and only activate when mood is above the threshold (5% mood) + # make sure it degenerates slow enough that mood can reach 5% after the mood flips to 0% from 100% + variable.bool.moodIsClimbing = smooth(if(modMood > 0.50 && playerMoodPercent > 4.0, 1.0, eyeBrightness.x/240.0), 0.0, 10.0) > 0.1 + # add one more check to turn it off when lightlevels are not zero + uniform.float.caveDetection = smooth(if(moodIsClimbing && eyeBrightness.y < 0.01, 1.0, 0.0), 3.0, 1.0) +#endif # photon stuff