diff --git a/shaders/dimensions/all_particles.fsh b/shaders/dimensions/all_particles.fsh index 61225a2..c99aaed 100644 --- a/shaders/dimensions/all_particles.fsh +++ b/shaders/dimensions/all_particles.fsh @@ -140,7 +140,7 @@ float encodeVec2(float x,float y){ #ifdef OVERWORLD_SHADER float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDistFade){ - if(maxDistFade <= 0.0) return 1.0; + // if(maxDistFade <= 0.0) return 1.0; // setup shadow projection vec3 projectedShadowPosition = mat3(shadowModelView) * playerPos + shadowModelView[3].xyz; @@ -191,7 +191,8 @@ float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDis directLightColor *= mix(vec3(1.0), translucentTint.rgb, maxDistFade); #endif - return mix(1.0, shadowmap, maxDistFade); + return shadowmap; + // return mix(1.0, shadowmap, maxDistFade); } #endif @@ -417,7 +418,7 @@ void main() { Shadows = ComputeShadowMap(directLightColor, shadowPlayerPos, shadowMapFalloff); - Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2); + Shadows *= mix(LM_shadowMapFallback, 1.0, shadowMapFalloff2); #ifdef CLOUDS_SHADOWS Shadows *= GetCloudShadow(feetPlayerPos+cameraPosition, WsunVec); diff --git a/shaders/dimensions/all_translucent.fsh b/shaders/dimensions/all_translucent.fsh index 0d19d0c..33e02dc 100644 --- a/shaders/dimensions/all_translucent.fsh +++ b/shaders/dimensions/all_translucent.fsh @@ -290,7 +290,7 @@ uniform float dhFarPlane; #ifdef OVERWORLD_SHADER float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDistFade, float noise){ - if(maxDistFade <= 0.0) return 1.0; + // if(maxDistFade <= 0.0) return 1.0; // setup shadow projection vec3 projectedShadowPosition = mat3(shadowModelView) * playerPos + shadowModelView[3].xyz; @@ -365,7 +365,8 @@ float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDis directLightColor *= mix(vec3(1.0), translucentTint.rgb / samples, maxDistFade); #endif - return mix(1.0, shadowmap / samples, maxDistFade); + return shadowmap / samples; + // return mix(1.0, shadowmap / samples, maxDistFade); } #endif @@ -584,7 +585,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) Shadows = ComputeShadowMap(DirectLightColor, shadowPlayerPos, shadowMapFalloff, blueNoise()); - Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2); + // Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2); + Shadows *= mix(LM_shadowMapFallback,1.0,shadowMapFalloff2); #ifdef CLOUDS_SHADOWS Shadows *= GetCloudShadow(feetPlayerPos+cameraPosition, WsunVec); diff --git a/shaders/dimensions/composite.fsh b/shaders/dimensions/composite.fsh index b877c1d..a70f62a 100644 --- a/shaders/dimensions/composite.fsh +++ b/shaders/dimensions/composite.fsh @@ -457,9 +457,9 @@ void main() { } #endif - if (z < 1.0){ + // if (z < 1.0){ - gl_FragData[0] = vec4(minshadowfilt, 0.1, 0.0, 0.0); + gl_FragData[0] = vec4(minshadowfilt, 0.0, 0.0, 0.0); #ifdef Variable_Penumbra_Shadows if (LabSSS > -1) { @@ -467,6 +467,8 @@ void main() { vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; vec3 projectedShadowPosition = mat3(shadowModelView) * feetPlayerPos + shadowModelView[3].xyz; projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz; + + float TEST = projectedShadowPosition.z * (0.5/6.0) + 0.5; //apply distortion #ifdef DISTORT_SHADOWMAP @@ -477,7 +479,7 @@ void main() { #endif //do shadows only if on shadow map - // if (abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.z) < 6.0 || length(feetPlayerPos) < far){ + if (abs(projectedShadowPosition.x) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.y) < 1.0-1.5/shadowMapResolution && abs(projectedShadowPosition.z) < 6.0 ){ const float threshMul = max(2048.0/shadowMapResolution*shadowDistance/128.0,0.95); float distortThresh = (sqrt(1.0-NdotL*NdotL)/NdotL+0.7)/distortFactor; float diffthresh = distortThresh/6000.0*threshMul; @@ -495,7 +497,7 @@ void main() { // vec2 offsetS = SpiralSample(i, 7, 8, noise) * 0.5; vec2 offsetS = CleanSample(i, VPS_Search_Samples - 1, noise) * 0.5; - + float weight = 3.0 + (i+noise) *rdMul/SHADOW_FILTER_SAMPLE_COUNT*shadowMapResolution*distortFactor/2.7; float d = texelFetch2D(shadow, ivec2((projectedShadowPosition.xy+offsetS*rdMul)*shadowMapResolution),0).x; @@ -508,21 +510,23 @@ void main() { #else avgDepth += max(projectedShadowPosition.z - d, 0.0)*1000.0; #endif - + avgBlockerDepth += d * b; } - - gl_FragData[0].g = avgDepth / VPS_Search_Samples; - gl_FragData[0].b = blockerCount / VPS_Search_Samples; - - if (blockerCount >= 0.9){ - avgBlockerDepth /= blockerCount; - float ssample = max(projectedShadowPosition.z - avgBlockerDepth,0.0)*1500.0; - gl_FragData[0].r = clamp(ssample, scales.x, scales.y)/(scales.y)*(mult-minshadowfilt)+minshadowfilt; - } - // } + + gl_FragData[0].g = avgDepth / VPS_Search_Samples; + + gl_FragData[0].b = blockerCount / VPS_Search_Samples; + + if (blockerCount >= 0.9){ + avgBlockerDepth /= blockerCount; + float ssample = max(projectedShadowPosition.z - avgBlockerDepth,0.0)*1500.0; + gl_FragData[0].r = clamp(ssample, scales.x, scales.y)/(scales.y)*(mult-minshadowfilt)+minshadowfilt; + } + + } } #endif - } + // } #endif } \ No newline at end of file diff --git a/shaders/dimensions/composite1.fsh b/shaders/dimensions/composite1.fsh index 9636d51..a1833fb 100644 --- a/shaders/dimensions/composite1.fsh +++ b/shaders/dimensions/composite1.fsh @@ -626,9 +626,9 @@ vec3 ComputeShadowMap_COLOR(in vec3 projectedShadowPosition, float distortFactor tintedSunlight *= translucentTint.rgb / samples; // #endif - return mix(directLightColor, shadowColor.rgb / samples, maxDistFade); - // return 1.0; - // return mix(1.0, shadow / samples, maxDistFade); + return shadowColor.rgb / samples; + // return mix(directLightColor, shadowColor.rgb / samples, maxDistFade); + } #endif @@ -1071,16 +1071,16 @@ void main() { #ifdef SCREENSPACE_CONTACT_SHADOWS vec2 SS_directLight = SSRT_Shadows(toScreenSpace_DH(texcoord/RENDER_SCALE, z, DH_depth1), isDHrange, normalize(WsunVec*mat3(gbufferModelViewInverse)), interleaved_gradientNoise_temporal(), sunSSS_density > 0.0 && shadowMapFalloff2 < 1.0, hand); - // Shadows = SS_directLight.r; // combine shadowmap with a minumum shadow determined by the screenspace shadows. shadowColor *= SS_directLight.r; - // combine shadowmap blocker depth with a minumum determined by the screenspace shadows, starting after the shadowmap ends - ShadowBlockerDepth = mix(SS_directLight.g, ShadowBlockerDepth, shadowMapFalloff2); - - // shadowColor = vec3(SS_directLight.r*0 + 1); - // ShadowBlockerDepth = SS_directLight.g; + ShadowBlockerDepth = max(ShadowBlockerDepth, SS_directLight.g*(1.0-shadowMapFalloff2)); + + #else + ShadowBlockerDepth = max(ShadowBlockerDepth, (1.0-shadowMapFalloff2) * 10.0); #endif + + #ifdef TRANSLUCENT_COLORED_SHADOWS SSSColor = tintedSunlight; #else @@ -1090,11 +1090,7 @@ void main() { SSSColor *= SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), SSS_shadow, shadowMapFalloff2); if(isEyeInWater != 1) SSSColor *= lightLeakFix; - - #ifndef SCREENSPACE_CONTACT_SHADOWS - SSSColor = mix(vec3(0.0), SSSColor, shadowMapFalloff2); - #endif - + #ifdef CLOUDS_SHADOWS float cloudShadows = GetCloudShadow(feetPlayerPos.xyz + cameraPosition, WsunVec); shadowColor *= cloudShadows; @@ -1289,10 +1285,8 @@ void main() { #ifdef AO_in_sunlight - // Direct_lighting = max(shadowColor*NdotL * (AO*0.7+0.3), SSSColor); Direct_lighting = shadowColor*NdotL*(AO*0.7+0.3) + SSSColor * (1.0-NdotL); #else - // Direct_lighting = max(shadowColor*NdotL, SSSColor); Direct_lighting = shadowColor*NdotL + SSSColor * (1.0-NdotL); #endif #endif diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index 156fae9..85ab7a5 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -122,21 +122,12 @@ const float sunPathRotation = -35; //[-90 -89 -88 -87 -86 -85 -84 -83 -82 -81 -8 const int shadowMapResolution = 2048; // [512 768 1024 1536 2048 3172 4096 8192] const float shadowDistance = 128.0; // [32.0 48.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 368.0 384.0 512.0 768.0 1024.0 1536.0 2048.0 4096.0 8192.0] - -#ifdef IS_IRIS - #define OPTIMIZED_SHADOW_DISTANCE 1 // [-1 1] - const float shadowDistanceRenderMul = OPTIMIZED_SHADOW_DISTANCE; -#else - #define OPTIMIZED_SHADOW_DISTANCE 1 // [-1 1] - const float shadowDistanceRenderMul = float(OPTIMIZED_SHADOW_DISTANCE); -#endif +const float shadowDistanceRenderMul = 1.0; const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.75 1.00] - #define RENDER_ENTITY_SHADOWS #define RENDER_PLAYER_SHADOWS - #define SCREENSPACE_CONTACT_SHADOWS #define Variable_Penumbra_Shadows #define VPS_Search_Samples 4 // [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]