diff --git a/shaders/dimensions/DH_translucent.fsh b/shaders/dimensions/DH_translucent.fsh index 6263cde..f5143e9 100644 --- a/shaders/dimensions/DH_translucent.fsh +++ b/shaders/dimensions/DH_translucent.fsh @@ -353,14 +353,15 @@ void main() { gl_FragData[0].a = mix(gl_FragData[0].a, 0.0, min(max(1.0 - length(pos.xz)/far,0.0)*2.0,1.0) ); float material = 1.0; - + if(texture2D(depthtex1, gl_FragCoord.xy*texelSize).x < 1.0){ gl_FragData[0].a = 0.0; material = 0.0; } - // gl_FragData[0] = vec4(ld(texture2D(depthtex0, gl_FragCoord.xy*texelSize).x) * vec3(1.0), 1.0); - // if(gl_FragCoord.x*texelSize.x > 0.53) gl_FragData[0] = vec4(0.0); + #if DEBUG_VIEW == debug_DH_WATER_BLENDING + if(gl_FragCoord.x*texelSize.x > 0.53) gl_FragData[0] = vec4(0.0); + #endif gl_FragData[1] = vec4(Albedo, material); } \ No newline at end of file diff --git a/shaders/dimensions/all_translucent.fsh b/shaders/dimensions/all_translucent.fsh index 8858989..c48963e 100644 --- a/shaders/dimensions/all_translucent.fsh +++ b/shaders/dimensions/all_translucent.fsh @@ -625,7 +625,9 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) gl_FragData[1] = vec4(Albedo, iswater); #endif - // if(gl_FragCoord.x*texelSize.x < 0.47) gl_FragData[0] = vec4(0.0); + #if DEBUG_VIEW == debug_DH_WATER_BLENDING + if(gl_FragCoord.x*texelSize.x < 0.47) gl_FragData[0] = vec4(0.0); + #endif gl_FragData[3].a = max(lmtexcoord.w*blueNoise()*0.05 + lmtexcoord.w,0.0); } diff --git a/shaders/dimensions/composite1.fsh b/shaders/dimensions/composite1.fsh index fbca2ba..110c901 100644 --- a/shaders/dimensions/composite1.fsh +++ b/shaders/dimensions/composite1.fsh @@ -14,6 +14,7 @@ const bool colortex5MipmapEnabled = true; flat varying vec4 lightCol; uniform sampler2D colortex14; + #if Sun_specular_Strength != 0 #define LIGHTSOURCE_REFLECTION #endif @@ -81,6 +82,7 @@ uniform vec3 previousCameraPosition; // uniform float far; uniform float near; +uniform float farPlane; uniform float dhFarPlane; uniform float dhNearPlane; @@ -436,15 +438,6 @@ void waterVolumetrics(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estE } #endif -void Emission( - inout vec3 Lighting, - vec3 Albedo, - float Emission -){ - // if( Emission < 255.0/255.0 ) Lighting = mix(Lighting, Albedo * Emissive_Brightness, pow(Emission, Emissive_Curve)); // old method.... idk why - if( Emission < 255.0/255.0 ) Lighting += (Albedo * Emissive_Brightness) * pow(Emission, Emissive_Curve); -} - vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, bool isSSS){ float steps = 16.0; @@ -521,30 +514,29 @@ vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, floa scatter *= labcurve; - // PHASE TIME - // scatter *= 0.5 + CustomPhase(lightPos) * 13.0; // ~20x brighter at the peak - // scatter *= 1.0 + CustomPhase(lightPos) * 12.6; // ~20x brighter at the peak - - // scatter *= 0.5 + CustomPhase(lightPos)*6.35; // ~10x brighter at the peak scatter *= 1.0 + CustomPhase(lightPos)*6.0; // ~10x brighter at the peak return scatter; - } + vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){ - vec3 absorbed = max(1.0 - albedo,0.0); - // vec3 scatter = sqrt(exp(-(absorbed * Scattering * 15))) * (1.0 - Scattering); - // vec3 scatter = exp(-5 * Scattering)*vec3(1); vec3 scatter = exp((Scattering*Scattering) * absorbed * -5.0) * sqrt(1.0 - Scattering); - // scatter *= pow(Density,LabSSS_Curve); scatter *= clamp(1 - exp(Density * -10),0,1); + return scatter; +} - return scatter ; +void Emission( + inout vec3 Lighting, + vec3 Albedo, + float Emission +){ + // if( Emission < 255.0/255.0 ) Lighting = mix(Lighting, Albedo * Emissive_Brightness, pow(Emission, Emissive_Curve)); // old method.... idk why + if( Emission < 255.0/255.0 ) Lighting += (Albedo * Emissive_Brightness) * pow(Emission, Emissive_Curve); } #include "/lib/indirect_lighting_effects.glsl" @@ -580,52 +572,6 @@ vec4 renderInfiniteWaterPlane( return vec4(color, total_extinction); } - - - - -// uniform float viewWidth; -// uniform float viewHeight; - -// uniform sampler2D depthtex0; -// uniform sampler2D dhDepthTex; - -// uniform mat4 gbufferProjectionInverse; -// uniform mat4 dhProjectionInverse; - -vec3 getViewPos() { - ivec2 uv = ivec2(gl_FragCoord.xy); - vec2 viewSize = vec2(viewWidth, viewHeight); - vec2 texcoord = gl_FragCoord.xy / viewSize; - - vec4 viewPos = vec4(0.0); - - float depth = texelFetch(depthtex0, uv, 0).r; - - if (depth < 1.0) { - vec4 ndcPos = vec4(texcoord, depth, 1.0) * 2.0 - 1.0; - viewPos = gbufferProjectionInverse * ndcPos; - viewPos.xyz /= viewPos.w; - } - else { - depth = texelFetch(dhDepthTex, ivec2(gl_FragCoord.xy), 0).r; - - vec4 ndcPos = vec4(texcoord, depth, 1.0) * 2.0 - 1.0; - viewPos = dhProjectionInverse * ndcPos; - viewPos.xyz /= viewPos.w; - } - - return viewPos.xyz; -} -vec3 DH_viewSpacePos(vec2 texcoord, float depth) { - - vec4 ndcPos = vec4(texcoord, depth, 1.0) * 2.0 - 1.0; - vec4 viewPos = dhProjectionInverse * ndcPos; - return viewPos.xyz /= viewPos.w; - -} - - void main() { vec3 DEBUG = vec3(1.0); @@ -641,27 +587,27 @@ void main() { float z0 = texture2D(depthtex0,texcoord).x; float z = texture2D(depthtex1,texcoord).x; float swappedDepth = z; + bool isDHrange = z >= 1.0; #ifdef DISTANT_HORIZONS float DH_depth0 = texture2D(dhDepthTex,texcoord).x; float DH_depth1 = texture2D(dhDepthTex1,texcoord).x; - float mixedDepth = z; + float depthOpaque = z; + float depthOpaqueL = linearizeDepthFast(depthOpaque, near, farPlane); + + #ifdef DISTANT_HORIZONS + float dhDepthOpaque = DH_depth1; + float dhDepthOpaqueL = linearizeDepthFast(dhDepthOpaque, dhNearPlane, dhFarPlane); - float _near = near; - float _far = far*4.0; + if (depthOpaque >= 1.0 || (dhDepthOpaqueL < depthOpaqueL && dhDepthOpaque > 0.0)){ + depthOpaque = dhDepthOpaque; + depthOpaqueL = dhDepthOpaqueL; + } + #endif - if (mixedDepth >= 1.0) { - mixedDepth = DH_depth1; - _near = dhNearPlane; - _far = dhFarPlane; - } - mixedDepth = linearizeDepthFast(mixedDepth, _near, _far); - mixedDepth = mixedDepth / dhFarPlane; - - swappedDepth = DH_inv_ld(mixedDepth); - if(swappedDepth >= 0.999999) swappedDepth = 1.0; + swappedDepth = depthOpaque; #else float DH_depth0 = 0.0; float DH_depth1 = 0.0; @@ -852,13 +798,13 @@ void main() { #ifdef OVERWORLD_SHADER NdotL = clamp((-15 + dot(slopednormal, WsunVec)*255.0) / 240.0 ,0.0,1.0); - // float shadowNDOTL = NdotL; - // #ifndef Variable_Penumbra_Shadows - // shadowNDOTL += LabSSS; - // #endif + float shadowNDOTL = NdotL; + #ifndef Variable_Penumbra_Shadows + shadowNDOTL += LabSSS; + #endif - // if(shadowNDOTL > 0.001){ + if(shadowNDOTL > 0.001){ mat4 DH_shadowProjection = DH_shadowProjectionTweak(shadowProjection); @@ -905,7 +851,7 @@ void main() { #ifdef OLD_LIGHTLEAK_FIX if (isEyeInWater == 0) Shadows *= clamp(pow(eyeBrightnessSmooth.y/240. + lightmap.y,2.0) ,0.0,1.0); // light leak fix #endif - // } + } //////////////////////////////////////////////////////////////////////////////// //////////////////////////////// SUN SSS //////////////////////////////// @@ -1220,7 +1166,7 @@ void main() { #if DEBUG_VIEW == debug_VIEW_POSITION gl_FragData[0].rgb = viewPos; #endif - + #ifdef CLOUDS_INFRONT_OF_WORLD gl_FragData[1] = texture2D(colortex2, texcoord); diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index 684c17c..cb5cef3 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -115,12 +115,15 @@ const float ambientOcclusionLevel = 1.0; // this controls vanilla minecrafts amb // ----- SHADOW RELATED SETTINGS ----- // ///////////////////////////////////////// +const float sunPathRotation = -35; //[-90 -89 -88 -87 -86 -85 -84 -83 -82 -81 -80 -79 -78 -77 -76 -75 -74 -73 -72 -71 -70 -69 -68 -67 -66 -65 -64 -63 -62 -61 -60 -59 -58 -57 -56 -55 -54 -53 -52 -51 -50 -49 -48 -47 -46 -45 -44 -43 -42 -41 -40 -39 -38 -37 -36 -35 -34 -33 -32 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 ] + const int shadowMapResolution = 2048; // [512 768 1024 1536 2048 3172 4096 8192 16384] const float shadowDistance = 128.0; // [64.0 80.0 96.0 112.0 128.0 144.0 160.0 176.0 192.0 208.0 224.0 240.0 256.0 272.0 288.0 304.0 320.0 336.0 352.0 384.0 400.0 416.0 432.0 448.0 464.0 480.0 496.0 512.0 800.0 1000.0 2000.0 3000.0] const float shadowDistanceRenderMul = 1.0; // [-1.0 1.0] const float entityShadowDistanceMul = 1.0; // [0.05 0.10 1.50 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.0] + #define RENDER_ENTITY_SHADOWS #define SCREENSPACE_CONTACT_SHADOWS @@ -137,7 +140,7 @@ const float entityShadowDistanceMul = 1.0; // [0.05 0.10 1.50 0.20 0.25 0.30 0.3 #define Stochastic_Transparent_Shadows //#define SHADOW_FRUSTRUM_CULLING -const float sunPathRotation = -35; //[-90 -89 -88 -87 -86 -85 -84 -83 -82 -81 -80 -79 -78 -77 -76 -75 -74 -73 -72 -71 -70 -69 -68 -67 -66 -65 -64 -63 -62 -61 -60 -59 -58 -57 -56 -55 -54 -53 -52 -51 -50 -49 -48 -47 -46 -45 -44 -43 -42 -41 -40 -39 -38 -37 -36 -35 -34 -33 -32 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 ] + @@ -534,6 +537,10 @@ uniform int moonPhase; // #define DISTANT_HORIZONS_SHADOWMAP #ifdef DISTANT_HORIZONS_SHADOWMAP #undef DISTORT_SHADOWMAP + + const float shadowNearPlane = -1.0; + const float shadowFarPlane = -1.0; + #endif // #define DH_SHADOWPROJECTIONTWEAK @@ -545,7 +552,8 @@ uniform int moonPhase; #define debug_INDIRECT 4 #define debug_DIRECT 5 #define debug_VIEW_POSITION 6 -#define DEBUG_VIEW debug_OFF // [debug_OFF debug_SHADOWMAP debug_NORMALS debug_SPECULAR debug_INDIRECT debug_DIRECT debug_VIEW_POSITION] +#define debug_DH_WATER_BLENDING 7 +#define DEBUG_VIEW debug_OFF // [debug_OFF debug_SHADOWMAP debug_NORMALS debug_SPECULAR debug_INDIRECT debug_DIRECT debug_VIEW_POSITION debug_DH_WATER_BLENDING] // #define BLOOMY_PARTICLES // #define ORIGINAL_CHOCAPIC_SKY diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 5389700..4907b9a 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -1,13 +1,12 @@ -#shaders/shaders.properties -#Minecraft Settings -frustum.culling=false -shadow.culling =false - - -#ifndef RENDER_ENTITY_SHADOWS - shadowBlockEntities = false - shadowEntities = false -#endif +clouds=off +stars=false +vignette=false +underwaterOverlay=false +dynamicHandLight=true +oldLighting=false +separateAo = true +rain.depth = false +beacon.beam.depth = true #if RESOURCEPACK_SKY == 2 sun=true @@ -17,22 +16,12 @@ shadow.culling =false moon=false #endif -clouds=off -stars=false -vignette=false -underwaterOverlay=false -dynamicHandLight=true -oldLighting=false -separateAo = true - -# particles.before.deferred = true - -rain.depth = false -beacon.beam.depth = true - -program.composite4.enabled = TAA_UPSCALING +#ifndef RENDER_ENTITY_SHADOWS + shadowBlockEntities = false + shadowEntities = false +#endif #if defined TRANSLUCENT_ENTITIES && defined IS_IRIS separateEntityDraws = true @@ -49,6 +38,7 @@ program.composite4.enabled = TAA_UPSCALING #endif #if defined DISTANT_HORIZONS && defined IS_IRIS + #if defined DISTANT_HORIZONS_SHADOWMAP dhShadow.enabled = true #else @@ -58,7 +48,6 @@ program.composite4.enabled = TAA_UPSCALING program.dh_terrain.enabled = true program.dh_water.enabled = true - blend.dh_shadow = off blend.dh_terrain = off blend.dh_water = SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE #else @@ -67,6 +56,7 @@ program.composite4.enabled = TAA_UPSCALING program.dh_water.enabled = false #endif +program.composite4.enabled = TAA_UPSCALING # SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE ZERO # SRC_ALPHA ONE_MINUS_SRC_ALPHA ONE_MINUS_DST_ALPHA ONE