diff --git a/shaders/dimension.properties b/shaders/dimension.properties index feb8c9a..59dc943 100644 --- a/shaders/dimension.properties +++ b/shaders/dimension.properties @@ -8,8 +8,8 @@ # dimension.world-1 = minecraft:the_nether # dimension.WHATEVER = somemod:whateverdimension -dimension.world0 = minecraft:overworld * +dimension.world0 = minecraft:overworld dimension.world-1 = minecraft:the_nether -dimension.world1 = minecraft:the_end +dimension.world1 = minecraft:the_end -# dimension.unknown_dimension_fallback = * \ No newline at end of file +dimension.worldx = * diff --git a/shaders/dimensions/DH_solid.vsh b/shaders/dimensions/DH_solid.vsh index bb4edef..bab0fb9 100644 --- a/shaders/dimensions/DH_solid.vsh +++ b/shaders/dimensions/DH_solid.vsh @@ -21,14 +21,8 @@ uniform float far; #include "/lib/bokeh.glsl" #endif -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +#include "/lib/TAA_jitter.glsl" + /* diff --git a/shaders/dimensions/DH_translucent.fsh b/shaders/dimensions/DH_translucent.fsh index a215a8b..950b54a 100644 --- a/shaders/dimensions/DH_translucent.fsh +++ b/shaders/dimensions/DH_translucent.fsh @@ -143,14 +143,8 @@ float GGX(vec3 n, vec3 v, vec3 l, float r, float f0) { uniform int framemod8; -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +#include "/lib/TAA_jitter.glsl" + // float DH_ld(float dist) { diff --git a/shaders/dimensions/DH_translucent.vsh b/shaders/dimensions/DH_translucent.vsh index 4c5ad9e..458b070 100644 --- a/shaders/dimensions/DH_translucent.vsh +++ b/shaders/dimensions/DH_translucent.vsh @@ -44,14 +44,8 @@ uniform float far; #endif -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +#include "/lib/TAA_jitter.glsl" + uniform vec3 cameraPosition; diff --git a/shaders/dimensions/all_particles.fsh b/shaders/dimensions/all_particles.fsh index 9196264..3501d20 100644 --- a/shaders/dimensions/all_particles.fsh +++ b/shaders/dimensions/all_particles.fsh @@ -104,14 +104,8 @@ vec3 toScreenSpace(vec3 p) { uniform int framemod8; -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +#include "/lib/TAA_jitter.glsl" + //Mie phase function float phaseg(float x, float g){ diff --git a/shaders/dimensions/all_particles.vsh b/shaders/dimensions/all_particles.vsh index 142b033..20114e5 100644 --- a/shaders/dimensions/all_particles.vsh +++ b/shaders/dimensions/all_particles.vsh @@ -45,14 +45,7 @@ uniform int heldItemId; uniform int heldItemId2; flat varying float HELD_ITEM_BRIGHTNESS; -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +#include "/lib/TAA_jitter.glsl" #define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) #define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) diff --git a/shaders/dimensions/all_solid.fsh b/shaders/dimensions/all_solid.fsh index cb911a7..c5f5ab2 100644 --- a/shaders/dimensions/all_solid.fsh +++ b/shaders/dimensions/all_solid.fsh @@ -308,7 +308,7 @@ void main() { tangent.z, tangent2.z, normal.z); #endif - vec2 tempOffset=offsets[framemod8]; + vec2 tempOffset = offsets[framemod8]; vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5,0.0)); vec3 worldpos = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz + cameraPosition; @@ -351,14 +351,15 @@ void main() { if(!ifPOM) maxdist = 0.0; gl_FragDepth = gl_FragCoord.z; - + // coord += noise*interval; + // float sumVec = noise; if (dist < maxdist) { float depthmap = readNormal(vtexcoord.st).a; float used_POM_DEPTH = 1.0; if ( viewVector.z < 0.0 && depthmap < 0.9999 && depthmap > 0.00001) { - // float noise = blueNoise(); + float noise = blueNoise(); #ifdef Adaptive_Step_length vec3 interval = (viewVector.xyz /-viewVector.z/MAX_OCCLUSION_POINTS * POM_DEPTH) * clamp(1.0-pow(depthmap,2),0.1,1.0); used_POM_DEPTH = 1.0; @@ -367,9 +368,9 @@ void main() { #endif vec3 coord = vec3(vtexcoord.st , 1.0); - coord += interval * used_POM_DEPTH; + coord += interval * noise * used_POM_DEPTH; - float sumVec = 0.5; + float sumVec = noise; for (int loopCount = 0; (loopCount < MAX_OCCLUSION_POINTS) && (1.0 - POM_DEPTH + POM_DEPTH * readNormal(coord.st).a ) < coord.p && coord.p >= 0.0; ++loopCount) { coord = coord + interval * used_POM_DEPTH; sumVec += used_POM_DEPTH; diff --git a/shaders/dimensions/all_solid.vsh b/shaders/dimensions/all_solid.vsh index 093bee2..02a4096 100644 --- a/shaders/dimensions/all_solid.vsh +++ b/shaders/dimensions/all_solid.vsh @@ -91,14 +91,9 @@ uniform vec3 cameraPosition; uniform vec2 texelSize; uniform int framemod8; -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +#include "/lib/TAA_jitter.glsl" + + #define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) #define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) diff --git a/shaders/dimensions/all_translucent.fsh b/shaders/dimensions/all_translucent.fsh index d8a8edb..5ad2ac8 100644 --- a/shaders/dimensions/all_translucent.fsh +++ b/shaders/dimensions/all_translucent.fsh @@ -152,14 +152,8 @@ float R2_dither(){ return fract(alpha.x * coord.x + alpha.y * coord.y ) ; } -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +#include "/lib/TAA_jitter.glsl" + diff --git a/shaders/dimensions/all_translucent.vsh b/shaders/dimensions/all_translucent.vsh index d328cda..db0fdf6 100644 --- a/shaders/dimensions/all_translucent.vsh +++ b/shaders/dimensions/all_translucent.vsh @@ -71,14 +71,8 @@ flat varying float HELD_ITEM_BRIGHTNESS; uniform vec2 texelSize; uniform int framemod8; -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +#include "/lib/TAA_jitter.glsl" + #define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) #define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) diff --git a/shaders/dimensions/all_vanilla_emissives.vsh b/shaders/dimensions/all_vanilla_emissives.vsh index 663d868..e6c6073 100644 --- a/shaders/dimensions/all_vanilla_emissives.vsh +++ b/shaders/dimensions/all_vanilla_emissives.vsh @@ -18,14 +18,8 @@ attribute vec4 at_tangent; uniform vec2 texelSize; uniform int framemod8; -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +#include "/lib/TAA_jitter.glsl" + #define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) #define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) diff --git a/shaders/dimensions/composite.vsh b/shaders/dimensions/composite.vsh index 772c571..785dc42 100644 --- a/shaders/dimensions/composite.vsh +++ b/shaders/dimensions/composite.vsh @@ -17,14 +17,9 @@ uniform mat4 gbufferModelViewInverse; #include "/lib/res_params.glsl" uniform int framemod8; -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); + +#include "/lib/TAA_jitter.glsl" + void main() { gl_Position = ftransform(); diff --git a/shaders/dimensions/composite1.fsh b/shaders/dimensions/composite1.fsh index ca975a7..3bbc665 100644 --- a/shaders/dimensions/composite1.fsh +++ b/shaders/dimensions/composite1.fsh @@ -742,7 +742,7 @@ vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){ float scatterDepth = 1.0 - pow(Scattering, 0.5 + Density * 2.5); // PBR at its finest :clueless: - vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -(15.0 - 10.0*scatterDepth) * sss_absorbance_multiplier); + vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -(15.0 - 10.0*scatterDepth) * sss_absorbance_multiplier * 0.01); vec3 scatter = scatterDepth * absorbColor * pow(Density, LabSSS_Curve); @@ -1283,7 +1283,6 @@ void main() { #ifdef OVERWORLD_SHADER Direct_lighting = max(DirectLightColor * NdotL * Shadows, DirectLightColor * Direct_SSS); - // Direct_lighting = DirectLightColor * Direct_SSS; #endif gl_FragData[0].rgb = (Indirect_lighting + Direct_lighting) * albedo; @@ -1343,6 +1342,8 @@ void main() { // if(swappedDepth >= 1.0) gl_FragData[0].rgb = vec3(0.1); // gl_FragData[0].rgb = vec3(1) * ld(texture2D(depthtex1, texcoord).r); // if(texcoord.x > 0.5 )gl_FragData[0].rgb = vec3(1) * ld(texture2D(depthtex0, texcoord).r); - + + + /* DRAWBUFFERS:3 */ } \ No newline at end of file diff --git a/shaders/dimensions/composite1.vsh b/shaders/dimensions/composite1.vsh index 985e0fe..39df506 100644 --- a/shaders/dimensions/composite1.vsh +++ b/shaders/dimensions/composite1.vsh @@ -32,14 +32,8 @@ uniform int frameCounter; uniform float frameTimeCounter; uniform int framemod8; -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +#include "/lib/TAA_jitter.glsl" + #include "/lib/util.glsl" diff --git a/shaders/dimensions/composite11.fsh b/shaders/dimensions/composite11.fsh index 84a5aac..5c98b4d 100644 --- a/shaders/dimensions/composite11.fsh +++ b/shaders/dimensions/composite11.fsh @@ -35,14 +35,8 @@ uniform vec4 Moon_Weather_properties; // R = cloud coverage G = fog density uniform int hideGUI; uniform int framemod8; -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +#include "/lib/TAA_jitter.glsl" + uniform mat4 gbufferModelViewInverse; uniform mat4 gbufferProjectionInverse; @@ -140,10 +134,10 @@ void main() { #ifdef OLD_BLOOM - vec3 bloom = texture2D(colortex3,texcoord/clampedRes*vec2(1920.,1080.)*BLOOM_QUALITY).rgb / 2.0 / 7.0; + vec3 bloom = texture2D(colortex3, texcoord/clampedRes*vec2(1920.,1080.)*BLOOM_QUALITY ).rgb / 2.0 / 7.0; float lightScat = clamp((BLOOM_STRENGTH+3) * 0.05 * pow(exposure.a, 0.2) ,0.0,1.0) * vignette; #else - vec3 bloom = texture2D(colortex3,texcoord/clampedRes*vec2(1920.,1080.)*BLOOM_QUALITY).rgb / 3.0 / bloomWeight(); + vec3 bloom = texture2D(colortex3, texcoord/clampedRes*vec2(1920.,1080.)*BLOOM_QUALITY ).rgb / 3.0 / bloomWeight(); float lightScat = clamp(BLOOM_STRENGTH * 0.5 * pow(exposure.a, 0.2) ,0.0,1.0) * vignette; #endif diff --git a/shaders/dimensions/composite2.fsh b/shaders/dimensions/composite2.fsh index aa418cf..e6eed28 100644 --- a/shaders/dimensions/composite2.fsh +++ b/shaders/dimensions/composite2.fsh @@ -351,6 +351,8 @@ float encodeVec2(vec2 a){ +// uniform int framemod8; +// #include "/lib/TAA_jitter.glsl" //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// @@ -369,7 +371,7 @@ void main() { float noise_1 = max(1.0 - R2_dither(),0.0015); float noise_2 = blueNoise(); - vec2 tc = floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize+0.5*texelSize; + vec2 tc = floor(gl_FragCoord.xy)/VL_RENDER_RESOLUTION*texelSize + texelSize*0.5; bool iswater = texture2D(colortex7,tc).a > 0.99; @@ -381,7 +383,7 @@ void main() { float DH_z0 = 0.0; #endif - vec3 viewPos0 = toScreenSpace_DH(tc/RENDER_SCALE, z0, DH_z0); + vec3 viewPos0 = toScreenSpace_DH(tc/RENDER_SCALE , z0, DH_z0); vec3 playerPos_normalized = normalize(mat3(gbufferModelViewInverse) * viewPos0 + gbufferModelViewInverse[3].xyz); @@ -418,7 +420,6 @@ void main() { #endif #if defined OVERWORLD_SHADER && defined CLOUDS_INTERSECT_TERRAIN - VolumetricFog = vec4(VolumetricClouds.rgb * VolumetricFog.a + VolumetricFog.rgb, VolumetricFog.a); #endif diff --git a/shaders/dimensions/composite2.vsh b/shaders/dimensions/composite2.vsh index 6ca7c7c..3f1c92f 100644 --- a/shaders/dimensions/composite2.vsh +++ b/shaders/dimensions/composite2.vsh @@ -32,14 +32,8 @@ uniform int frameCounter; flat varying vec2 TAA_Offset; uniform int framemod8; -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +#include "/lib/TAA_jitter.glsl" + //////////////////////////////VOID MAIN////////////////////////////// //////////////////////////////VOID MAIN////////////////////////////// diff --git a/shaders/dimensions/composite3.vsh b/shaders/dimensions/composite3.vsh index e12016d..3b7d4d0 100644 --- a/shaders/dimensions/composite3.vsh +++ b/shaders/dimensions/composite3.vsh @@ -20,14 +20,8 @@ uniform vec3 sunPosition; uniform float sunElevation; flat varying vec2 TAA_Offset; uniform int framemod8; -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +#include "/lib/TAA_jitter.glsl" + #ifdef OVERWORLD_SHADER diff --git a/shaders/dimensions/composite4.fsh b/shaders/dimensions/composite4.fsh index 505bca7..f203956 100644 --- a/shaders/dimensions/composite4.fsh +++ b/shaders/dimensions/composite4.fsh @@ -12,33 +12,56 @@ uniform sampler2D colortex3; void main() { /* DRAWBUFFERS:06 */ ivec2 center = ivec2(gl_FragCoord.xy); - vec3 current = texelFetch2D(colortex3, center, 0).rgb; - vec3 cMin = current; - vec3 cMax = current; - current = texelFetch2D(colortex3, center + ivec2(-1, -1), 0).rgb; - cMin = min(cMin, current); - cMax = max(cMax, current); - current = texelFetch2D(colortex3, center + ivec2(-1, 0), 0).rgb; - cMin = min(cMin, current); - cMax = max(cMax, current); - current = texelFetch2D(colortex3, center + ivec2(-1, 1), 0).rgb; - cMin = min(cMin, current); - cMax = max(cMax, current); - current = texelFetch2D(colortex3, center + ivec2(0, -1), 0).rgb; - cMin = min(cMin, current); - cMax = max(cMax, current); - current = texelFetch2D(colortex3, center + ivec2(0, 1), 0).rgb; - cMin = min(cMin, current); - cMax = max(cMax, current); - current = texelFetch2D(colortex3, center + ivec2(1, -1), 0).rgb; - cMin = min(cMin, current); - cMax = max(cMax, current); - current = texelFetch2D(colortex3, center + ivec2(1, 0), 0).rgb; - cMin = min(cMin, current); - cMax = max(cMax, current); - current = texelFetch2D(colortex3, center + ivec2(1, 1), 0).rgb; - cMin = min(cMin, current); - cMax = max(cMax, current); - gl_FragData[0].rgb = cMax; - gl_FragData[1].rgb = cMin; + + // vec3 current = texelFetch2D(colortex3, center, 0).rgb; + // vec3 cMin = current; + // vec3 cMax = current; + // current = texelFetch2D(colortex3, center + ivec2(-1, -1), 0).rgb; + // cMin = min(cMin, current); + // cMax = max(cMax, current); + // current = texelFetch2D(colortex3, center + ivec2(-1, 0), 0).rgb; + // cMin = min(cMin, current); + // cMax = max(cMax, current); + // current = texelFetch2D(colortex3, center + ivec2(-1, 1), 0).rgb; + // cMin = min(cMin, current); + // cMax = max(cMax, current); + // current = texelFetch2D(colortex3, center + ivec2(0, -1), 0).rgb; + // cMin = min(cMin, current); + // cMax = max(cMax, current); + // current = texelFetch2D(colortex3, center + ivec2(0, 1), 0).rgb; + // cMin = min(cMin, current); + // cMax = max(cMax, current); + // current = texelFetch2D(colortex3, center + ivec2(1, -1), 0).rgb; + // cMin = min(cMin, current); + // cMax = max(cMax, current); + // current = texelFetch2D(colortex3, center + ivec2(1, 0), 0).rgb; + // cMin = min(cMin, current); + // cMax = max(cMax, current); + // current = texelFetch2D(colortex3, center + ivec2(1, 1), 0).rgb; + // cMin = min(cMin, current); + // cMax = max(cMax, current); + // gl_FragData[0].rgb = cMax; + // gl_FragData[1].rgb = cMin; + + vec3 col0 = texelFetch2D(colortex3, center, 0).rgb; + vec3 col1 = texelFetch2D(colortex3, center + ivec2(1, 1), 0).rgb; + vec3 col2 = texelFetch2D(colortex3, center + ivec2(1, -1), 0).rgb; + vec3 col3 = texelFetch2D(colortex3, center + ivec2(-1, -1), 0).rgb; + vec3 col4 = texelFetch2D(colortex3, center + ivec2(-1, 1), 0).rgb; + vec3 col5 = texelFetch2D(colortex3, center + ivec2(0, 1), 0).rgb; + vec3 col6 = texelFetch2D(colortex3, center + ivec2(0, -1), 0).rgb; + vec3 col7 = texelFetch2D(colortex3, center + ivec2(-1, 0), 0).rgb; + vec3 col8 = texelFetch2D(colortex3, center + ivec2(1, 0), 0).rgb; + + vec3 colMax = max(col0,max(col1,max(col2,max(col3, max(col4, max(col5, max(col6, max(col7, col8)))))))); + vec3 colMin = min(col0,min(col1,min(col2,min(col3, min(col4, min(col5, min(col6, min(col7, col8)))))))); + + vec3 colMax5 = max(col0,max(col5,max(col6,max(col7,col8)))); + vec3 colMin5 = min(col0,min(col5,min(col6,min(col7,col8)))); + + colMin = 0.5 * (colMin + colMin5); + colMax = 0.5 * (colMax + colMax5); + + gl_FragData[0].rgb = colMax; + gl_FragData[1].rgb = colMin; } diff --git a/shaders/dimensions/composite5.fsh b/shaders/dimensions/composite5.fsh index d1d3110..2c6e7d1 100644 --- a/shaders/dimensions/composite5.fsh +++ b/shaders/dimensions/composite5.fsh @@ -45,7 +45,7 @@ const bool colortex15Clear = false; */ #else /* - const int colortex5Format = R11F_G11F_B10F; //TAA buffer (everything) + const int colortex5Format = RGBA16F; //TAA buffer (everything) */ #endif @@ -65,7 +65,6 @@ uniform sampler2D depthtex1; uniform vec2 texelSize; uniform float frameTimeCounter; -uniform int framemod8; uniform float viewHeight; uniform float viewWidth; uniform vec3 previousCameraPosition; @@ -73,13 +72,23 @@ uniform mat4 gbufferPreviousModelView; uniform int hideGUI; - - +#ifdef DAMAGE_TAKEN_EFFECT + uniform float CriticalDamageTaken; +#endif #include "/lib/util.glsl" #include "/lib/projections.glsl" +uniform int framemod8; +#include "/lib/TAA_jitter.glsl" + +vec2 decodeVec2(float a){ + const vec2 constant1 = 65535. / vec2( 256., 65536.); + const float constant2 = 256. / 255.; + return fract( a * constant1 ) * constant2 ; +} + float luma(vec3 color) { return dot(color,vec3(0.21, 0.72, 0.07)); } @@ -98,6 +107,93 @@ vec4 fp10Dither(vec4 color ,float dither){ return vec4(color.rgb + dither*exp2(-mantissaBits)*exp2(exponent), color.a); } +vec3 toClipSpace3Prev(vec3 viewSpacePosition) { + return projMAD(gbufferPreviousProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5; +} +vec3 tonemap(vec3 col){ + return col/(1+luma(col)); +} +vec3 invTonemap(vec3 col){ + return col/(1-luma(col)); +} +void convertHandDepth(inout float depth) { + float ndcDepth = depth * 2.0 - 1.0; + ndcDepth /= MC_HAND_DEPTH; + depth = ndcDepth * 0.5 + 0.5; +} +float convertHandDepth2( float depth) { + float ndcDepth = depth * 2.0 - 1.0; + ndcDepth /= MC_HAND_DEPTH; + return ndcDepth * 0.5 + 0.5; +} + + +#ifdef DISTANT_HORIZONS +uniform sampler2D dhDepthTex; +#endif +uniform float near; +uniform float far; +uniform float dhFarPlane; +uniform float dhNearPlane; + +#include "/lib/DistantHorizons_projections.glsl" + + +float ld(float dist) { + return (2.0 * near) / (far + near - dist * (far - near)); +} +float DH_ld(float dist) { + return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane)); +} +float DH_inv_ld (float lindepth){ + return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane); +} + +float linearizeDepthFast(const in float depth, const in float near, const in float far) { + return (near * far) / (depth * (near - far) + far); +} +float invertlinearDepthFast(const in float depth, const in float near, const in float far) { + return ((2.0*near/depth)-far-near)/(far-near); +} + +vec3 toClipSpace3Prev_DH( vec3 viewSpacePosition, bool depthCheck ) { + + #ifdef DISTANT_HORIZONS + mat4 projectionMatrix = depthCheck ? dhPreviousProjection : gbufferPreviousProjection; + return projMAD(projectionMatrix, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5; + #else + return projMAD(gbufferPreviousProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5; + #endif +} + +vec3 toScreenSpace_DH_special(vec3 POS, bool depthCheck ) { + + vec4 viewPos = vec4(0.0); + vec3 feetPlayerPos = vec3(0.0); + vec4 iProjDiag = vec4(0.0); + #ifdef DISTANT_HORIZONS + if (depthCheck) { + iProjDiag = vec4(dhProjectionInverse[0].x, dhProjectionInverse[1].y, dhProjectionInverse[2].zw); + + feetPlayerPos = POS * 2.0 - 1.0; + viewPos = iProjDiag * feetPlayerPos.xyzz + dhProjectionInverse[3]; + viewPos.xyz /= viewPos.w; + + } else { + #endif + iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw); + + feetPlayerPos = POS * 2.0 - 1.0; + viewPos = iProjDiag * feetPlayerPos.xyzz + gbufferProjectionInverse[3]; + viewPos.xyz /= viewPos.w; + + #ifdef DISTANT_HORIZONS + } + #endif + + return viewPos.xyz; +} + //Modified texture interpolation from inigo quilez vec4 smoothfilter(in sampler2D tex, in vec2 uv) { @@ -143,40 +239,26 @@ vec3 FastCatmulRom(sampler2D colorTex, vec2 texcoord, vec4 rtMetrics, float shar vec4(centerColor, 1.0) * (w12.x * w12.y) + vec4(texture2D(colorTex, vec2(tc3.x, tc12.y)).rgb, 1.0) * (w3.x * w12.y) + vec4(texture2D(colorTex, vec2(tc12.x, tc3.y )).rgb, 1.0) * (w12.x * w3.y ); + return color.rgb/color.a; } -vec3 clip_aabb(vec3 q, vec3 aabb_min, vec3 aabb_max) -{ - vec3 p_clip = 0.5 * (aabb_max + aabb_min); - vec3 e_clip = 0.5 * (aabb_max - aabb_min) + 0.00000001; +// vec3 clip_aabb(vec3 q, vec3 aabb_min, vec3 aabb_max) +// { +// vec3 p_clip = 0.5 * (aabb_max + aabb_min); +// vec3 e_clip = 0.5 * (aabb_max - aabb_min) + 0.00000001; - vec3 v_clip = q - vec3(p_clip); - vec3 v_unit = v_clip.xyz / e_clip; - vec3 a_unit = abs(v_unit); - float ma_unit = max(a_unit.x, max(a_unit.y, a_unit.z)); +// vec3 v_clip = q - vec3(p_clip); +// vec3 v_unit = v_clip.xyz / e_clip; +// vec3 a_unit = abs(v_unit); +// float ma_unit = max(a_unit.x, max(a_unit.y, a_unit.z)); - if (ma_unit > 1.0) - return vec3(p_clip) + v_clip / ma_unit; - else - return q; -} - -vec3 toClipSpace3Prev(vec3 viewSpacePosition) { - return projMAD(gbufferPreviousProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5; -} -vec3 tonemap(vec3 col){ - return col/(1+luma(col)); -} -vec3 invTonemap(vec3 col){ - return col/(1-luma(col)); -} -void convertHandDepth(inout float depth) { - float ndcDepth = depth * 2.0 - 1.0; - ndcDepth /= MC_HAND_DEPTH; - depth = ndcDepth * 0.5 + 0.5; -} +// if (ma_unit > 1.0) +// return vec3(p_clip) + v_clip / ma_unit; +// else +// return q; +// } vec3 closestToCamera5taps(vec2 texcoord, sampler2D depth, bool hand) { @@ -248,88 +330,6 @@ vec3 closestToCamera5taps_DH(vec2 texcoord, sampler2D depth, sampler2D dhDepth, return dmin; } - -#ifdef DISTANT_HORIZONS -uniform sampler2D dhDepthTex; -#endif -uniform float near; -uniform float far; -uniform float dhFarPlane; -uniform float dhNearPlane; - -#include "/lib/DistantHorizons_projections.glsl" - - -float ld(float dist) { - return (2.0 * near) / (far + near - dist * (far - near)); -} -float DH_ld(float dist) { - return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane)); -} -float DH_inv_ld (float lindepth){ - return -((2.0*dhNearPlane/lindepth)-dhFarPlane-dhNearPlane)/(dhFarPlane-dhNearPlane); -} - -float linearizeDepthFast(const in float depth, const in float near, const in float far) { - return (near * far) / (depth * (near - far) + far); -} -float invertlinearDepthFast(const in float depth, const in float near, const in float far) { - return ((2.0*near/depth)-far-near)/(far-near); -} - -vec3 toClipSpace3Prev_DH( vec3 viewSpacePosition, bool depthCheck ) { - - #ifdef DISTANT_HORIZONS - mat4 projectionMatrix = depthCheck ? dhPreviousProjection : gbufferPreviousProjection; - return projMAD(projectionMatrix, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5; - #else - return projMAD(gbufferPreviousProjection, viewSpacePosition) / -viewSpacePosition.z * 0.5 + 0.5; - #endif -} - -vec3 toScreenSpace_DH_special(vec3 POS, bool depthCheck ) { - - vec4 viewPos = vec4(0.0); - vec3 feetPlayerPos = vec3(0.0); - vec4 iProjDiag = vec4(0.0); - #ifdef DISTANT_HORIZONS - if (depthCheck) { - iProjDiag = vec4(dhProjectionInverse[0].x, dhProjectionInverse[1].y, dhProjectionInverse[2].zw); - - feetPlayerPos = POS * 2.0 - 1.0; - viewPos = iProjDiag * feetPlayerPos.xyzz + dhProjectionInverse[3]; - viewPos.xyz /= viewPos.w; - - } else { - #endif - iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw); - - feetPlayerPos = POS * 2.0 - 1.0; - viewPos = iProjDiag * feetPlayerPos.xyzz + gbufferProjectionInverse[3]; - viewPos.xyz /= viewPos.w; - - #ifdef DISTANT_HORIZONS - } - #endif - - return viewPos.xyz; -} - -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); - - - -#ifdef DAMAGE_TAKEN_EFFECT - uniform float CriticalDamageTaken; -#endif - vec4 TAA_hq(bool hand){ #ifdef TAA_UPSCALING @@ -338,7 +338,7 @@ vec4 TAA_hq(bool hand){ vec2 adjTC = texcoord; #endif - vec2 offsets = offsets[framemod8]*texelSize*0.5; + vec2 offsets = offsets[framemod8] * texelSize * 0.5; #ifdef DISTANT_HORIZONS bool depthCheck = texture2D(depthtex0,adjTC).x >= 1.0; @@ -414,6 +414,7 @@ vec4 TAA_hq(bool hand){ //Blend current pixel with clamped history, apply fast tonemap beforehand to reduce flickering vec4 supersampled = vec4(invTonemap(mix(tonemap(finalcAcc), tonemap(albedoCurrent0), clamp(BLEND_FACTOR + movementRejection, 0.0,1.0))), 1.0); + // vec4 supersampled = vec4(invTonemap(mix(tonemap(finalcAcc), tonemap(albedoCurrent0), 0.5)), 1.0); #ifdef DAMAGE_TAKEN_EFFECT if(CriticalDamageTaken > 0.01) supersampled.rgb = mix(supersampled.rgb, texture2D(colortex5, adjTC).rgb, sqrt(CriticalDamageTaken)*0.8); @@ -432,17 +433,97 @@ vec4 TAA_hq(bool hand){ #endif } +vec4 computeTAA(vec2 texcoord, bool hand){ -vec2 decodeVec2(float a){ - const vec2 constant1 = 65535. / vec2( 256., 65536.); - const float constant2 = 256. / 255.; - return fract( a * constant1 ) * constant2 ; + vec2 jitter = offsets[framemod8]*texelSize*0.5; + vec2 adjTC = clamp(texcoord*RENDER_SCALE, vec2(0.0), RENDER_SCALE - texelSize*2.0); + + // get previous frames position stuff for UV + //use velocity from the nearest texel from camera in a 3x3 box in order to improve edge quality in motion + #ifdef DISTANT_HORIZONS + bool depthCheck = texture2D(depthtex0,adjTC).x >= 1.0; + vec3 closestToCamera = closestToCamera5taps_DH(adjTC, depthtex0, dhDepthTex, depthCheck, hand); + vec3 viewPos = toScreenSpace_DH_special(closestToCamera, depthCheck); + #else + vec3 closestToCamera = closestToCamera5taps(adjTC, depthtex0, hand); + vec3 viewPos = toScreenSpace(closestToCamera); + #endif + vec3 playerPos = mat3(gbufferModelViewInverse) * toScreenSpace(closestToCamera) + gbufferModelViewInverse[3].xyz + (cameraPosition - previousCameraPosition); + vec3 previousPosition = mat3(gbufferPreviousModelView) * playerPos + gbufferPreviousModelView[3].xyz; + previousPosition = toClipSpace3Prev(previousPosition); + vec2 velocity = previousPosition.xy - closestToCamera.xy; + previousPosition.xy = texcoord + velocity; + + // sample current frame, and make sure it is de-jittered + vec3 currentFrame = smoothfilter(colortex3, adjTC + jitter).rgb; + + //reject history if off-screen and early exit + if (previousPosition.x < 0.0 || previousPosition.y < 0.0 || previousPosition.x > 1.0 || previousPosition.y > 1.0) return vec4(currentFrame, 1.0); + + #ifdef TAA_UPSCALING + // Interpolating neighboorhood clampling boundaries between pixels + vec3 colMax = texture2D(colortex0, adjTC).rgb; + vec3 colMin = texture2D(colortex6, adjTC).rgb; + #else + //Assuming the history color is a blend of the 3x3 neighborhood, we clamp the history to the min and max of each channel in the 3x3 neighborhood + vec3 col0 = currentFrame; // can use this because its the center sample. + vec3 col1 = texture2D(colortex3, adjTC + vec2( texelSize.x, texelSize.y)).rgb; + vec3 col2 = texture2D(colortex3, adjTC + vec2( texelSize.x, -texelSize.y)).rgb; + vec3 col3 = texture2D(colortex3, adjTC + vec2(-texelSize.x, -texelSize.y)).rgb; + vec3 col4 = texture2D(colortex3, adjTC + vec2(-texelSize.x, texelSize.y)).rgb; + vec3 col5 = texture2D(colortex3, adjTC + vec2( 0.0, texelSize.y)).rgb; + vec3 col6 = texture2D(colortex3, adjTC + vec2( 0.0, -texelSize.y)).rgb; + vec3 col7 = texture2D(colortex3, adjTC + vec2(-texelSize.x, 0.0)).rgb; + vec3 col8 = texture2D(colortex3, adjTC + vec2( texelSize.x, 0.0)).rgb; + + vec3 colMax = max(col0,max(col1,max(col2,max(col3, max(col4, max(col5, max(col6, max(col7, col8)))))))); + vec3 colMin = min(col0,min(col1,min(col2,min(col3, min(col4, min(col5, min(col6, min(col7, col8)))))))); + + vec3 colMax5 = max(col0,max(col5,max(col6,max(col7,col8)))); + vec3 colMin5 = min(col0,min(col5,min(col6,min(col7,col8)))); + + colMin = 0.5 * (colMin + colMin5); + colMax = 0.5 * (colMax + colMax5); + #endif + #ifdef DAMAGE_TAKEN_EFFECT + // when this triggers, use current frame UV to sample history, for a funny trailing effect. + if(CriticalDamageTaken > 0.01) previousPosition.xy = adjTC; + #endif + + vec3 frameHistory = max(FastCatmulRom(colortex5, previousPosition.xy, vec4(texelSize, 1.0/texelSize), 0.75).xyz,0.0); + vec3 clampedframeHistory = clamp(frameHistory, colMin, colMax); + + float blendingFactor = BLEND_FACTOR; + if(hand) blendingFactor = clamp(length(velocity/texelSize),blendingFactor,1.0); + + //Increases blending factor when far from AABB, reduces ghosting + blendingFactor = min(blendingFactor + luma(min(max(clampedframeHistory - frameHistory,0.0) / frameHistory, 1.0)),1.0); + + // Blend current pixel with clamped history, apply fast tonemap beforehand to reduce flickering + vec3 finalResult = invTonemap(mix(tonemap(clampedframeHistory), tonemap(currentFrame), blendingFactor)); + + #ifdef DAMAGE_TAKEN_EFFECT + // when this triggers, do a funny trailing effect. + if(CriticalDamageTaken > 0.01) finalResult = mix(finalResult, frameHistory, sqrt(CriticalDamageTaken)*0.8); + #endif + #ifdef SCREENSHOT_MODE + // when this is on, do "infinite frame accumulation " + if (hideGUI == 0) return vec4(finalResult, 1.0); + + vec4 superSampledHistory = texture2D(colortex5, previousPosition.xy); + vec3 superSampledResult = superSampledHistory.rgb * superSampledHistory.a + currentFrame; + + return vec4(superSampledResult/(superSampledHistory.a+1.0), superSampledHistory.a+1.0); + #endif + + return vec4(finalResult, 1.0); } + + void main() { /* DRAWBUFFERS:5 */ - gl_FragData[0].a = 1.0; #ifdef TAA @@ -451,7 +532,11 @@ void main() { float dataUnpacked = decodeVec2(texelFetch2D(colortex1,ivec2(gl_FragCoord.xy*RENDER_SCALE),0).w).y; bool hand = abs(dataUnpacked-0.75) < 0.01 && texture2D(depthtex1,taauTC).x < 1.0; - vec4 color = TAA_hq(hand); + // vec4 color = TAA_hq(hand); + + vec4 color = computeTAA(texcoord, hand); + + // gl_FragData[0] = clamp(color, 0.0, 65000.0); #if DEBUG_VIEW == debug_TEMPORAL_REPROJECTION color.rgb = texture2D(colortex3, taauTC).rgb; diff --git a/shaders/dimensions/composite5.vsh b/shaders/dimensions/composite5.vsh index ba15d67..a63e066 100644 --- a/shaders/dimensions/composite5.vsh +++ b/shaders/dimensions/composite5.vsh @@ -8,14 +8,8 @@ uniform int frameCounter; uniform int framemod8; -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +#include "/lib/TAA_jitter.glsl" + void main() { gl_Position = ftransform(); diff --git a/shaders/dimensions/deferred.fsh b/shaders/dimensions/deferred.fsh index 92f7e8b..43ae5e6 100644 --- a/shaders/dimensions/deferred.fsh +++ b/shaders/dimensions/deferred.fsh @@ -151,6 +151,7 @@ float invLinZ (float lindepth){ uniform sampler2D colortex4; #include "/lib/end_fog.glsl" #endif + vec3 rodSample(vec2 Xi) { float r = sqrt(1.0f - Xi.x*Xi.y); @@ -379,7 +380,6 @@ if(accumuteSpeed < 1.0) mixhistory = 1.0; gl_FragData[0].rgb = clamp(mix(temp, curr, mixhistory),0.0,65000.); - //Exposure values if (gl_FragCoord.x > 10. && gl_FragCoord.x < 11. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ) gl_FragData[0] = vec4(exposure, avgBrightness, avgL2,1.0); diff --git a/shaders/dimensions/deferred2.fsh b/shaders/dimensions/deferred2.fsh index d4e3741..b2d8c55 100644 --- a/shaders/dimensions/deferred2.fsh +++ b/shaders/dimensions/deferred2.fsh @@ -71,14 +71,8 @@ float interleaved_gradientNoise(){ -const vec2[8] offsets = vec2[8](vec2(1./8.,-3./8.), - vec2(-1.,3.)/8., - vec2(5.0,1.)/8., - vec2(-3,-5.)/8., - vec2(-5.,5.)/8., - vec2(-7.,-1.)/8., - vec2(3,7.)/8., - vec2(7.,-7.)/8.); +#include "/lib/TAA_jitter.glsl" + float blueNoise(){ #ifdef TAA return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); diff --git a/shaders/dimensions/fogBehindTranslucent_pass.fsh b/shaders/dimensions/fogBehindTranslucent_pass.fsh index fe46782..d1fe1e1 100644 --- a/shaders/dimensions/fogBehindTranslucent_pass.fsh +++ b/shaders/dimensions/fogBehindTranslucent_pass.fsh @@ -388,7 +388,7 @@ void main() { #endif vec4 underwaterVlFog = vec4(0,0,0,1); - if(iswater) underwaterVlFog = waterVolumetrics_test(viewPos0, viewPos1, estimatedDepth, estimatedSunDepth, Vdiff, noise_1, totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor, dot(normalize(viewPos1), normalize(sunVec*lightCol.a)) ); + if(iswater) underwaterVlFog = waterVolumetrics_test(viewPos0, viewPos1, estimatedDepth, estimatedSunDepth, Vdiff, noise_1, totEpsilon, scatterCoef, indirectLightColor_dynamic, directLightColor* (1.0-caveDetection), dot(normalize(viewPos1), normalize(sunVec*lightCol.a)) ); vec4 fogFinal = vec4(underwaterVlFog.rgb * VolumetricFog2.a + VolumetricFog2.rgb, VolumetricFog2.a * underwaterVlFog.a); diff --git a/shaders/lib/TAA_jitter.glsl b/shaders/lib/TAA_jitter.glsl new file mode 100644 index 0000000..6e36ea9 --- /dev/null +++ b/shaders/lib/TAA_jitter.glsl @@ -0,0 +1,33 @@ +const vec2[8] offsets = vec2[8]( + vec2( 1.0, -3.0)/8.0, + vec2(-1.0, 3.0)/8.0, + vec2( 5.0, 1.0)/8.0, + vec2(-3.0, -5.0)/8.0, + vec2(-5.0, 5.0)/8.0, + vec2(-7.0, -1.0)/8.0, + vec2( 3.0, 7.0)/8.0, + vec2( 7.0, 7.0)/8.0 +); + +// const vec2[4] offsets = vec2[4]( +// vec2( 0.0, -1.0), // right bottom +// vec2( 1.0, 0.0), // left top +// vec2( 0.0, 1.0), // right top +// vec2(-1.0, 0.0) // left bottom +// ); +// const vec2[4] offsets = vec2[4]( +// vec2(0.0), +// vec2(0.0), +// vec2(0.0), +// vec2(0.0) +// ); +// const vec2[8] offsets = vec2[8]( +// vec2(0.0), +// vec2(0.0), +// vec2(0.0), +// vec2(0.0), +// vec2(0.0), +// vec2(0.0), +// vec2(0.0), +// vec2(0.0) +// ); \ No newline at end of file diff --git a/shaders/lib/indirect_lighting_effects.glsl b/shaders/lib/indirect_lighting_effects.glsl index 6dc59d3..de824bf 100644 --- a/shaders/lib/indirect_lighting_effects.glsl +++ b/shaders/lib/indirect_lighting_effects.glsl @@ -393,9 +393,9 @@ vec3 ApplySSRT( #ifdef SKY_CONTRIBUTION_IN_SSRT #ifdef OVERWORLD_SHADER - skycontribution = doIndirectLighting(skyCloudsFromTexLOD(rayDir, colortex4, 0).rgb/30.0, minimumLightColor, lightmap) + blockLightColor; + skycontribution = doIndirectLighting(pow(skyCloudsFromTexLOD(rayDir, colortex4, 0).rgb/30.0, vec3(0.7)) * 2.5, minimumLightColor, lightmap) + blockLightColor; #else - skycontribution = pow(skyCloudsFromTexLOD2(rayDir, colortex4, 6).rgb / 30.0,vec3(0.7)) + blockLightColor; + skycontribution = pow(skyCloudsFromTexLOD2(rayDir, colortex4, 6).rgb / 30.0, vec3(0.7)) + blockLightColor; #endif #else #ifdef OVERWORLD_SHADER diff --git a/shaders/lib/res_params.glsl b/shaders/lib/res_params.glsl index c65e0b0..d0dccd9 100644 --- a/shaders/lib/res_params.glsl +++ b/shaders/lib/res_params.glsl @@ -3,7 +3,7 @@ #endif #ifdef TAA_UPSCALING - #define SCALE_FACTOR 0.75 // render resolution multiplier. below 0.5 not recommended [0.10 0.15 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] + #define SCALE_FACTOR 0.75 // render resolution multiplier. below 0.5 not recommended [0.10 0.15 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_SCALE vec2(SCALE_FACTOR, SCALE_FACTOR) #define UPSCALING_SHARPNENING 2.0 - SCALE_FACTOR - SCALE_FACTOR diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index 9ba69cf..e8adea5 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -1,4 +1,4 @@ -#define SHADER_VERSION_LABEL 475 // [475] +#define SHADER_VERSION_LABEL 476 // [476] #define saturate(x) clamp(x,0.0,1.0) @@ -548,7 +548,7 @@ uniform int moonPhase; #define CONTRAST_ADAPTATIVE_SHARPENING #define SHARPENING 0.35 // [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.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 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 diff --git a/shaders/lib/volumetricClouds.glsl b/shaders/lib/volumetricClouds.glsl index 116e5f8..901aea5 100644 --- a/shaders/lib/volumetricClouds.glsl +++ b/shaders/lib/volumetricClouds.glsl @@ -244,7 +244,7 @@ vec3 DoCloudLighting( float distantfog ){ float powder = 1.0 - exp(-10.0 * density); - vec3 directLight = sunMultiScatter * exp(-3.0 * sunShadows) * powder + sunScatter * exp(-10.0 * sunShadows); + vec3 directLight = sunScatter * exp(-10.0 * sunShadows) + sunMultiScatter * exp(-3.0 * sunShadows) * powder; vec3 indirectLight = skyLightCol * mix(1.0, 2.0 * (1.0 - sqrt((skyScatter*skyScatter*skyScatter)*density)) , pow(distantfog,1.0 - rainStrength*0.5)); @@ -315,6 +315,7 @@ if(layer == 2){ float directLight = 0.0; for (int j = 0; j < 2; j++){ + // lower the step size as the sun gets higher in the sky vec3 shadowSamplePos_high = rayProgress + dV_Sun * (1.0 + j * dither) / (pow(abs(dV_Sun.y*0.5),3.0) * 0.995 + 0.005); diff --git a/shaders/shaders.properties b/shaders/shaders.properties index 27487e5..23e1316 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -117,6 +117,7 @@ blend.gbuffers_water.colortex11 = off blend.gbuffers_hand_water.colortex11 = off blend.gbuffers_entities_translucent.colortex11 = off +blend.composite.colortex5 = off blend.composite.colortex12 = off blend.composite.colortex13 = off blend.composite.colortex14 = off @@ -257,7 +258,7 @@ SHADER_VERSION_LABEL \ screen.Clouds.columns = 3 screen.Clouds = VOLUMETRIC_CLOUDS CLOUDS_SHADOWS Cloud_Speed \ CLOUDS_QUALITY CLOUD_SHADOW_STRENGTH Rain_coverage \ - minRayMarchSteps [DAILY_WEATHER] \ + minRayMarchSteps maxRayMarchSteps [DAILY_WEATHER] \ CloudLayer0 CloudLayer1 CloudLayer2 \ CloudLayer0_coverage CloudLayer1_coverage CloudLayer2_coverage \ CloudLayer0_density CloudLayer1_density CloudLayer2_density \