From 72673c2b7f4f47681912e754c40a69d9b405d3e0 Mon Sep 17 00:00:00 2001 From: Merlin1809 Date: Tue, 8 Jul 2025 01:42:05 +0200 Subject: [PATCH] merge latest xonk commits... --- shaders/dimensions/all_translucent.fsh | 45 ++-- shaders/dimensions/all_translucent.vsh | 13 +- shaders/dimensions/composite.fsh | 55 ++--- shaders/dimensions/composite1.fsh | 251 +++++++++++++-------- shaders/dimensions/composite3.fsh | 74 +++--- shaders/dimensions/deferred.fsh | 36 +-- shaders/dimensions/deferred.vsh | 34 +-- shaders/lib/Shadow_Params.glsl | 2 +- shaders/lib/Shadows.glsl | 27 +-- shaders/lib/indirect_lighting_effects.glsl | 117 ++++------ shaders/lib/settings.glsl | 14 +- shaders/lib/volumetricClouds.glsl | 2 +- shaders/shaders.properties | 31 ++- 13 files changed, 394 insertions(+), 307 deletions(-) diff --git a/shaders/dimensions/all_translucent.fsh b/shaders/dimensions/all_translucent.fsh index 1ea8c05..ca0f8c6 100644 --- a/shaders/dimensions/all_translucent.fsh +++ b/shaders/dimensions/all_translucent.fsh @@ -234,7 +234,7 @@ vec2 CleanSample( // for every sample, the sample position must change its distance from the origin. // otherwise, you will just have a circle. - float spiralShape = pow(variedSamples / (totalSamples + variance),0.5); + float spiralShape = sqrt(variedSamples / (totalSamples + variance)); float shape = 2.26; // this is very important. 2.26 is very specific float theta = variedSamples * (PI * shape); @@ -295,12 +295,22 @@ uniform float dhFarPlane; // #undef BASIC_SHADOW_FILTER #ifdef OVERWORLD_SHADER -float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDistFade, float noise){ + +#include "/lib/Shadows.glsl" + +float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDistFade, float noise, in vec3 geoNormals){ // if(maxDistFade <= 0.0) return 1.0; // setup shadow projection vec3 projectedShadowPosition = mat3(shadowModelView) * playerPos + shadowModelView[3].xyz; + + applyShadowBias(projectedShadowPosition, playerPos, geoNormals); + + projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz; + + mat4 Custom_ViewMatrix = BuildShadowViewMatrix(); + projectedShadowPosition = mat3(Custom_ViewMatrix) * playerPos + Custom_ViewMatrix[3].xyz; projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz; // un-distort @@ -311,27 +321,21 @@ float ComputeShadowMap(inout vec3 directLightColor, vec3 playerPos, float maxDis float distortFactor = 1.0; #endif + projectedShadowPosition.z += shadowProjection[3].z * 0.0012; + // hamburger projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5); float shadowmap = 0.0; vec3 translucentTint = vec3(0.0); - #ifndef HAND - projectedShadowPosition.z -= 0.0001; - #endif - - #if defined ENTITIES - projectedShadowPosition.z -= 0.0002; - #endif - #ifdef BASIC_SHADOW_FILTER int samples = int(SHADOW_FILTER_SAMPLE_COUNT * 0.5); - float rdMul = 14.0*distortFactor*d0*k/shadowMapResolution; + float rdMul = (4.0*distortFactor*d0*k/shadowMapResolution) * 0.3; for(int i = 0; i < samples; i++){ - vec2 offsetS = CleanSample(i, samples - 1, noise) * 0.3; - projectedShadowPosition.xy += rdMul*offsetS; + vec2 offsetS = CleanSample(i, samples - 1, noise) * rdMul; + projectedShadowPosition.xy += offsetS; #else int samples = 1; #endif @@ -449,8 +453,8 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) float UnchangedAlpha = gl_FragData[0].a; #ifdef WhiteWorld - gl_FragData[0].rgb = vec3(0.5); - gl_FragData[0].a = 1.0; + gl_FragData[0].rgb = vec3(1.0); + gl_FragData[0].a = 1.0/255.0; #endif vec3 Albedo = toLinear(gl_FragData[0].rgb); @@ -496,6 +500,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) //////////////////////////////////////////////////////////////////////////////// vec3 normal = normalMat.xyz; // in viewSpace + vec3 geoNormals = viewToWorld(normal).xyz; // for refractions #if defined PHYSICSMOD_OCEAN_SHADER && defined PHYSICS_OCEAN WavePixelData wave = physics_wavePixel(physics_localPosition.xz, physics_localWaviness, physics_iterationsNormal, physics_gameTime); @@ -654,7 +659,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) float LM_shadowMapFallback = min(max(lightmap.y-0.8, 0.0) * 25,1.0); - Shadows = ComputeShadowMap(DirectLightColor, shadowPlayerPos, shadowMapFalloff, blueNoise()); + Shadows = ComputeShadowMap(DirectLightColor, shadowPlayerPos, shadowMapFalloff, blueNoise(), geoNormals); // Shadows = mix(LM_shadowMapFallback, Shadows, shadowMapFalloff2); Shadows *= mix(LM_shadowMapFallback,1.0,shadowMapFalloff2); @@ -667,7 +672,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) vec3 indirectNormal = worldSpaceNormal / dot(abs(worldSpaceNormal),vec3(1.0)); float SkylightDir = clamp(indirectNormal.y*0.7+0.3,0.0,1.0); - float skylight = mix(0.2 + 2.3*(1.0-lightmap.y), 2.5, SkylightDir); + float skylight = mix(0.2 + 2.3*(1.0-lightmap.y), 2.5, SkylightDir)/2.5; AmbientLightColor *= skylight; Indirect_lighting = doIndirectLighting(AmbientLightColor, MinimumLightColor, lightmap.y); @@ -722,7 +727,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) vec4 flashLightSpecularData = vec4(0.0); #ifdef FLASHLIGHT - Indirect_lighting += calculateFlashlight(FragCoord.xy*texelSize/RENDER_SCALE, viewPos, vec3(0.0), worldSpaceNormal, flashLightSpecularData, false); + Indirect_lighting += calculateFlashlight(FragCoord.xy*texelSize/RENDER_SCALE, viewPos, vec3(0.0), worldSpaceNormal, flashLightSpecularData); #endif vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo; @@ -809,7 +814,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) if(WATER && isWater) { gl_FragData[0].a = 0.0; MATERIALS = 0.0; - } + } #endif gl_FragData[1] = vec4(Albedo, MATERIALS); @@ -818,7 +823,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) if(gl_FragCoord.x*texelSize.x < 0.47) gl_FragData[0] = vec4(0.0); #endif #if DEBUG_VIEW == debug_NORMALS - gl_FragData[0].rgb = vec3(worldSpaceNormal.x,worldSpaceNormal.y*0,worldSpaceNormal.z*0) * 0.1; + gl_FragData[0].rgb = worldSpaceNormal.xyz * 0.1; gl_FragData[0].a = 1; #endif #if DEBUG_VIEW == debug_INDIRECT diff --git a/shaders/dimensions/all_translucent.vsh b/shaders/dimensions/all_translucent.vsh index 9c48a67..7128357 100644 --- a/shaders/dimensions/all_translucent.vsh +++ b/shaders/dimensions/all_translucent.vsh @@ -51,6 +51,9 @@ flat varying int glass; attribute vec4 at_tangent; attribute vec4 mc_Entity; +#if defined ENTITIES + uniform int entityId; +#endif uniform vec3 sunPosition; @@ -118,6 +121,12 @@ vec3 getWaveNormal(vec3 posxz, float range){ void main() { + gl_Position = ftransform(); + #if defined ENTITIES && defined IS_IRIS + // force out of frustum + if (entityId == 1599) gl_Position.z -= 10000.0; + #endif + #if defined PHYSICSMOD_OCEAN_SHADER && defined PHYSICS_OCEAN // basic texture to determine how shallow/far away from the shore the water is physics_localWaviness = texelFetch(physics_waviness, ivec2(gl_Vertex.xz) - physics_textureOffset, 0).r; @@ -167,8 +176,8 @@ void main() { gl_Position = toClipSpace3(position); - #if defined ENTITIES - gl_Position = ftransform(); + #if !defined ENTITIES && !defined HAND + gl_Position = toClipSpace3(position); #endif HELD_ITEM_BRIGHTNESS = 0.0; diff --git a/shaders/dimensions/composite.fsh b/shaders/dimensions/composite.fsh index 517a42b..a08442f 100644 --- a/shaders/dimensions/composite.fsh +++ b/shaders/dimensions/composite.fsh @@ -256,7 +256,6 @@ vec2 SSAO( int samples = 7; float occlusion = 0.0; float sss = 0.0; - float THING = 0.0; vec2 jitterOffsets = TAA_Offset*texelSize*0.5 * RENDER_SCALE - texelSize*0.5; @@ -265,16 +264,20 @@ vec2 SSAO( float distanceScale = hand ? 30.0 : mix(40.0, 10.0, pow(clamp(1.0 - linearViewDistance/50.0,0.0,1.0),2.0)); float depthCancelation = (linearViewDistance*linearViewDistance) / distanceScale ; - int n = 0; + // distanceScale *= 10; + vec2 screenEdges = 2.0/vec2(viewWidth, viewHeight); + + float n = 0.0; for (int i = 0; i < samples; i++) { vec2 offsets = CleanSample(i, samples - 1, noise) / distanceScale; ivec2 offsetUV = ivec2(gl_FragCoord.xy + offsets*vec2(viewWidth, viewHeight*aspectRatio)*RENDER_SCALE); - if (offsetUV.x >= 0 && offsetUV.y >= 0 && offsetUV.x < viewWidth*RENDER_SCALE.x && offsetUV.y < viewHeight*RENDER_SCALE.y ) { + // if (offsetUV.x >= 0 && offsetUV.y >= 0 && offsetUV.x < viewWidth*RENDER_SCALE.x && offsetUV.y < viewHeight*RENDER_SCALE.y ) { - float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, offsetUV, 0).x, hand); + // float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, offsetUV, 0).x, hand); + float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, ivec2(clamp(offsetUV*texelSize,screenEdges,1.0-screenEdges)/texelSize), 0).x, hand); #ifdef DISTANT_HORIZONS float sampleDHDepth = texelFetch2D(dhDepthTex1, offsetUV, 0).x; @@ -289,7 +292,7 @@ vec2 SSAO( float threshHold = max(1.0 - viewPosDiffSquared/depthCancelation, 0.0); if (viewPosDiffSquared > 1e-5){ - n += 1; + n += 1.0; float preAo = 1.0 - clamp(dot(normalize(viewPosDiff), flatnormal)*25.0,0.0,1.0); occlusion += max(0.0, dot(normalize(viewPosDiff), normal) - preAo) * threshHold; @@ -302,10 +305,10 @@ vec2 SSAO( #endif } - } + // } } float finaalAO = max(1.0 - occlusion*AO_Strength/n, 0.0); - float finalSSS = sss/n; + float finalSSS = sss/float(samples); return vec2(finaalAO, finalSSS); } @@ -342,16 +345,6 @@ void main() { float noise = R2_dither(); vec2 texcoord = gl_FragCoord.xy*texelSize; - - float z = texelFetch2D(depthtex1,ivec2(gl_FragCoord.xy),0).x; - - #ifdef DISTANT_HORIZONS - float DH_depth1 = texelFetch2D(dhDepthTex1,ivec2(gl_FragCoord.xy),0).x; - float swappedDepth = z >= 1.0 ? DH_depth1 : z; - #else - float DH_depth1 = 1.0; - float swappedDepth = z; - #endif vec4 data = texelFetch2D(colortex1,ivec2(gl_FragCoord.xy),0); vec4 dataUnpacked0 = vec4(decodeVec2(data.x),decodeVec2(data.y)); @@ -371,12 +364,18 @@ void main() { bool hand = abs(dataUnpacked1.w-0.75) < 0.01; // bool blocklights = abs(dataUnpacked1.w-0.8) <0.01; + float z = texelFetch2D(depthtex1,ivec2(gl_FragCoord.xy),0).x; - if(hand){ - convertHandDepth(z); - } + #ifdef DISTANT_HORIZONS + float DH_depth1 = texelFetch2D(dhDepthTex1,ivec2(gl_FragCoord.xy),0).x; + float swappedDepth = z >= 1.0 ? DH_depth1 : z; + #else + float DH_depth1 = 1.0; + float swappedDepth = z; + #endif vec3 viewPos = toScreenSpace_DH(texcoord/RENDER_SCALE - TAA_Offset*texelSize*0.5, z, DH_depth1); + vec3 playerPos = mat3(gbufferModelViewInverse) * viewPos; float depth = z; @@ -399,6 +398,7 @@ void main() { gl_FragData[2] = vec4(vec3(0.0), 65000.0); #if defined DENOISE_SSS_AND_SSAO && indirect_effect == 1 + vec3 FlatNormals = normalize(texture2D(colortex15,texcoord).rgb * 2.0 - 1.0); if(z >= 1.0) FlatNormals = normal; @@ -408,12 +408,9 @@ void main() { SSAO_SSS.y = clamp(SSAO_SSS.y + 0.5 * lightmap.y*lightmap.y,0.0,1.0); #endif - // SSAO_SSS.y = clamp(SSAO_SSS.y + 0.5,0.0,1.0); if(swappedDepth >= 1.0) SSAO_SSS = vec2(1.0,0.0); gl_FragData[1].xy = SSAO_SSS; - #else - vec2 SSAO_SSS = vec2(1.0,0.0); #endif @@ -456,13 +453,15 @@ void main() { gl_FragData[0] = vec4(minshadowfilt, 0.0, 0.0, 0.0); #ifdef Variable_Penumbra_Shadows - if (LabSSS > -1) { + // if (LabSSS > -1) { 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; + mat4 Custom_ViewMatrix = BuildShadowViewMatrix(); + projectedShadowPosition = mat3(Custom_ViewMatrix) * feetPlayerPos + Custom_ViewMatrix[3].xyz; + projectedShadowPosition = diagonal3(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz; //apply distortion #ifdef DISTORT_SHADOWMAP @@ -472,8 +471,12 @@ void main() { float distortFactor = 1.0; #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 ){ + + projectedShadowPosition.z += shadowProjection[3].z * 0.0013; + 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; @@ -519,7 +522,7 @@ void main() { } } - } + // } #endif // } #endif diff --git a/shaders/dimensions/composite1.fsh b/shaders/dimensions/composite1.fsh index de287bc..b36f6f3 100644 --- a/shaders/dimensions/composite1.fsh +++ b/shaders/dimensions/composite1.fsh @@ -173,12 +173,8 @@ float convertHandDepth_2(in float depth, bool hand) { } #include "/lib/projections.glsl" - -#define TESTTHINGYG - #include "/lib/color_transforms.glsl" #include "/lib/waterBump.glsl" - #include "/lib/Shadow_Params.glsl" #include "/lib/Shadows.glsl" #include "/lib/sky_gradient.glsl" @@ -361,15 +357,77 @@ float swapperlinZ(float depth, float _near, float _far) { } -vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, bool isSSS, bool hand){ +// vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, bool isSSS, bool hand){ - float handSwitch = hand ? 1.0 : 0.0; +// float handSwitch = hand ? 1.0 : 0.0; - float steps = 16.0; - float Shadow = 1.0; +// float steps = 16.0; +// float Shadow = 1.0; +// float SSS = 0.0; +// // isSSS = true; + +// float _near = near; float _far = far*4.0; + +// if (depthCheck) { +// _near = dhNearPlane; +// _far = dhFarPlane; +// } + + +// vec3 clipPosition = toClipSpace3_DH(viewPos, depthCheck); +// //prevents the ray from going behind the camera +// float rayLength = ((viewPos.z + lightDir.z * _far*sqrt(3.)) > -_near) ? +// (-_near -viewPos.z) / lightDir.z : _far*sqrt(3.); + +// vec3 direction = toClipSpace3_DH(viewPos + lightDir*rayLength, depthCheck) - clipPosition; //convert to clip space + +// direction.xyz = direction.xyz / max(abs(direction.x)/0.0005, abs(direction.y)/0.0005); //fixed step size + +// // float Stepmult = depthCheck ? (isSSS ? 1.0 : 3.0) : (isSSS ? 1.0 : 3.0); +// float Stepmult = isSSS ? 3.0 : 6.0; + +// vec3 rayDir = direction * Stepmult * vec3(RENDER_SCALE,1.0); +// vec3 screenPos = clipPosition * vec3(RENDER_SCALE,1.0) + rayDir*noise - (isSSS ? rayDir*0.9 : vec3(0.0)); + +// float minZ = screenPos.z - 1.0; +// float maxZ = screenPos.z; + +// // as distance increases, add larger values to the SSS value. this scales the "density" with distance, as far things should appear denser. +// float dist = 1.0 + length(mat3(gbufferModelViewInverse) * viewPos) / 500.0; + +// for (int i = 0; i < int(steps); i++) { + +// float samplePos = convertHandDepth_2(texture2D(depthtex1, screenPos.xy).x, hand); + +// #ifdef DISTANT_HORIZONS +// if(depthCheck) samplePos = texture2D(dhDepthTex1, screenPos.xy).x; +// #endif + +// if(samplePos < screenPos.z && (samplePos <= max(minZ,maxZ) && samplePos >= min(minZ,maxZ))){ +// vec2 linearZ = vec2(swapperlinZ(screenPos.z, _near, _far), swapperlinZ(samplePos, _near, _far)); +// float calcthreshold = abs(linearZ.x - linearZ.y) / linearZ.x; + +// if (calcthreshold < 0.035) Shadow = 0.0; +// SSS += dist; +// } + +// minZ = maxZ - (isSSS ? 1.0 : 0.0001) / swapperlinZ(samplePos, _near, _far); +// maxZ += rayDir.z; + +// screenPos += rayDir; +// } + +// return vec2(Shadow, SSS / steps); +// } + +vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, bool isSSS, bool hand){ + + // return 1.0; + + float shadows = 1.0; + float samples = 16.0; float SSS = 0.0; - // isSSS = true; float _near = near; float _far = far*4.0; @@ -378,51 +436,50 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo _far = dhFarPlane; } - - vec3 clipPosition = toClipSpace3_DH(viewPos, depthCheck); + vec3 position = toClipSpace3_DH(viewPos, depthCheck) ; + //prevents the ray from going behind the camera - float rayLength = ((viewPos.z + lightDir.z * _far*sqrt(3.)) > -_near) ? - (-_near -viewPos.z) / lightDir.z : _far*sqrt(3.); + float rayLength = ((viewPos.z + lightDir.z * _far * sqrt(3.)) > -_near) ? (-_near - viewPos.z) / lightDir.z : _far * sqrt(3.); - vec3 direction = toClipSpace3_DH(viewPos + lightDir*rayLength, depthCheck) - clipPosition; //convert to clip space + vec3 direction = toClipSpace3_DH(viewPos + lightDir*rayLength, depthCheck) - position; + direction.xyz = direction.xyz / max(max(abs(direction.x)/0.0005, abs(direction.y)/0.0005),400.0); //fixed step size + direction *= 6.0; - direction.xyz = direction.xyz / max(abs(direction.x)/0.0005, abs(direction.y)/0.0005); //fixed step size + position.xy *= RENDER_SCALE; + direction.xy *= RENDER_SCALE; + + vec3 newPos = position + direction*noise; + // literally shadow bias to fight shadow acne due to precision problems when comparing sampled depth and marched position + newPos += direction*0.3; - // float Stepmult = depthCheck ? (isSSS ? 1.0 : 3.0) : (isSSS ? 1.0 : 3.0); - float Stepmult = isSSS ? 3.0 : 6.0; + float SSSdistanceScale = 1.0 / (1.0 + swapperlinZ(position.z, _near, _far)*32.0); + float distanceScale2 = 1.0 + length(mat3(gbufferModelViewInverse) * viewPos) / 150.0; - vec3 rayDir = direction * Stepmult * vec3(RENDER_SCALE,1.0); - vec3 screenPos = clipPosition * vec3(RENDER_SCALE,1.0) + rayDir*noise - (isSSS ? rayDir*0.9 : vec3(0.0)); - - float minZ = screenPos.z; - float maxZ = screenPos.z; - - // as distance increases, add larger values to the SSS value. this scales the "density" with distance, as far things should appear denser. - float dist = 1.0 + length(mat3(gbufferModelViewInverse) * viewPos) / 500.0; - - for (int i = 0; i < int(steps); i++) { + for (int i = 0; i < int(samples); i++) { - float samplePos = convertHandDepth_2(texture2D(depthtex1, screenPos.xy).x, hand); + float sampleDepth = convertHandDepth_2(texelFetch2D(depthtex1, ivec2(newPos.xy/texelSize),0).x,hand); #ifdef DISTANT_HORIZONS - if(depthCheck) samplePos = texture2D(dhDepthTex1, screenPos.xy).x; + if(depthCheck) sampleDepth = texelFetch2D(dhDepthTex1, ivec2(newPos.xy/texelSize),0).x; #endif - if(samplePos < screenPos.z && (samplePos <= max(minZ,maxZ) && samplePos >= min(minZ,maxZ))){ - vec2 linearZ = vec2(swapperlinZ(screenPos.z, _near, _far), swapperlinZ(samplePos, _near, _far)); - float calcthreshold = abs(linearZ.x - linearZ.y) / linearZ.x; + if(sampleDepth < newPos.z){ + float linearCurrentPos = swapperlinZ(newPos.z, _near, _far); + float linearSampledDepth = swapperlinZ(sampleDepth, _near, _far); - if (calcthreshold < 0.035) Shadow = 0.0; - SSS += dist; - } + float dist = abs(linearSampledDepth - linearCurrentPos) / linearCurrentPos; + + // if (dist < 0.035){ + if (dist < 0.035/(1.0+linearCurrentPos) && (sampleDepth < newPos.z )) shadows = 0.0; + + // if (dist < 0.3/(1.0+linearCurrentPos)) SSS += distanceScale2; + if (dist < SSSdistanceScale) SSS += distanceScale2; + } + + newPos += direction; - minZ = maxZ - (isSSS ? 1.0 : 0.0001) / swapperlinZ(samplePos, _near, _far); - maxZ += rayDir.z; - - screenPos += rayDir; } - - return vec2(Shadow, SSS / steps); + return vec2(shadows, SSS / samples ); } float SSRT_FlashLight_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise){ @@ -533,9 +590,9 @@ void BilateralUpscale_REUSE_Z(sampler2D tex1, sampler2D tex2, sampler2D depth, v shadow_RESULT += texelFetch2D(tex1, posColor + radius + pos, 0).rgb * EDGES; #endif - #if indirect_effect == 1 + // #if indirect_effect == 1 ssao_RESULT += texelFetch2D(tex2, posColor + radius + pos, 0).rg * EDGES; - #endif + // #endif SUM += EDGES; } @@ -546,10 +603,10 @@ void BilateralUpscale_REUSE_Z(sampler2D tex1, sampler2D tex2, sampler2D depth, v filteredShadow = shadow_RESULT/SUM; #endif - #if indirect_effect == 1 + // #if indirect_effect == 1 ssao_RESULT += texture2D(tex2, gl_FragCoord.xy*texelSize).rg; ambientEffects = ssao_RESULT/SUM; - #endif + // #endif } vec4 BilateralUpscale_VLFOG(sampler2D tex, sampler2D depth, vec2 coord, float referenceDepth){ @@ -631,7 +688,8 @@ vec3 ComputeShadowMap_COLOR(in vec3 projectedShadowPosition, float distortFactor translucentTint += mix(translucentShadow.rgb, vec3(1.0), max(opaqueShadow, backface * (shadowAlpha < 1.0 ? 0.0 : 1.0))); FUNNYSHADOW += ((1.0-shadowAlpha) * opaqueShadowT)/samples; #else - shadowColor += directLightColor * shadow2D(shadow, projectedShadowPosition).x; + // shadowColor += directLightColor * shadow2D(shadow, projectedShadowPosition).x; + shadowColor += vec3(1.0) * shadow2D(shadow, projectedShadowPosition).x; #endif @@ -663,7 +721,7 @@ float CustomPhase(float LightPos){ return Final; } -vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, float lightPos, float shadows, float distantSSS){ +vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, float lightPos, float SS_shadows, float distantSSS, bool hand){ // Density = 1.0; Scattering *= sss_density_multiplier; @@ -672,10 +730,12 @@ vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, floa float scatterDepth = max(1.0 - Scattering/density, 0.0); scatterDepth *= exp(-7.0 * (1.0-scatterDepth)); - + scatterDepth = scatterDepth * mix(exp(-4.0 * SS_shadows), 1.0, (1.0-SCREENSPACE_DIRECT_SSS_BLENDING) * scatterDepth * distantSSS); + + if(hand) scatterDepth = max(1.0 - Scattering*10.0, 0.0) * exp(-4.0 * SS_shadows); vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -20.0 * sss_absorbance_multiplier); - vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth); + vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth); #if SSS_TYPE == 3 scatter *= pow(Density, LabSSS_Curve); @@ -696,7 +756,7 @@ vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){ vec3 scatter = scatterDepth * absorbColor * pow(Density, LabSSS_Curve); #else float scatterDepth = pow(Scattering,3.5); - scatterDepth = 1-pow(1-scatterDepth,5); + scatterDepth = 1.0-pow(1.0-scatterDepth,5.0); vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -20.0 * sss_absorbance_multiplier); vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth) * pow(Density, LabSSS_Curve); @@ -1054,22 +1114,28 @@ void main() { //////////////////////////////// SHADOWMAP //////////////////////////////// // setup shadow projection - vec3 shadowPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; - if(!hand) GriAndEminShadowFix(shadowPlayerPos, FlatNormals, vanilla_AO, lightmap.y); - vec3 projectedShadowPosition = mat3(shadowModelView) * shadowPlayerPos + shadowModelView[3].xyz; - projectedShadowPosition = diagonal3_old(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz; - float shadowMapFalloff = smoothstep(0.0, 1.0, min(max(1.0 - length(feetPlayerPos) / (shadowDistance+32.0),0.0)*5.0,1.0)); float shadowMapFalloff2 = smoothstep(0.0, 1.0, min(max(1.0 - length(feetPlayerPos) / shadowDistance,0.0)*5.0,1.0)); - if(isEyeInWater == 1){ shadowMapFalloff = 1.0; shadowMapFalloff2 = 1.0; } - // un-distort + vec3 shadowPlayerPos = mat3(gbufferModelViewInverse) * viewPos + gbufferModelViewInverse[3].xyz; + + #if LIGHTLEAKFIX_MODE == 1 + if(!hand) GriAndEminShadowFix(shadowPlayerPos, FlatNormals, vanilla_AO, lightmap.y, lightLeakFix); + #endif + + vec3 projectedShadowPosition = mat3(shadowModelView) * shadowPlayerPos + shadowModelView[3].xyz; + + applyShadowBias(projectedShadowPosition, shadowPlayerPos, FlatNormals); + + projectedShadowPosition = diagonal3_old(shadowProjection) * projectedShadowPosition + shadowProjection[3].xyz; + + // Calclulate distortion factor before bias application #ifdef DISTORT_SHADOWMAP float distortFactor = calcDistort(projectedShadowPosition.xy); projectedShadowPosition.xy *= distortFactor; @@ -1077,6 +1143,7 @@ void main() { float distortFactor = 1.0; #endif + projectedShadowPosition.z += shadowProjection[3].z * 0.0012; projectedShadowPosition = projectedShadowPosition * vec3(0.5,0.5,0.5/6.0) + vec3(0.5,0.5,0.5) ; float ShadowAlpha = 0.0; // this is for subsurface scattering later. @@ -1085,9 +1152,9 @@ void main() { shadowColor = ComputeShadowMap_COLOR(projectedShadowPosition, distortFactor, noise_2, filteredShadow.x, flatNormNdotL, shadowMapFalloff, DirectLightColor, ShadowAlpha, tintedSunlight, LabSSS > 0.0,Shadows); // transition to fallback lightmap shadow mask. - shadowColor *= mix(isWater ? lightLeakFix : LM_shadowMapFallback, 1.0, shadowMapFalloff2); + // shadowColor *= mix(isWater ? lightLeakFix : LM_shadowMapFallback, 1.0, shadowMapFalloff2); - #ifdef OLD_LIGHTLEAK_FIX + #if LIGHTLEAKFIX_MODE == 2 if(isEyeInWater != 1) shadowColor *= lightLeakFix; // light leak fix #endif @@ -1106,11 +1173,10 @@ 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); - // combine shadowmap with a minumum shadow determined by the screenspace shadows. - shadowColor *= SS_directLight.r; - ShadowBlockerDepth = max(ShadowBlockerDepth, SS_directLight.g*(1.0-shadowMapFalloff2)); - + // combine shadowmap with screenspace shadows. + shadowColor *= SS_directLight.r; #else + vec2 SS_directLight = vec2(1,0); ShadowBlockerDepth = max(ShadowBlockerDepth, (1.0-shadowMapFalloff2) * 10.0); #endif @@ -1121,7 +1187,7 @@ void main() { SSSColor = DirectLightColor; #endif - SSSColor *= SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), SSS_shadow, shadowMapFalloff2); + SSSColor = SubsurfaceScattering_sun(albedo, ShadowBlockerDepth, sunSSS_density, clamp(dot(feetPlayerPos_normalized, WsunVec),0.0,1.0), SS_directLight.g, shadowMapFalloff2, hand); if(isEyeInWater != 1) SSSColor *= lightLeakFix; @@ -1160,17 +1226,18 @@ void main() { vec3 indirectNormal = slopednormal / dot(abs(slopednormal),vec3(1.0)); float SkylightDir = indirectNormal.y; + if(isGrass) SkylightDir = 1.0; SkylightDir = clamp(SkylightDir*0.7+0.3, 0.0, pow(1-pow(1-SSAO_SSS.x, 0.5),4.0) * 0.7 + 0.3); - skylight = mix(0.2 + 2.3*(1.0-lightmap.y), 2.5, SkylightDir); + skylight = mix(0.2 + 2.3*(1.0-lightmap.y), 2.5, SkylightDir)/2.5; - // skylight = 2.5; + // skylight = 1.0; #endif #if indirect_effect == 3 || indirect_effect == 4 - skylight = 2.5; + skylight = 1.0; #endif Indirect_lighting += doIndirectLighting(AmbientLightColor * skylight, MinimumLightColor, lightmap.y); @@ -1230,7 +1297,7 @@ void main() { ///////////////////////////// EFFECTS FOR INDIRECT ///////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// - float SkySSS = 1.0; + float SkySSS = SSAO_SSS.y; vec3 AO = vec3(1.0); #if indirect_effect == 0 @@ -1274,28 +1341,24 @@ void main() { //////////////////////////////////////////////////////////////////////////////// ///////////////////////////// SKY SSS ///////////////////////////// - #if defined Ambient_SSS && defined OVERWORLD_SHADER && indirect_effect == 1 - if (!hand){ - vec3 ambientColor = AmbientLightColor * ambientsss_brightness * ambient_brightness * 3.0; + #if defined Ambient_SSS && defined OVERWORLD_SHADER // && indirect_effect == 1 + vec3 ambientColor = AmbientLightColor * ambientsss_brightness * ambient_brightness * 2.0; - Indirect_SSS = SubsurfaceScattering_sky(albedo, SkySSS, LabSSS); - Indirect_SSS *= lightmap.y; + Indirect_SSS = SubsurfaceScattering_sky(albedo, SkySSS, LabSSS); + Indirect_SSS *= lightmap.y; - // if(texcoord.x>0.5) oIndirect_SSS *= 0.0; - // apply to ambient light. + float thingy = SkySSS; + thingy = pow(thingy,3.5); + thingy = 1-pow(1-thingy,5); - float thingy = SkySSS; - thingy = pow(thingy,3.5); - thingy = 1-pow(1-thingy,5); + Indirect_lighting = Indirect_lighting + Indirect_SSS * ambientColor; + // float lightmapCurve = ((pow(lightmap.y,15.0)*2.0 + lightmap.y*lightmap.y)/3.0); + // Indirect_lighting = ambient_brightness * AmbientLightColor * mix(Indirect_SSS*lightmap.y*2.5, vec3(1.0), skylight * SSAO_curve * lightmapCurve); + // Indirect_lighting += blockLightColor * SSAO_curve; - Indirect_lighting = Indirect_lighting + Indirect_SSS * ambientColor; - // Indirect_lighting = max(Indirect_lighting, Indirect_SSS * ambientColor); - // Indirect_lighting += Indirect_SSS * ambientColor; - - // #ifdef OVERWORLD_SHADER - // if(LabSSS > 0.0) Indirect_lighting += (1.0-SkySSS) * LightningPhase * lightningEffect * pow(lightmap.y,10); - // #endif - } + // #ifdef OVERWORLD_SHADER + // if(LabSSS > 0.0) Indirect_lighting += (1.0-SkySSS) * LightningPhase * lightningEffect * pow(lightmap.y,10); + // #endif #endif ///////////////////////////////////////////////////////////////////////// @@ -1317,9 +1380,11 @@ void main() { #ifdef AO_in_sunlight - Direct_lighting = shadowColor*NdotL*(AO*0.7+0.3) + SSSColor * (1.0-NdotL); + // Direct_lighting = shadowColor*NdotL*(AO*0.7+0.3) + SSSColor * (1.0-NdotL); + Direct_lighting = DirectLightColor * mix(SSSColor, vec3(1.0), NdotL*shadowColor * (AO*0.7+0.3)); #else - Direct_lighting = shadowColor*NdotL + SSSColor * (1.0-NdotL); + // Direct_lighting = shadowColor*NdotL + SSSColor * (1.0-NdotL); + Direct_lighting = DirectLightColor * mix(SSSColor, vec3(1.0), NdotL*shadowColor); #endif #endif @@ -1338,7 +1403,7 @@ void main() { vec3 specularNormal = normal; if (dot(normal, (feetPlayerPos_normalized)) > 0.0) specularNormal = FlatNormals; - FINAL_COLOR = specularReflections(viewPos, feetPlayerPos_normalized, WsunVec, specularNoises, specularNormal, SpecularTex.r, SpecularTex.g, albedo, FINAL_COLOR, shadowColor, lightmap.y, hand, flashLightSpecularData); + FINAL_COLOR = specularReflections(viewPos, feetPlayerPos_normalized, WsunVec, specularNoises, specularNormal, SpecularTex.r, SpecularTex.g, albedo, FINAL_COLOR, DirectLightColor*shadowColor, lightmap.y, hand, flashLightSpecularData); #endif gl_FragData[0].rgb = FINAL_COLOR; @@ -1446,7 +1511,7 @@ void main() { ////// DEBUG VIEW STUFF #if DEBUG_VIEW == debug_SHADOWMAP - gl_FragData[0].rgb = vec3(1.0) * (Shadows * 0.9 + 0.1); + gl_FragData[0].rgb = vec3(1.0) * (Shadows * NdotL * 0.9 + 0.1); if(dot(feetPlayerPos_normalized, unsigned_WsunVec) > 0.999 ) gl_FragData[0].rgb = vec3(10,10,0); if(dot(feetPlayerPos_normalized, -WmoonVec) > 0.999 ) gl_FragData[0].rgb = vec3(1,1,10); @@ -1464,13 +1529,13 @@ void main() { gl_FragData[0].rgb = Indirect_lighting; #endif #if DEBUG_VIEW == debug_DIRECT - if(swappedDepth < 1.0) gl_FragData[0].rgb = vec3(NdotL); + if(swappedDepth < 1.0) gl_FragData[0].rgb = Direct_lighting; #endif #if DEBUG_VIEW == debug_VIEW_POSITION gl_FragData[0].rgb = viewPos * 0.001; #endif #if DEBUG_VIEW == debug_FILTERED_STUFF - if(hideGUI == 0){ + // if(hideGUI == 0){ float value = SSAO_SSS.y; value = pow(value,3.5); value = 1-pow(1-value,5); @@ -1479,7 +1544,7 @@ void main() { gl_FragData[0].rgb = vec3(value); if(swappedDepth >= 1.0) gl_FragData[0].rgb = vec3(1.0); - } + // } #endif /* RENDERTARGETS:3 */ diff --git a/shaders/dimensions/composite3.fsh b/shaders/dimensions/composite3.fsh index a29fc69..eb47c79 100644 --- a/shaders/dimensions/composite3.fsh +++ b/shaders/dimensions/composite3.fsh @@ -218,22 +218,36 @@ vec3 viewToWorld(vec3 viewPosition) { return pos.xyz; } +vec2 clampUV(in vec2 uv, vec2 texcoord){ + // return uv; + + // get the gradient when a refracted axis and non refracted axis go above 1.0 or below 0.0 + // use this gradient to lerp between refracted and non refracted uv + // the goal of this is to stretch the uv back to normal when the refracted image exposes off screen uv + // emphasis on *stretch*, as i want the transition to remain looking like refraction, not a sharp cut. + + float vignette = max(uv.x * texcoord.x, 0.0); + vignette = max(uv.y * texcoord.y, vignette); + vignette = max((uv.x-1.0) * (texcoord.x-1.0), vignette); + vignette = max((uv.y-1.0) * (texcoord.y-1.0), vignette); + vignette *= vignette*vignette*vignette*vignette; + + return clamp(mix(uv, texcoord, vignette),0.0,0.9999999); +} + vec3 doRefractionEffect( inout vec2 texcoord, vec2 normal, float linearDistance, bool isReflectiveEntity){ // make the tangent space normals match the directions of the texcoord UV, this greatly improves the refraction effect. vec2 UVNormal = vec2(normal.x,-normal.y); - float refractionMult = 0.3 / (1.0 + pow(linearDistance,0.8)); + float refractionMult = 0.5 / (1.0 + pow(linearDistance,0.8)); float diffractionMult = 0.035; float smudgeMult = 1.0; - if(isReflectiveEntity) refractionMult *= 0.5; - // for diffraction, i wanted to know *when* normals were at an angle, not what the + // for diffraction, i wanted to know *when* normals were at an angle float clampValue = 0.2; - vec2 abberationOffset = (clamp(UVNormal,-clampValue, clampValue)/clampValue) * diffractionMult; - - // return vec3(abs(abberationOffset), 0.0); + vec2 abberationOffset = clamp(UVNormal, -clampValue, clampValue) / clampValue * diffractionMult; #ifdef REFRACTION_SMUDGE vec2 directionalSmudge = abberationOffset * (blueNoise()-0.5) * smudgeMult; @@ -241,40 +255,36 @@ vec3 doRefractionEffect( inout vec2 texcoord, vec2 normal, float linearDistance, vec2 directionalSmudge = vec2(0.0); #endif - vec2 refractedUV = texcoord - (UVNormal + directionalSmudge)*refractionMult; + vec2 refractedUV_no_offset = clampUV(texcoord - (UVNormal + directionalSmudge)*refractionMult, texcoord); + vec2 refractedUV = refractedUV_no_offset; #ifdef FAKE_DISPERSION_EFFECT - refractionMult *= min( decodeVec2(texelFetch2D(colortex11, ivec2((texcoord - ((UVNormal + abberationOffset) + directionalSmudge)*refractionMult)/texelSize),0).b).g, - decodeVec2(texelFetch2D(colortex11, ivec2((texcoord + ((UVNormal + abberationOffset) + directionalSmudge)*refractionMult)/texelSize),0).b).g ) > 0.0 ? 1.0 : 0.0; + refractionMult *= min( decodeVec2(texelFetch2D(colortex11, ivec2(clampUV(texcoord - ((UVNormal + abberationOffset) + directionalSmudge)*refractionMult,texcoord)/texelSize),0).b).g, + decodeVec2(texelFetch2D(colortex11, ivec2(clampUV(texcoord + ((UVNormal + abberationOffset) + directionalSmudge)*refractionMult,texcoord)/texelSize),0).b).g ) > 0.0 ? 1.0 : 0.0; #else - refractionMult *= decodeVec2(texelFetch2D(colortex11, ivec2(refractedUV/texelSize),0).b).g > 0.0 ? 1.0 : 0.0; + refractionMult *= decodeVec2(texelFetch2D(colortex11, ivec2(refractedUV_no_offset/texelSize),0).b).g > 0.0 ? 1.0 : 0.0; #endif - - // a max bound around screen edges and edges of the refracted screen - vec2 vignetteSides = clamp(min((1.0 - refractedUV)/0.05, refractedUV/0.05)+0.5,0.0,1.0); - float vignette = vignetteSides.x*vignetteSides.y; - refractionMult *= vignette; + vec3 color = vec3(0.0); #ifdef FAKE_DISPERSION_EFFECT //// RED - refractedUV = clamp(texcoord - ((UVNormal + abberationOffset) + directionalSmudge)*refractionMult ,0.0,1.0); - color.r = texelFetch2D(colortex3, ivec2(refractedUV/texelSize),0).r; + refractedUV = clampUV(texcoord - ((UVNormal + abberationOffset) + directionalSmudge)*refractionMult,texcoord); + color.r = texture2D(colortex3, refractedUV).r; //// GREEN - refractedUV = clamp(texcoord - (UVNormal + directionalSmudge)*refractionMult ,0,1); - color.g = texelFetch2D(colortex3, ivec2(refractedUV/texelSize),0).g; + refractedUV = clampUV(texcoord - (UVNormal + directionalSmudge)*refractionMult,texcoord); + color.g = texture2D(colortex3, refractedUV).g; //// BLUE - refractedUV = clamp(texcoord - ((UVNormal - abberationOffset) + directionalSmudge)*refractionMult ,0.0,1.0); - color.b = texelFetch2D(colortex3, ivec2(refractedUV/texelSize),0).b; + refractedUV = clampUV(texcoord - ((UVNormal - abberationOffset) + directionalSmudge)*refractionMult,texcoord); + color.b = texture2D(colortex3, refractedUV).b; #else - refractedUV = clamp(texcoord - (UVNormal + directionalSmudge)*refractionMult,0,1); - color = texture2D(colortex3, refractedUV).rgb; + color = texture2D(colortex3, refractedUV_no_offset).rgb; #endif - texcoord = texcoord - (UVNormal + directionalSmudge)*refractionMult; + texcoord = refractedUV_no_offset; return color; } @@ -350,7 +360,7 @@ vec4 bilateralUpsample(out float outerEdgeResults, float referenceDepth, sampler vec4 colorSum = vec4(0.0); float edgeSum = 0.0; - float threshold = 0.005; + float threshold = 1.0; vec2 coord = gl_FragCoord.xy - 1.5; @@ -432,6 +442,7 @@ vec4 VLTemporalFiltering(vec3 viewPos, in float referenceDepth, sampler2D depth) float blendingFactor = 0.1; + // variance if(abs(clampedFrameHistory.a - frameHistory.a) > 0.1) blendingFactor = 1.0; vec4 reprojectFrame = mix(clampedFrameHistory, currentFrame, blendingFactor); @@ -735,9 +746,9 @@ bool isLightning = false; vec3 cavefogCol = vec3(CaveFogColor_R, CaveFogColor_G, CaveFogColor_B); - #ifdef PER_BIOME_ENVIRONMENT - BiomeFogColor(cavefogCol); - #endif + // #ifdef PER_BIOME_ENVIRONMENT + // BiomeFogColor(cavefogCol); + // #endif 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(playerPos_normalized).y*0.5+0.5,0.0,1.0)) * 0.999 + 0.001; @@ -786,7 +797,7 @@ bool isLightning = false; ////// --------------- BLEND FOG INTO SCENE //////////// apply VL fog over opaque and translucents - bloomyFogMult *= temporallyFilteredVL.a; + // bloomyFogMult *= temporallyFilteredVL.a; #if defined IS_IRIS // if(z >= 1.0) color = vec3(0,255,0); @@ -828,7 +839,7 @@ bool isLightning = false; ////// --------------- FINALIZE #ifdef display_LUT - float zoomLevel = 75.0; + float zoomLevel = 1.0; vec3 thingy = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy/zoomLevel),0).rgb /1200.0; if(luma(thingy) > 0.0){ @@ -837,13 +848,12 @@ bool isLightning = false; } #if defined OVERWORLD_SHADER - if( hideGUI == 1) color.rgb = skyCloudsFromTex(playerPos_normalized, colortex4).rgb/1200.0; + if( hideGUI == 1) color.rgb = skyFromTex(playerPos_normalized, colortex4).rgb/1200.0; #else if( hideGUI == 1) color.rgb = volumetricsFromTex(playerPos_normalized, colortex4, 0.0).rgb/1200.0; #endif #endif - // color.rgb = testThing.rgb; gl_FragData[0].r = bloomyFogMult; // pass fog alpha so bloom can do bloomy fog gl_FragData[1].rgb = clamp(color.rgb, 0.0,68000.0); diff --git a/shaders/dimensions/deferred.fsh b/shaders/dimensions/deferred.fsh index bff3131..54c4e1c 100644 --- a/shaders/dimensions/deferred.fsh +++ b/shaders/dimensions/deferred.fsh @@ -235,11 +235,15 @@ float mixhistory = 0.06; /// --- Save light values - if (gl_FragCoord.x < 1. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ) - gl_FragData[0] = vec4(averageSkyCol_Clouds * AmbientLightTint,1.0); + if (gl_FragCoord.x < 1. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ){ + gl_FragData[0] = vec4(averageSkyCol_Clouds * AmbientLightTint,1.0); + if(worldTimeChangeCheck) mixhistory = 1.0; + } - if (gl_FragCoord.x > 1. && gl_FragCoord.x < 2. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ) - gl_FragData[0] = vec4((skyGroundCol/150.0) * AmbientLightTint,1.0); + if (gl_FragCoord.x > 1. && gl_FragCoord.x < 2. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ){ + gl_FragData[0] = vec4((skyGroundCol/150.0) * AmbientLightTint,1.0); + if(worldTimeChangeCheck) mixhistory = 1.0; + } #ifdef ambientLight_only if (gl_FragCoord.x > 6. && gl_FragCoord.x < 7. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ) @@ -251,14 +255,20 @@ float mixhistory = 0.06; if (gl_FragCoord.x > 13. && gl_FragCoord.x < 14. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ) gl_FragData[0] = vec4(0.0,0.0,0.0,1.0); #else - if (gl_FragCoord.x > 6. && gl_FragCoord.x < 7. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ) - gl_FragData[0] = vec4(lightSourceColor,1.0); + if (gl_FragCoord.x > 6. && gl_FragCoord.x < 7. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ){ + gl_FragData[0] = vec4(lightSourceColor,1.0); + if(worldTimeChangeCheck) mixhistory = 1.0; + } - if (gl_FragCoord.x > 8. && gl_FragCoord.x < 9. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ) - gl_FragData[0] = vec4(sunColor,1.0); + if (gl_FragCoord.x > 8. && gl_FragCoord.x < 9. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ){ + gl_FragData[0] = vec4(sunColor,1.0); + if(worldTimeChangeCheck) mixhistory = 1.0; + } - if (gl_FragCoord.x > 9. && gl_FragCoord.x < 10. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ) - gl_FragData[0] = vec4(moonColor,1.0); + if (gl_FragCoord.x > 9. && gl_FragCoord.x < 10. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ){ + gl_FragData[0] = vec4(moonColor,1.0); + if(worldTimeChangeCheck) mixhistory = 1.0; + } #endif #if defined FLASHLIGHT && defined FLASHLIGHT_BOUNCED_INDIRECT @@ -294,8 +304,8 @@ if (gl_FragCoord.x > 18. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257){ sky = calculateAtmosphere((averageSkyCol*4000./2.0), viewVector, vec3(0.0,1.0,0.0), WsunVec, -WsunVec, planetSphere, skyAbsorb, 10, blueNoise()); // fade atmosphere conditions for rain away when you pass above the cloud plane. - float heightRelativeToClouds = clamp(1.0 - max(eyeAltitude - CloudLayer0_height,0.0) / 200.0 ,0.0,1.0); - if(rainStrength > 0.0) sky = mix(sky, 3.0 + averageSkyCol*4000 * (skyAbsorb*0.7+0.3), clamp(1.0 - exp(pow(clamp(-viewVector.y+0.9,0.0,1.0),2) * -5.0),0.0,1.0) * heightRelativeToClouds * rainStrength); + // float heightRelativeToClouds = clamp(1.0 - max(eyeAltitude - CloudLayer0_height,0.0) / 200.0 ,0.0,1.0); + // if(rainStrength > 0.0) sky = mix(sky, 3.0 + averageSkyCol*4000 * (skyAbsorb*0.7+0.3), clamp(1.0 - exp(pow(clamp(-viewVector.y+0.9,0.0,1.0),2) * -5.0),0.0,1.0) * heightRelativeToClouds * rainStrength); #ifdef AEROCHROME_MODE sky *= vec3(0.0, 0.18, 0.35); @@ -327,7 +337,7 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+ #ifdef ambientLight_only suncol = vec3(0.0); #endif - float rejection = 1.0; + float cloudPlaneDistance = 0.0; vec2 cloudDistance = vec2(0.0); diff --git a/shaders/dimensions/deferred.vsh b/shaders/dimensions/deferred.vsh index 6291aff..d16e5fb 100644 --- a/shaders/dimensions/deferred.vsh +++ b/shaders/dimensions/deferred.vsh @@ -113,23 +113,29 @@ void main() { // sample in a 3x3 pattern to get a good area for average color - int maxIT = 9; - // int maxIT = 20; - for (int i = 0; i < maxIT; i++) { - vec3 pos = vec3(0.0,1.0,0.0); - pos.xy += normalize(sample3x3[i]) * vec2(0.3183,0.9000); + // int maxIT = 9; + // for (int i = 0; i < maxIT; i++) { + // vec3 pos = vec3(0.0,1.0,0.0); + // pos.xy += normalize(sample3x3[i]) * vec2(0.3183,0.9000); - averageSkyCol_Clouds += 1.5 * (skyCloudsFromTex(pos,colortex4).rgb/maxIT/150.0); - averageSkyCol += 1.5 * (skyFromTex(pos,colortex4).rgb/maxIT/150.0); - } - - // maximum control of color and luminance - // vec3 minimumlight = vec3(0.5,0.75,1.0) * nightVision; - // averageSkyCol_Clouds = max( normalize(averageSkyCol_Clouds) * min(luma(averageSkyCol_Clouds) * 3.0,2.5) * (1.0-rainStrength*0.7), minimumlight); + // averageSkyCol_Clouds += skyCloudsFromTex(pos,colortex4).rgb/maxIT/150.0; + // averageSkyCol += skyFromTex(pos,colortex4).rgb/maxIT/150.0; + // } + float maxIT = 20.0; + for (int i = 0; i < int(maxIT); i++) { + vec2 ij = R2_samples(((i*50+1)%1000)*int(maxIT)+i) ;//* vec2(0.3183,0.9000); + vec3 pos = normalize(rodSample(ij)) * vec3(1.0,0.5,1.0) + vec3(0.0,0.5,0.0); + + averageSkyCol_Clouds += skyCloudsFromTex(pos,colortex4).rgb/maxIT/150.0; + averageSkyCol += 1.5 * skyFromTex(pos,colortex4).rgb/maxIT/150.0; + } vec3 minimumlight = vec3(1.0) * 0.01 * MIN_LIGHT_AMOUNT + nightVision * 0.05; - averageSkyCol_Clouds = max(normalize(averageSkyCol_Clouds + 1e-6) * min(luma(averageSkyCol_Clouds) * 3.0,2.5),0.0); + + // luminance based reinhard is useful ouside of tonemapping too. + averageSkyCol_Clouds = 1.5 * (averageSkyCol_Clouds / (1.0+luma(averageSkyCol_Clouds)*0.2)); + averageSkyCol = max(averageSkyCol * PLANET_GROUND_BRIGHTNESS,0.0) + minimumlight; #ifdef USE_CUSTOM_SKY_GROUND_LIGHTING_COLORS @@ -272,7 +278,7 @@ void main() { float targetrodExposure = max(0.012/log2(avgL2+1.002)-0.1,0.0)*1.2; - exposure = max(targetExposure, 0.0); + exposure = max(targetExposure*EXPOSURE_MULTIPLIER, 0.0); float currCenterDepth = ld(texture2D(depthtex2, vec2(0.5)*RENDER_SCALE).r); centerDepth = mix(sqrt(texelFetch2D(colortex4,ivec2(14,37),0).g/65000.0), currCenterDepth, clamp(DoF_Adaptation_Speed*exp(-0.016/frameTime+1.0)/(6.0+currCenterDepth*far),0.0,1.0)); diff --git a/shaders/lib/Shadow_Params.glsl b/shaders/lib/Shadow_Params.glsl index d67976e..409ae2e 100644 --- a/shaders/lib/Shadow_Params.glsl +++ b/shaders/lib/Shadow_Params.glsl @@ -2,7 +2,7 @@ uniform float far; uniform int dhRenderDistance; const float k = 1.8; -const float d0 = 0.04 + max(64.0 - shadowDistance, 0.0)/64.0 * 0.26; +const float d0 = 0.04 + (1.0-clamp(shadowDistance-64.0, 0.0,1.0)) * 0.1; const float d1 = 0.61; float a = exp(d0); float b = (exp(d1)-a)*150./128.0; diff --git a/shaders/lib/Shadows.glsl b/shaders/lib/Shadows.glsl index 74d649d..d518814 100644 --- a/shaders/lib/Shadows.glsl +++ b/shaders/lib/Shadows.glsl @@ -5,25 +5,22 @@ void GriAndEminShadowFix( inout vec3 WorldPos, vec3 FlatNormal, float VanillaAO, - float SkyLightmap + float SkyLightmap, + float transition ){ + float zoomLevel = 1.0-(transition*transition*transition*transition*0.5+0.5); + if(SkyLightmap < 0.1 && isEyeInWater != 1) WorldPos = WorldPos - ( fract(WorldPos+cameraPosition - WorldPos*0.0001)*zoomLevel - zoomLevel*0.5); +} - float MinimumValue = 0.05; +void applyShadowBias(inout vec3 projectedShadowPosition, in vec3 playerPos, in vec3 geoNormals){ - // give a tiny boost to the distance mulitplier when shadowmap resolution is below 2048.0 - // float ResMultiplier = 1.0 + (shadowDistance/8.0)*(1.0 - min(shadowMapResolution,2048)/2048.0)*0.3; + // Calculate the bias size according to the 1:1 ratio of one shadow texel to one full block + const float biasSize = (shadowDistance / shadowMapResolution*2.0) * 2.0; - // float DistanceMultiplier = max(1.0 - max(1.0 - length(WorldPos) / shadowDistance, 0.0), MinimumValue) * ResMultiplier; - float theDistance = max(1.0 - length(WorldPos) / shadowDistance,0.0); - float DistanceMultiplier = mix(0.5, 0.05, theDistance); - float DistanceMultiplier2 = mix(1.0, 0.02, theDistance); - - vec3 Bias = (FlatNormal * DistanceMultiplier + WsunVec * DistanceMultiplier2); + float biasDistanceFactor = length(projectedShadowPosition.xy); - // stop lightleaking by zooming up, centered on blocks - vec2 scale = vec2(0.5); scale.y *= 0.5; - vec3 zoomShadow = scale.y - scale.x * fract(WorldPos + cameraPosition + Bias*scale.y*0.1); - if(SkyLightmap < 0.1 && isEyeInWater != 1) Bias = zoomShadow; + biasDistanceFactor = 1.0 + biasDistanceFactor * ((16.0*8.0) / shadowDistance) * 0.1; - WorldPos += Bias; + projectedShadowPosition += (mat3(shadowModelView) * geoNormals) * biasSize * 0.15 * biasDistanceFactor; +} } \ No newline at end of file diff --git a/shaders/lib/indirect_lighting_effects.glsl b/shaders/lib/indirect_lighting_effects.glsl index db10be0..cb3e57d 100644 --- a/shaders/lib/indirect_lighting_effects.glsl +++ b/shaders/lib/indirect_lighting_effects.glsl @@ -98,39 +98,47 @@ vec4 BilateralUpscale_SSAO(sampler2D tex, sampler2D depth, vec2 coord, float ref vec3 rayTrace_GI(vec3 dir,vec3 position,float dither, float quality){ + float biasAmount = 0.0001; + vec3 clipPosition = toClipSpace3(position); - float rayLength = ((position.z + dir.z * far*sqrt(3.)) > -near) ? - (-near -position.z) / dir.z : far*sqrt(3.); - vec3 direction = normalize(toClipSpace3(position+dir*rayLength)-clipPosition); //convert to clip space - direction.xy = normalize(direction.xy); + + float rayLength = ((position.z + dir.z * far*sqrt(3.)) > -near) ? (-near -position.z) / dir.z : far*sqrt(3.); + + vec3 direction = toClipSpace3(position + dir*rayLength) - clipPosition; //convert to clip space //get at which length the ray intersects with the edge of the screen - vec3 maxLengths = (step(0.,direction)-clipPosition) / direction; - float mult = maxLengths.y; + vec3 maxLengths = (step(0.0, direction) - clipPosition) / direction; + float mult = min(min(maxLengths.x, maxLengths.y), maxLengths.z); + vec3 stepv = direction * mult / quality; - vec3 stepv = direction * mult / quality*vec3(RENDER_SCALE,1.0); - vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0) ; + clipPosition.xy *= RENDER_SCALE; + stepv.xy *= RENDER_SCALE; - spos.xy += TAA_Offset*texelSize*0.5/RENDER_SCALE; + vec3 spos = clipPosition + stepv*dither; + // spos += stepv*0.3; - spos += stepv*dither; + #if defined DEFERRED_SPECULAR && defined TAA + spos.xy += TAA_Offset*texelSize*0.5/RENDER_SCALE; + #endif - float biasdist = clamp(position.z*position.z/50.0,1,2); // shrink sample size as distance increases + float minZ = spos.z - biasAmount / linZ(spos.z); + float maxZ = spos.z; + + for (int i = 0; i <= int(quality); i++) { - for(int i = 0; i < int(quality); i++){ #ifdef UseQuarterResDepth - float sp = sqrt(texelFetch2D(colortex4,ivec2(spos.xy/texelSize/4),0).w/65000.0); + float sampleDepth = sqrt(texelFetch2D(colortex4,ivec2(spos.xy/texelSize/4.0),0).a/65000.0); #else - float sp = linZ(texelFetch2D(depthtex1,ivec2(spos.xy/ texelSize),0).r); + float sampleDepth = linZ(texelFetch2D(depthtex1,ivec2(spos.xy/ texelSize),0).r); #endif - float currZ = linZ(spos.z); + float sp = invLinZ(sampleDepth) ; + + if( (sp < max(minZ, maxZ) && sp > min(minZ, maxZ))) return vec3(spos.xy/RENDER_SCALE,sp); + minZ = maxZ - biasAmount / linZ(spos.z); + maxZ += stepv.z; - if( sp < currZ) { - float dist = abs(sp-currZ)/currZ; - if (abs(dist) < biasdist*0.05) return vec3(spos.xy, invLinZ(sp))/vec3(RENDER_SCALE,1.0); - } spos += stepv; - } + } return vec3(1.1); } @@ -142,60 +150,13 @@ float convertHandDepth_3(in float depth, bool hand) { return ndcDepth * 0.5 + 0.5; } -vec3 RT(vec3 dir, vec3 position, float noise, float stepsizes, bool hand){ - float dist = 1.0 + clamp(position.z*position.z,0,2); // shrink sample size as distance increases - - float stepSize = stepsizes / dist; - int maxSteps = STEPS; - vec3 clipPosition = toClipSpace3(position); - float rayLength = ((position.z + dir.z * sqrt(3.0)*far) > -sqrt(3.0)*near) ? - (-sqrt(3.0)*near -position.z) / dir.z : sqrt(3.0)*far; - vec3 end = toClipSpace3(position+dir*rayLength) ; - vec3 direction = end-clipPosition ; //convert to clip space - - float len = max(abs(direction.x)/texelSize.x,abs(direction.y)/texelSize.y)/stepSize; - //get at which length the ray intersects with the edge of the screen - vec3 maxLengths = (step(0.,direction)-clipPosition) / direction; - - float mult = min(min(maxLengths.x,maxLengths.y),maxLengths.z)*2000.0; - - vec3 stepv = direction/len; - - - int iterations = min(int(min(len, mult*len)-2), maxSteps); - - //Do one iteration for closest texel (good contact shadows) - vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0) ; - spos.xy += TAA_Offset*texelSize*0.5*RENDER_SCALE; - - spos += stepv; - - float distancered = 1.0 + clamp(position.z*position.z/50.0,0,2); // shrink sample size as distance increases - - for(int i = 0; i < iterations; i++){ - if (spos.x < 0.0 || spos.y < 0.0 || spos.z < 0.0 || spos.x > 1.0 || spos.y > 1.0 || spos.z > 1.0) return vec3(1.1); - - spos += stepv*noise; - #ifdef UseQuarterResDepth - float sp = sqrt(texelFetch2D(colortex4,ivec2(spos.xy/ texelSize/4),0).w/65000.0); - #else - float sp = linZ(texelFetch2D(depthtex1,ivec2(spos.xy/ texelSize),0).r); - #endif - - float currZ = linZ(spos.z); - - if( sp < currZ) { - float dist = abs(sp-currZ)/currZ; - if (dist <= mix(0.5, 0.1, clamp(position.z*position.z - 0.1,0,1))) return vec3(spos.xy, invLinZ(sp))/vec3(RENDER_SCALE,1.0); - } - } - return vec3(1.1); -} - vec3 RT_alternate(vec3 dir, vec3 position, float noise, float stepsizes, bool hand, inout float CURVE ){ vec3 worldpos = mat3(gbufferModelViewInverse) * position; + float biasamount = 0.00005; + vec2 screenEdges = 2.0/vec2(viewWidth, viewHeight); + float dist = 1.0 + length(worldpos)/far; // step length as distance increases float stepSize = stepsizes / dist; @@ -213,17 +174,24 @@ vec3 RT_alternate(vec3 dir, vec3 position, float noise, float stepsizes, bool ha vec3 stepv = direction/len; - int iterations = min(int(min(len, mult*len)-2), maxSteps); + int iterations = min(int(min(len, mult*len) - 2.0), maxSteps); - vec3 spos = clipPosition*vec3(RENDER_SCALE,1.0) + stepv*(noise-0.5); + clipPosition.xy *= RENDER_SCALE; + stepv.xy *= RENDER_SCALE; + + vec3 spos = clipPosition + stepv*noise; + spos += stepv*0.3; spos.xy += TAA_Offset*texelSize*0.5*RENDER_SCALE; - float ascribeAmount = 255.0 * 1.0 * (1.0 / viewHeight) * gbufferProjectionInverse[1].y; - float minZ = spos.z; + float minZ = spos.z - biasamount / linZ(spos.z); float maxZ = spos.z; CURVE = 0.0; + for(int i = 0; i < iterations; i++){ + + spos.xy = clamp(spos.xy,screenEdges,1.0-screenEdges); + if (spos.x < 0.0 || spos.y < 0.0 || spos.z < 0.0 || spos.x > 1.0 || spos.y > 1.0 || spos.z > 1.0) return vec3(1.1); #ifdef UseQuarterResDepth @@ -237,7 +205,6 @@ vec3 RT_alternate(vec3 dir, vec3 position, float noise, float stepsizes, bool ha if(nextZ < currZ && (sp <= max(minZ,maxZ) && sp >= min(minZ,maxZ))) return vec3(spos.xy/RENDER_SCALE,sp); - float biasamount = 0.00005; minZ = maxZ-biasamount / currZ; maxZ += stepv.z; diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index 58461d5..4add68e 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -267,8 +267,8 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0. // #define Horrible_slope_normals #define Adaptive_Step_length #define POM_DEPTH 0.50 // [0.025 0.05 0.075 0.1 0.125 0.15 0.20 0.25 0.30 0.50 0.75 1.0] -#define MAX_ITERATIONS 35 // [5 10 15 20 25 30 40 50 60 70 80 90 100 125 150 200 400] -#define MAX_DIST 25.0 // [5.0 10.0 15.0 20.0 25.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0 125.0 150.0 200.0 400.0] +#define MAX_ITERATIONS 35 // [5 10 15 20 25 30 35 40 45 50 60 70 80 90 100 125 150 200 300 400 500] +#define MAX_DIST 25.0 // [5.0 10.0 15.0 20.0 25.0 35.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0 125.0 150.0 200.0 300.0 400.0 500.0] #define SSS_TYPE 1 // [0 1 2 3] #define LabSSS_Curve 1.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 ] @@ -278,7 +278,7 @@ const float entityShadowDistanceMul = 0.25; // [0.01 0.02 0.03 0.04 0.05 0.10 0. #define ambientsss_brightness 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] #define sss_absorbance_multiplier 1.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 6.0 7.0 8.0 9.0 10.0] #define sss_density_multiplier 1.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 6.0 7.0 8.0 9.0 10.0] - +#define SCREENSPACE_DIRECT_SSS_BLENDING 0.5 // [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0] // #define Porosity //#define Puddles // yes @@ -559,9 +559,6 @@ uniform int moonPhase; #define RESPONSIVE_TAA // #define TAA_UPSCALING // #define SCREENSHOT_MODE -#ifdef SCREENSHOT_MODE - #undef RESPONSIVE_TAA -#endif #define BLEND_FACTOR 0.125 // [0.01 0.02 0.03 0.04 0.05 0.06 0.08 0.1 0.12 0.125 0.14 0.16 0.18 0.20 0.25 0.30 0.40 0.50 0.60 0.70 0.80 0.90 1.00] @@ -596,7 +593,7 @@ uniform int moonPhase; #define CONTRAST_ADAPTATIVE_SHARPENING #define SHARPENING 0.45 // [0.0 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 SATURATION 0.00 // [-1.0 -0.98 -0.96 -0.94 -0.92 -0.9 -0.88 -0.86 -0.84 -0.82 -0.8 -0.78 -0.76 -0.74 -0.72 -0.7 -0.68 -0.66 -0.64 -0.62 -0.6 -0.58 -0.56 -0.54 -0.52 -0.5 -0.48 -0.46 -0.44 -0.42 -0.4 -0.38 -0.36 -0.34 -0.32 -0.3 -0.28 -0.26 -0.24 -0.22 -0.2 -0.18 -0.16 -0.14 -0.12 -0.1 -0.08 -0.06 -0.04 -0.02 0.0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 0.38 0.4 0.42 0.44 0.46 0.48 0.5 0.52 0.54 0.56 0.58 0.6 0.62 0.64 0.66 0.68 0.7 0.72 0.74 0.76 0.78 0.8 0.82 0.84 0.86 0.88 0.9 0.92 0.94 0.96 0.98 1.0 ]= +#define SATURATION 0.0 // [-1.0 -0.98 -0.96 -0.94 -0.92 -0.9 -0.88 -0.86 -0.84 -0.82 -0.8 -0.78 -0.76 -0.74 -0.72 -0.7 -0.68 -0.66 -0.64 -0.62 -0.6 -0.58 -0.56 -0.54 -0.52 -0.5 -0.48 -0.46 -0.44 -0.42 -0.4 -0.38 -0.36 -0.34 -0.32 -0.3 -0.28 -0.26 -0.24 -0.22 -0.2 -0.18 -0.16 -0.14 -0.12 -0.1 -0.08 -0.06 -0.04 -0.02 0.0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 0.38 0.4 0.42 0.44 0.46 0.48 0.5 0.52 0.54 0.56 0.58 0.6 0.62 0.64 0.66 0.68 0.7 0.72 0.74 0.76 0.78 0.8 0.82 0.84 0.86 0.88 0.9 0.92 0.94 0.96 0.98 1.0 ]= #define CROSSTALK 0.0 // [-1.0 -0.98 -0.96 -0.94 -0.92 -0.9 -0.88 -0.86 -0.84 -0.82 -0.8 -0.78 -0.76 -0.74 -0.72 -0.7 -0.68 -0.66 -0.64 -0.62 -0.6 -0.58 -0.56 -0.54 -0.52 -0.5 -0.48 -0.46 -0.44 -0.42 -0.4 -0.38 -0.36 -0.34 -0.32 -0.3 -0.28 -0.26 -0.24 -0.22 -0.2 -0.18 -0.16 -0.14 -0.12 -0.1 -0.08 -0.06 -0.04 -0.02 0.0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34 0.36 0.38 0.4 0.42 0.44 0.46 0.48 0.5 0.52 0.54 0.56 0.58 0.6 0.62 0.64 0.66 0.68 0.7 0.72 0.74 0.76 0.78 0.8 0.82 0.84 0.86 0.88 0.9 0.92 0.94 0.96 0.98 1.0 ] // #define LUMINANCE_CURVE @@ -785,7 +782,8 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) #define PLANET_GROUND_BRIGHTNESS 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 ] -#define OLD_LIGHTLEAK_FIX +// #define OLD_LIGHTLEAK_FIX +#define LIGHTLEAKFIX_MODE 1 // [0 1 2] #define LIT_PARTICLE_BRIGHTNESS 1.0 // [1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 15.0 20.0 25.0 30.0 35.0 40.0 45.0 50.0 100.] diff --git a/shaders/lib/volumetricClouds.glsl b/shaders/lib/volumetricClouds.glsl index da02657..7292f52 100644 --- a/shaders/lib/volumetricClouds.glsl +++ b/shaders/lib/volumetricClouds.glsl @@ -790,7 +790,7 @@ vec4 GetVolumetricClouds( vec3 sunMultiScattering = directLightCol; vec3 moonScattering = directLightCol2 * (phaseCloud(SdotV2, 0.85) + phaseCloud(SdotV2, 0.75)) * 3.14; vec3 moonMultiScattering = directLightCol2; - vec3 skyScattering = indirectLightCol * 2.0; + vec3 skyScattering = indirectLightCol * (1.0 + pow(1.0-pow(1.0-clamp(sunVector.y,0.0,1.0),5.0),5.0));; vec3 sunScattering2 = sunScattering * sunVis; vec3 sunMultiScattering2 = sunMultiScattering * sunVis; diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 6f0a53a..685a070 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -174,7 +174,7 @@ alphaTest.gbuffers_water = false alphaTest.gbuffers_skybasic = false alphaTest.gbuffers_skytextured = false -sliders = RAIN_AMBIENT_LIGHT_MODIFIER EMISSIVE_ORES_STRENGTH RIPPLE_STRENGTH RIPPLE_INTENSITY CUSTOM_LIGHTNING_SCALE CUSTOM_LIGHTNING_R CUSTOM_LIGHTNING_G CUSTOM_LIGHTNING_B CUSTOM_LIGHTNING_TEX CUSTOM_LIGHTNING_POS_X CUSTOM_LIGHTNING_POS_Y CUSTOM_LIGHTNING_POS_Z CUMULONIMBUS_LIGHTNING_BRIGHTNESS CUMULONIMBUS_LIGHTNING_DELAY ShaderSnow ShaderSnowStrength BorderFogIntensity CAVE_DETECTION ON_FIRE_DISTORT_EFFECT_STRENGTH USE_CUSTOM_SKY_GROUND_LIGHTING_COLORS DIRECTLIGHT_DIFFUSE_R DIRECTLIGHT_DIFFUSE_G DIRECTLIGHT_DIFFUSE_B INDIRECTLIGHT_DIFFUSE_R INDIRECTLIGHT_DIFFUSE_G INDIRECTLIGHT_DIFFUSE_B DIRECTLIGHT_CLOUDS_R DIRECTLIGHT_CLOUDS_G DIRECTLIGHT_CLOUDS_B INDIRECTLIGHT_CLOUDS_R INDIRECTLIGHT_CLOUDS_G INDIRECTLIGHT_CLOUDS_B DIRECTLIGHT_FOG_R DIRECTLIGHT_FOG_G DIRECTLIGHT_FOG_B INDIRECTLIGHT_FOG_R INDIRECTLIGHT_FOG_G INDIRECTLIGHT_FOG_B SKY_GROUND_R SKY_GROUND_G SKY_GROUND_B DOF_DISPERSION_MULT FLASHLIGHT_BRIGHTNESS_MULT FLASHLIGHT_BRIGHTNESS_FALLOFF_MULT FLASHLIGHT_RANGE FLASHLIGHT_SIZE FLASHLIGHT_R FLASHLIGHT_G FLASHLIGHT_B LOW_HEALTH_EFFECT_START CRITICALLY_LOW_HEALTH_EFFECT_START CloudLayer2_scale CloudLayer0_scale CloudLayer1_scale CloudLayer3_scale CloudLayer0_tallness CloudLayer1_tallness EXPOSURE_DARKENING EXPOSURE_BRIGHTENING VIGNETTE_STRENGTH CURVATURE_AMOUNT MINIMUM_WATER_ABSORBANCE CHROMATIC_ABERRATION_STRENGTH SELECT_BOX_COL_R SELECT_BOX_COL_G SELECT_BOX_COL_B LPV_VL_FOG_ILLUMINATION_BRIGHTNESS minRayMarchSteps MOTION_BLUR_STRENGTH OVERDRAW_MAX_DISTANCE DAY0_l3_coverage DAY0_l3_density DAY1_l3_coverage DAY1_l3_density DAY2_l3_coverage DAY2_l3_density DAY3_l3_coverage DAY3_l3_density DAY4_l3_coverage DAY4_l3_density DAY5_l3_coverage DAY5_l3_density DAY6_l3_coverage DAY6_l3_density DAY7_l3_coverage DAY7_l3_density DAY8_l3_coverage DAY8_l3_density DAY9_l3_coverage DAY9_l3_density DAY0_l0_coverage DAY0_l1_coverage DAY0_l2_coverage DAY0_ufog_density DAY0_l0_density DAY0_l1_density DAY0_l2_density DAY0_cfog_density DAY1_l0_coverage DAY1_l1_coverage DAY1_l2_coverage DAY1_ufog_density DAY1_l0_density DAY1_l1_density DAY1_l2_density DAY1_cfog_density DAY2_l0_coverage DAY2_l1_coverage DAY2_l2_coverage DAY2_ufog_density DAY2_l0_density DAY2_l1_density DAY2_l2_density DAY2_cfog_density DAY3_l0_coverage DAY3_l1_coverage DAY3_l2_coverage DAY3_ufog_density DAY3_l0_density DAY3_l1_density DAY3_l2_density DAY3_cfog_density DAY4_l0_coverage DAY4_l1_coverage DAY4_l2_coverage DAY4_ufog_density DAY4_l0_density DAY4_l1_density DAY4_l2_density DAY4_cfog_density DAY5_l0_coverage DAY5_l1_coverage DAY5_l2_coverage DAY5_ufog_density DAY5_l0_density DAY5_l1_density DAY5_l2_density DAY5_cfog_density DAY6_l0_coverage DAY6_l1_coverage DAY6_l2_coverage DAY6_ufog_density DAY6_l0_density DAY6_l1_density DAY6_l2_density DAY6_cfog_density DAY7_l0_coverage DAY7_l1_coverage DAY7_l2_coverage DAY7_ufog_density DAY7_l0_density DAY7_l1_density DAY7_l2_density DAY7_cfog_density DAY8_l0_coverage DAY8_l1_coverage DAY8_l2_coverage DAY8_ufog_density DAY8_l0_density DAY8_l1_density DAY8_l2_density DAY8_cfog_density DAY9_l0_coverage DAY9_l1_coverage DAY9_l2_coverage DAY9_ufog_density DAY9_l0_density DAY9_l1_density DAY9_l2_density DAY9_cfog_density sss_density_multiplier sss_absorbance_multiplier MOTION_AMOUNT TONEMAP WATER_WAVE_SPEED WATER_CAUSTICS_BRIGHTNESS WATER_CAUSTICS_POWER DEBUG_VIEW entityShadowDistanceMul HANDHELD_LIGHT_RANGE CLOUD_SHADOW_STRENGTH CloudLayer0_coverage CloudLayer0_density CloudLayer0_height CloudLayer1_coverage CloudLayer1_density CloudLayer1_height CloudLayer2_coverage CloudLayer2_density CloudLayer2_height CloudLayer3_coverage CloudLayer3_density CloudLayer3_height PLANET_GROUND_BRIGHTNESS FOG_START_HEIGHT WATER_WAVE_STRENGTH SWAMP_UNIFORM_DENSITY SWAMP_CLOUDY_DENSITY SWAMP_R SWAMP_G SWAMP_B JUNGLE_UNIFORM_DENSITY JUNGLE_CLOUDY_DENSITY JUNGLE_R JUNGLE_G JUNGLE_B DARKFOREST_UNIFORM_DENSITY DARKFOREST_CLOUDY_DENSITY DARKFOREST_R DARKFOREST_G DARKFOREST_B NETHER_PLUME_DENSITY END_STORM_DENSTIY LIT_PARTICLE_BRIGHTNESS UPPER_CURVE LOWER_CURVE EMISSIVE_TYPE SCALE_FACTOR ambientsss_brightness SSS_TYPE Cloud_Speed Cloud_Speed_Rain Cloud_Speed_Thunder ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Thunder_coverage Moon_temp Haze_amount RainFog_amount Sun_temp Puddle_Size Puddle_Reflection_Strength LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS DOF_JITTER_FOCUS JITTER_STRENGTH SHADOWS_GRADE_R MIDS_GRADE_R HIGHLIGHTS_GRADE_R SHADOWS_GRADE_G MIDS_GRADE_G HIGHLIGHTS_GRADE_G SHADOWS_GRADE_B MIDS_GRADE_B HIGHLIGHTS_GRADE_B SHADOWS_GRADE_MUL MIDS_GRADE_MUL HIGHLIGHTS_GRADE_MUL LPV_SATURATION LPV_TINT_SATURATION LPV_NORMAL_STRENGTH +sliders = LIGHTLEAKFIX_MODE RAIN_AMBIENT_LIGHT_MODIFIER EMISSIVE_ORES_STRENGTH RIPPLE_STRENGTH RIPPLE_INTENSITY CUSTOM_LIGHTNING_SCALE CUSTOM_LIGHTNING_R CUSTOM_LIGHTNING_G CUSTOM_LIGHTNING_B CUSTOM_LIGHTNING_TEX CUSTOM_LIGHTNING_POS_X CUSTOM_LIGHTNING_POS_Y CUSTOM_LIGHTNING_POS_Z CUMULONIMBUS_LIGHTNING_BRIGHTNESS CUMULONIMBUS_LIGHTNING_DELAY ShaderSnow ShaderSnowStrength BorderFogIntensity CAVE_DETECTION ON_FIRE_DISTORT_EFFECT_STRENGTH USE_CUSTOM_SKY_GROUND_LIGHTING_COLORS DIRECTLIGHT_DIFFUSE_R DIRECTLIGHT_DIFFUSE_G DIRECTLIGHT_DIFFUSE_B INDIRECTLIGHT_DIFFUSE_R INDIRECTLIGHT_DIFFUSE_G INDIRECTLIGHT_DIFFUSE_B DIRECTLIGHT_CLOUDS_R DIRECTLIGHT_CLOUDS_G DIRECTLIGHT_CLOUDS_B INDIRECTLIGHT_CLOUDS_R INDIRECTLIGHT_CLOUDS_G INDIRECTLIGHT_CLOUDS_B DIRECTLIGHT_FOG_R DIRECTLIGHT_FOG_G DIRECTLIGHT_FOG_B INDIRECTLIGHT_FOG_R INDIRECTLIGHT_FOG_G INDIRECTLIGHT_FOG_B SKY_GROUND_R SKY_GROUND_G SKY_GROUND_B DOF_DISPERSION_MULT FLASHLIGHT_BRIGHTNESS_MULT FLASHLIGHT_BRIGHTNESS_FALLOFF_MULT FLASHLIGHT_RANGE FLASHLIGHT_SIZE FLASHLIGHT_R FLASHLIGHT_G FLASHLIGHT_B LOW_HEALTH_EFFECT_START CRITICALLY_LOW_HEALTH_EFFECT_START CloudLayer2_scale CloudLayer0_scale CloudLayer1_scale CloudLayer3_scale CloudLayer0_tallness CloudLayer1_tallness EXPOSURE_DARKENING EXPOSURE_BRIGHTENING VIGNETTE_STRENGTH CURVATURE_AMOUNT MINIMUM_WATER_ABSORBANCE CHROMATIC_ABERRATION_STRENGTH SELECT_BOX_COL_R SELECT_BOX_COL_G SELECT_BOX_COL_B LPV_VL_FOG_ILLUMINATION_BRIGHTNESS minRayMarchSteps MOTION_BLUR_STRENGTH OVERDRAW_MAX_DISTANCE DAY0_l3_coverage DAY0_l3_density DAY1_l3_coverage DAY1_l3_density DAY2_l3_coverage DAY2_l3_density DAY3_l3_coverage DAY3_l3_density DAY4_l3_coverage DAY4_l3_density DAY5_l3_coverage DAY5_l3_density DAY6_l3_coverage DAY6_l3_density DAY7_l3_coverage DAY7_l3_density DAY8_l3_coverage DAY8_l3_density DAY9_l3_coverage DAY9_l3_density DAY0_l0_coverage DAY0_l1_coverage DAY0_l2_coverage DAY0_ufog_density DAY0_l0_density DAY0_l1_density DAY0_l2_density DAY0_cfog_density DAY1_l0_coverage DAY1_l1_coverage DAY1_l2_coverage DAY1_ufog_density DAY1_l0_density DAY1_l1_density DAY1_l2_density DAY1_cfog_density DAY2_l0_coverage DAY2_l1_coverage DAY2_l2_coverage DAY2_ufog_density DAY2_l0_density DAY2_l1_density DAY2_l2_density DAY2_cfog_density DAY3_l0_coverage DAY3_l1_coverage DAY3_l2_coverage DAY3_ufog_density DAY3_l0_density DAY3_l1_density DAY3_l2_density DAY3_cfog_density DAY4_l0_coverage DAY4_l1_coverage DAY4_l2_coverage DAY4_ufog_density DAY4_l0_density DAY4_l1_density DAY4_l2_density DAY4_cfog_density DAY5_l0_coverage DAY5_l1_coverage DAY5_l2_coverage DAY5_ufog_density DAY5_l0_density DAY5_l1_density DAY5_l2_density DAY5_cfog_density DAY6_l0_coverage DAY6_l1_coverage DAY6_l2_coverage DAY6_ufog_density DAY6_l0_density DAY6_l1_density DAY6_l2_density DAY6_cfog_density DAY7_l0_coverage DAY7_l1_coverage DAY7_l2_coverage DAY7_ufog_density DAY7_l0_density DAY7_l1_density DAY7_l2_density DAY7_cfog_density DAY8_l0_coverage DAY8_l1_coverage DAY8_l2_coverage DAY8_ufog_density DAY8_l0_density DAY8_l1_density DAY8_l2_density DAY8_cfog_density DAY9_l0_coverage DAY9_l1_coverage DAY9_l2_coverage DAY9_ufog_density DAY9_l0_density DAY9_l1_density DAY9_l2_density DAY9_cfog_density sss_density_multiplier sss_absorbance_multiplier MOTION_AMOUNT TONEMAP WATER_WAVE_SPEED WATER_CAUSTICS_BRIGHTNESS WATER_CAUSTICS_POWER DEBUG_VIEW entityShadowDistanceMul HANDHELD_LIGHT_RANGE CLOUD_SHADOW_STRENGTH CloudLayer0_coverage CloudLayer0_density CloudLayer0_height CloudLayer1_coverage CloudLayer1_density CloudLayer1_height CloudLayer2_coverage CloudLayer2_density CloudLayer2_height CloudLayer3_coverage CloudLayer3_density CloudLayer3_height PLANET_GROUND_BRIGHTNESS FOG_START_HEIGHT WATER_WAVE_STRENGTH SWAMP_UNIFORM_DENSITY SWAMP_CLOUDY_DENSITY SWAMP_R SWAMP_G SWAMP_B JUNGLE_UNIFORM_DENSITY JUNGLE_CLOUDY_DENSITY JUNGLE_R JUNGLE_G JUNGLE_B DARKFOREST_UNIFORM_DENSITY DARKFOREST_CLOUDY_DENSITY DARKFOREST_R DARKFOREST_G DARKFOREST_B NETHER_PLUME_DENSITY END_STORM_DENSTIY LIT_PARTICLE_BRIGHTNESS UPPER_CURVE LOWER_CURVE EMISSIVE_TYPE SCALE_FACTOR ambientsss_brightness SSS_TYPE Cloud_Speed Cloud_Speed_Rain Cloud_Speed_Thunder ORB_ColMult ORB_X ORB_Y ORB_Z ORB_R ORB_G ORB_B TOD_Fog_mult Morning_Uniform_Fog Noon_Uniform_Fog Evening_Uniform_Fog Night_Uniform_Fog Morning_Cloudy_Fog Noon_Cloudy_Fog Evening_Cloudy_Fog Night_Cloudy_Fog Summer_Leaf_R Summer_Leaf_G Summer_Leaf_B Fall_Leaf_R Fall_Leaf_G Fall_Leaf_B Winter_Leaf_R Winter_Leaf_G Winter_Leaf_B Spring_Leaf_R Spring_Leaf_G Spring_Leaf_B Summer_R Summer_G Summer_B Fall_R Fall_G Fall_B Winter_R Winter_G Winter_B Spring_R Spring_G Spring_B Season_Length CaveFogFallOff CaveFogColor_R CaveFogColor_G CaveFogColor_B indirect_effect GI_Strength ambient_brightness AmbientLight_R AmbientLight_G AmbientLight_B Rain_coverage Thunder_coverage Moon_temp Haze_amount RainFog_amount Sun_temp Puddle_Size Puddle_Reflection_Strength LabSSS_Curve Emissive_Curve Emissive_Brightness AO_Strength BLOOMY_FOG WAVY_SPEED WAVY_STRENGTH BLOOM_STRENGTH shadowDistance Sky_Brightness fog_coefficientMieR fog_coefficientMieG fog_coefficientMieB sun_illuminance sunColorG sunColorB sunColorR sky_mieg sky_coefficientMieB sky_coefficientMieG sky_coefficientMieR sky_coefficientRayleighB sky_coefficientRayleighG sky_coefficientRayleighR CLOUDS_QUALITY EXPOSURE_MULTIPLIER MIN_LIGHT_AMOUNT TORCH_R TORCH_G TORCH_B TORCH_AMOUNT shadowMapResolution sunPathRotation BLEND_FACTOR VL_SAMPLES Exposure_Speed POM_DEPTH MAX_ITERATIONS MAX_DIST SSR_STEPS ambientOcclusionLevel SEA_LEVEL moon_illuminance moonColorR moonColorG moonColorB fog_coefficientRayleighR fog_coefficientRayleighG SATURATION Manual_exposure_value focal aperture MANUAL_FOCUS SHADOW_FILTER_SAMPLE_COUNT Max_Filter_Depth VPS_Search_Samples Min_Shadow_Filter_Radius Max_Shadow_Filter_Radius Water_Top_Layer fog_coefficientRayleighB SHARPENING rayMarchSampleCount Dirt_Amount Dirt_Scatter_R Dirt_Scatter_G Dirt_Scatter_B Dirt_Absorb_R Dirt_Absorb_G Dirt_Absorb_B Water_Absorb_R Water_Absorb_G Water_Absorb_B Purkinje_strength Purkinje_strength Purkinje_R Purkinje_G Purkinje_B Texture_MipMap_Bias DoF_Adaptation_Speed Purkinje_Multiplier CROSSTALK VL_RENDER_RESOLUTION BLOOM_QUALITY VL_RENDER_RESOLUTION RAY_COUNT STEPS STEP_LENGTH cloud_LevelOfDetail cloud_ShadowLevelOfDetail cloud_LevelOfDetailLQ cloud_ShadowLevelOfDetailLQ minRayMarchSteps maxRayMarchSteps minRayMarchStepsLQ maxRayMarchStepsLQ fbmAmount fbmPower1 fbmPower2 Roughness_Threshold Sun_specular_Strength reflection_quality DOF_QUALITY DOF_ANAMORPHIC_RATIO AEROCHROME_PINKNESS DOF_JITTER_FOCUS JITTER_STRENGTH SHADOWS_GRADE_R MIDS_GRADE_R HIGHLIGHTS_GRADE_R SHADOWS_GRADE_G MIDS_GRADE_G HIGHLIGHTS_GRADE_G SHADOWS_GRADE_B MIDS_GRADE_B HIGHLIGHTS_GRADE_B SHADOWS_GRADE_MUL MIDS_GRADE_MUL HIGHLIGHTS_GRADE_MUL LPV_SATURATION LPV_TINT_SATURATION LPV_NORMAL_STRENGTH screen.columns=2 screen = \ @@ -190,7 +190,7 @@ SHADER_VERSION_LABEL \ ######## LIGHTING ### DIRECT LIGHT screen.Direct_Light.columns=1 - screen.Direct_Light =[Shadows] [Subsurface_Scattering] [Sun_and_Moon_Colors] OLD_LIGHTLEAK_FIX sunPathRotation sun_illuminance MOONPHASE_BASED_MOONLIGHT moon_illuminance REALMOON + screen.Direct_Light =[Shadows] [Subsurface_Scattering] [Sun_and_Moon_Colors] LIGHTLEAKFIX_MODE sunPathRotation sun_illuminance moon_illuminance MOONPHASE_BASED_MOONLIGHT REALMOON screen.Shadows.columns=1 screen.Shadows = TRANSLUCENT_COLORED_SHADOWS SCREENSPACE_CONTACT_SHADOWS RENDER_ENTITY_SHADOWS RENDER_PLAYER_SHADOWS entityShadowDistanceMul [Filtering] shadowMapResolution shadowDistance OPTIMIZED_SHADOW_DISTANCE @@ -206,10 +206,9 @@ SHADER_VERSION_LABEL \ screen.Ambient_light = [LPV] [Torch_Colors] [Ambient_Colors] \ MIN_LIGHT_AMOUNT indirect_effect \ RAY_COUNT \ - AO_Strength AO_in_sunlight GI_Strength \ - ambientOcclusionLevel HQ_SSGI \ - Hand_Held_lights SKY_CONTRIBUTION_IN_SSRT \ - HANDHELD_LIGHT_RANGE UseQuarterResDepth RAIN_AMBIENT_LIGHT_MODIFIER + AO_in_sunlight AO_Strength GI_Strength \ + ambientOcclusionLevel Hand_Held_lights HANDHELD_LIGHT_RANGE HQ_SSGI \ + SKY_CONTRIBUTION_IN_SSRT UseQuarterResDepth \ screen.Torch_Colors.columns=1 screen.Torch_Colors = TORCH_AMOUNT Emissive_Brightness Emissive_Curve TORCH_R TORCH_G TORCH_B @@ -230,7 +229,7 @@ SHADER_VERSION_LABEL \ Sun_specular_Strength Roughness_Threshold screen.Subsurface_Scattering.columns=1 - screen.Subsurface_Scattering = SSS_TYPE sss_density_multiplier sss_absorbance_multiplier LabSSS_Curve MISC_BLOCK_SSS MOB_SSS Ambient_SSS ambientsss_brightness + screen.Subsurface_Scattering = SSS_TYPE sss_density_multiplier sss_absorbance_multiplier LabSSS_Curve MISC_BLOCK_SSS MOB_SSS Ambient_SSS ambientsss_brightness SCREENSPACE_DIRECT_SSS_BLENDING screen.Emissives.columns = 1 screen.Emissives = EMISSIVE_TYPE Emissive_Brightness Emissive_Curve @@ -610,6 +609,15 @@ uniform.float.snowAmount = 0.0 uniform.float.snowAmount = 1.0 #endif + +#in(biome_category, CAT_ICY) +# in(biome_category, CAT_DESERT, CAT_SAVANNA, CAT_MESA) + +uniform.bool.isInColdArea = temperature < 0.4 +uniform.bool.isInHotArea = temperature > 1.0 +uniform.bool.isInJungleBiomes = in(biome_category, CAT_JUNGLE) + + # the idea is to record the altitude at which you entered a body of water. # using the smooth() function to interpolate to the newest value of eyeAltitude over time, i can make it take a very long time to interpolate. essentially freezing/unfreezing the value in place at any time i need to. @@ -619,6 +627,15 @@ variable.float.waterEnteredLowLight = if(eyeBrightness.y < 0.004, max(eyeAltitud variable.float.freezeTranstion = if(isEyeInWater == 1, 100000000000000.0, 0.0) uniform.float.waterEnteredAltitude = smooth(waterEnteredLowLight, freezeTranstion, freezeTranstion) + +variable.float.exitedBiomePos_X = smooth(cameraPosition.x, freezeCameraPos, freezeCameraPos) +variable.float.exitedBiomePos_Y = smooth(cameraPosition.y, freezeCameraPos, freezeCameraPos) +variable.float.exitedBiomePos_Z = smooth(cameraPosition.z, freezeCameraPos, freezeCameraPos) +variable.vec3.VARexitedBiomePos = vec3(exitedBiomePos_X, exitedBiomePos_Y, exitedBiomePos_Z) + +variable.float.distanceTreshold = 200.0 +variable.bool.checkDistanceEpislonFromExitPos = equals(cameraPosition.x, VARexitedBiomePos.x, distanceTreshold) && equals(cameraPosition.y, VARexitedBiomePos.y, distanceTreshold) && equals(cameraPosition.z, VARexitedBiomePos.z, distanceTreshold) + # photon stuff uniform.vec2.view_res = vec2(viewWidth, viewHeight) uniform.vec2.view_pixel_size = vec2(1.0 / viewWidth, 1.0 / viewHeight)