diff --git a/shaders/dimensions/composite2.fsh b/shaders/dimensions/composite2.fsh index 4e3038a..40baf57 100644 --- a/shaders/dimensions/composite2.fsh +++ b/shaders/dimensions/composite2.fsh @@ -51,6 +51,8 @@ uniform float frameTimeCounter; // varying vec2 texcoord; uniform vec2 texelSize; flat varying vec2 TAA_Offset; +uniform float viewHeight; +uniform float viewWidth; uniform int isEyeInWater; uniform float rainStrength; @@ -58,6 +60,7 @@ uniform ivec2 eyeBrightnessSmooth; uniform float eyeAltitude; uniform float caveDetection; uniform float skyLightLevelSmooth; +uniform float waterEnteredAltitude; vec4 blueNoise(vec2 coord){ return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ; @@ -221,11 +224,25 @@ uniform sampler2D colortex4; #define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.) +uniform int framemod8; +#include "/lib/TAA_jitter.glsl" + +/* +from https://blog.demofox.org/2022/01/01/interleaved-gradient-noise-a-different-kind-of-low-discrepancy-sequence/ +Copyright 2019 Alan Wolfe + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ float interleaved_gradientNoise_temporal(){ - vec2 coord = gl_FragCoord.xy + (frameCounter%40000) * 2.0; - float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y)); + vec2 coord = gl_FragCoord.xy + 5.588238 * float(frameCounter%64); + float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y)) ; return noise; } + float interleaved_gradientNoise(){ vec2 coord = gl_FragCoord.xy; float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y)); @@ -246,53 +263,6 @@ float R2_dither(){ return fract(alpha.x * coord.x + alpha.y * coord.y ) ; } -void waterVolumetrics_notoverworld(inout vec3 inColor, vec3 rayStart, vec3 rayEnd, float estEndDepth, float estSunDepth, float rayLength, float dither, vec3 waterCoefs, vec3 scatterCoef, vec3 ambient){ - inColor *= exp(-rayLength * waterCoefs); //No need to take the integrated value - - int spCount = rayMarchSampleCount; - vec3 start = toShadowSpaceProjected(rayStart); - vec3 end = toShadowSpaceProjected(rayEnd); - vec3 dV = (end-start); - //limit ray length at 32 blocks for performance and reducing integration error - //you can't see above this anyway - float maxZ = min(rayLength,12.0)/(1e-8+rayLength); - dV *= maxZ; - - - rayLength *= maxZ; - - float dY = normalize(mat3(gbufferModelViewInverse) * rayEnd).y * rayLength; - estEndDepth *= maxZ; - estSunDepth *= maxZ; - - vec3 wpos = mat3(gbufferModelViewInverse) * rayStart + gbufferModelViewInverse[3].xyz; - vec3 dVWorld = (wpos-gbufferModelViewInverse[3].xyz); - - vec3 absorbance = vec3(1.0); - vec3 vL = vec3(0.0); - - float expFactor = 11.0; - for (int i=0;i