#include "/lib/settings.glsl" flat varying vec4 lightCol; flat varying vec3 averageSkyCol; // flat varying vec3 averageSkyCol_Clouds; uniform sampler2D noisetex; uniform sampler2D depthtex0; uniform sampler2D colortex2; uniform sampler2D colortex3; // uniform sampler2D colortex4; flat varying vec3 WsunVec; uniform vec3 sunVec; uniform float sunElevation; // uniform float far; uniform int frameCounter; uniform float frameTimeCounter; varying vec2 texcoord; uniform vec2 texelSize; flat varying vec2 TAA_Offset; uniform int isEyeInWater; uniform float rainStrength; uniform ivec2 eyeBrightnessSmooth; #include "/lib/color_transforms.glsl" #include "/lib/color_dither.glsl" #include "/lib/projections.glsl" #include "/lib/res_params.glsl" #include "/lib/sky_gradient.glsl" #include "/lib/Shadow_Params.glsl" #ifdef OVERWORLD_SHADER const bool shadowHardwareFiltering = true; uniform sampler2DShadow shadow; flat varying vec3 refractedSunVec; #define TIMEOFDAYFOG #include "/lib/lightning_stuff.glsl" #include "/lib/volumetricClouds.glsl" #include "/lib/volumetricFog.glsl" #endif #ifdef NETHER_SHADER uniform sampler2D colortex4; #include "/lib/nether_fog.glsl" #endif #ifdef END_SHADER uniform sampler2D colortex4; #include "/lib/end_fog.glsl" #endif #ifdef FALLBACK_SHADER uniform sampler2D colortex4; #include "/lib/fallback_fog.glsl" #endif #define fsign(a) (clamp((a)*1e35,0.,1.)*2.-1.) float interleaved_gradientNoise(){ return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y)+ 1.0/1.6180339887 * frameCounter); } float blueNoise(){ return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a+ 1.0/1.6180339887 * frameCounter ); } 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