add DH overdraw prevention toggle.

This commit is contained in:
Xonk 2024-02-12 17:54:00 -05:00
parent b91c1f796f
commit f99a3c33b5
5 changed files with 51 additions and 14 deletions

View File

@ -93,11 +93,14 @@ uniform vec3 cameraPosition;
/* RENDERTARGETS:1,7,8 */
void main() {
// overdraw prevention
if(clamp(1.0-length(pos.xyz)/max(far - 16.0,0.0),0.0,1.0) > 0.0 ){
discard;
return;
}
#ifdef DH_OVERDRAW_PREVENTION
// overdraw prevention
if(clamp(1.0-length(pos.xyz)/max(far - 16.0,0.0),0.0,1.0) > 0.0 ){
discard;
return;
}
#endif
vec3 normals = viewToWorld(normals_and_materials.xyz);
float materials = normals_and_materials.a;

View File

@ -348,15 +348,18 @@ void main() {
gl_FragData[0].rgb = mix(gl_FragData[0].rgb, skyReflection, fresnel) + sunReflection ;
gl_FragData[0].a = mix(gl_FragData[0].a, 1.0, fresnel);
#endif
float distancefade = min(max(1.0 - length(pos.xz)/far,0.0)*2.0,1.0);
gl_FragData[0].a = mix(gl_FragData[0].a, 0.0, distancefade);
float material = distancefade < 1.0 ? 1.0 : 0.0;
if(texture2D(depthtex1, gl_FragCoord.xy*texelSize).x < 1.0){
gl_FragData[0].a = 0.0;
material = 0.0;
}
float material = 1.0;
#ifdef DH_OVERDRAW_PREVENTION
float distancefade = min(max(1.0 - length(pos.xz)/far,0.0)*2.0,1.0);
gl_FragData[0].a = mix(gl_FragData[0].a, 0.0, distancefade);
material = distancefade < 1.0 ? 1.0 : 0.0;
if(texture2D(depthtex1, gl_FragCoord.xy*texelSize).x < 1.0){
gl_FragData[0].a = 0.0;
material = 0.0;
}
#endif
#if DEBUG_VIEW == debug_DH_WATER_BLENDING
if(gl_FragCoord.x*texelSize.x > 0.53) gl_FragData[0] = vec4(0.0);

View File

@ -80,6 +80,36 @@
#endif
#endif
vec3 getSeasonColor( int worldDay ){
// length of each season in minecraft days
// for example, at 1, a season is 1 day long
int SeasonLength = 1;
// loop the year. multiply the season length by the 4 seasons to create a years time.
float YearLoop = mod(worldDay + SeasonLength, SeasonLength * 4);
// the time schedule for each season
float SummerTime = clamp(YearLoop ,0, SeasonLength) / SeasonLength;
float AutumnTime = clamp(YearLoop - SeasonLength ,0, SeasonLength) / SeasonLength;
float WinterTime = clamp(YearLoop - SeasonLength*2 ,0, SeasonLength) / SeasonLength;
float SpringTime = clamp(YearLoop - SeasonLength*3 ,0, SeasonLength) / SeasonLength;
// colors for things
vec3 SummerCol = vec3(Summer_R, Summer_G, Summer_B);
vec3 AutumnCol = vec3(Fall_R, Fall_G, Fall_B);
vec3 WinterCol = vec3(Winter_R, Winter_G, Winter_B);
vec3 SpringCol = vec3(Spring_R, Spring_G, Spring_B);
// lerp all season colors together
vec3 SummerToFall = mix(SummerCol, AutumnCol, SummerTime);
vec3 FallToWinter = mix(SummerToFall, WinterCol, AutumnTime);
vec3 WinterToSpring = mix(FallToWinter, SpringCol, WinterTime);
vec3 SpringToSummer = mix(WinterToSpring, SummerCol, SpringTime);
// return the final color of the year, because it contains all the other colors, at some point.
return SpringToSummer;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
////////////////////////////// DAILY WEATHER //////////////////////////////////

View File

@ -654,6 +654,7 @@ uniform int moonPhase;
// #define ORIGINAL_CHOCAPIC_SKY
// #define CLOUDS_INFRONT_OF_WORLD
#define DH_OVERDRAW_PREVENTION
#define DH_KNOWN_ISSUES 0 // [0 1 2 3 4 5]
// fix settings

View File

@ -295,7 +295,7 @@ BLISS_SHADERS <empty> \
screen.the_orb = THE_ORB ORB_X ORB_Y ORB_Z ORB_ColMult ORB_R ORB_G ORB_B
screen.DISTANT_HORIZONS_SETTINGS.columns = 1
screen.DISTANT_HORIZONS_SETTINGS = DH_KNOWN_ISSUES <EMPTY> DISTANT_HORIZONS_SHADOWMAP shadowDistance shadowMapResolution <empty> TOGGLE_VL_FOG VOLUMETRIC_CLOUDS
screen.DISTANT_HORIZONS_SETTINGS = DH_KNOWN_ISSUES <EMPTY> DISTANT_HORIZONS_SHADOWMAP shadowDistance shadowMapResolution <empty> DH_OVERDRAW_PREVENTION TOGGLE_VL_FOG VOLUMETRIC_CLOUDS
screen.DAILY_WEATHER.columns = 2
screen.DAILY_WEATHER = Daily_Weather <empty> \