From 0ea061c891771eaf6f5704c6b3824e784d4843c5 Mon Sep 17 00:00:00 2001 From: Xonk Date: Tue, 25 Feb 2025 17:42:55 -0500 Subject: [PATCH] add flashlight effects. add TAA jitter toggle for DH LOD, force responsive TAA jitter on DH. add adjustable health thresholds for damage effects.. --- shaders/dimensions/DH_generic.vsh | 6 +- shaders/dimensions/DH_solid.vsh | 7 +- shaders/dimensions/DH_translucent.vsh | 6 +- shaders/dimensions/all_particles.fsh | 29 ++-- shaders/dimensions/all_translucent.fsh | 17 +- shaders/dimensions/composite1.fsh | 148 +++++++++++++----- shaders/dimensions/composite1.vsh | 5 + shaders/dimensions/composite3.fsh | 123 +++------------ shaders/dimensions/deferred.fsh | 39 ++++- .../dimensions/fogBehindTranslucent_pass.fsh | 5 +- shaders/lib/TAA_jitter.glsl | 22 +-- shaders/lib/diffuse_lighting.glsl | 46 +++++- shaders/lib/end_fog.glsl | 41 ++--- shaders/lib/nether_fog.glsl | 16 ++ shaders/lib/overworld_fog.glsl | 17 +- shaders/lib/settings.glsl | 32 ++++ shaders/lib/specular.glsl | 10 +- shaders/shaders.properties | 24 ++- 18 files changed, 359 insertions(+), 234 deletions(-) diff --git a/shaders/dimensions/DH_generic.vsh b/shaders/dimensions/DH_generic.vsh index 1c1d4f2..2303289 100644 --- a/shaders/dimensions/DH_generic.vsh +++ b/shaders/dimensions/DH_generic.vsh @@ -16,6 +16,8 @@ uniform int framemod8; #include "/lib/bokeh.glsl" #endif +uniform int framemod4_DH; +#define DH_TAA_OVERRIDE #include "/lib/TAA_jitter.glsl" @@ -25,8 +27,8 @@ void main() { #ifdef TAA_UPSCALING gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w; #endif - #ifdef TAA - gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize; + #if defined TAA && defined DH_TAA_JITTER + gl_Position.xy += offsets[framemod4_DH] * gl_Position.w*texelSize; #endif pos = gl_ModelViewMatrix * gl_Vertex; diff --git a/shaders/dimensions/DH_solid.vsh b/shaders/dimensions/DH_solid.vsh index bd19765..c5be031 100644 --- a/shaders/dimensions/DH_solid.vsh +++ b/shaders/dimensions/DH_solid.vsh @@ -23,6 +23,8 @@ uniform float far; #include "/lib/bokeh.glsl" #endif +uniform int framemod4_DH; +#define DH_TAA_OVERRIDE #include "/lib/TAA_jitter.glsl" @@ -85,9 +87,8 @@ void main() { #ifdef TAA_UPSCALING gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w; #endif - - #ifdef TAA - gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize; + #if defined TAA && defined DH_TAA_JITTER + gl_Position.xy += offsets[framemod4_DH] * gl_Position.w*texelSize; #endif lightmapCoords = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy; diff --git a/shaders/dimensions/DH_translucent.vsh b/shaders/dimensions/DH_translucent.vsh index 941175f..7ada05a 100644 --- a/shaders/dimensions/DH_translucent.vsh +++ b/shaders/dimensions/DH_translucent.vsh @@ -44,6 +44,8 @@ uniform float far; #endif +uniform int framemod4_DH; +#define DH_TAA_OVERRIDE #include "/lib/TAA_jitter.glsl" @@ -117,8 +119,8 @@ void main() { #ifdef TAA_UPSCALING gl_Position.xy = gl_Position.xy * RENDER_SCALE + RENDER_SCALE * gl_Position.w - gl_Position.w; #endif - #ifdef TAA - gl_Position.xy += offsets[framemod8] * gl_Position.w*texelSize; + #if defined TAA && defined DH_TAA_JITTER + gl_Position.xy += offsets[framemod4_DH] * gl_Position.w*texelSize; #endif #if DOF_QUALITY == 5 diff --git a/shaders/dimensions/all_particles.fsh b/shaders/dimensions/all_particles.fsh index ed52bf7..467957f 100644 --- a/shaders/dimensions/all_particles.fsh +++ b/shaders/dimensions/all_particles.fsh @@ -47,13 +47,12 @@ uniform sampler2D colortex4; uniform sampler3D texLpv2; #endif - -uniform mat4 gbufferProjectionInverse; -uniform mat4 gbufferModelViewInverse; -uniform mat4 gbufferModelView; -uniform mat4 shadowModelView; -uniform mat4 shadowProjection; -uniform vec3 cameraPosition; +// uniform mat4 gbufferProjectionInverse; +// uniform mat4 gbufferModelViewInverse; +// uniform mat4 gbufferModelView; +// uniform mat4 shadowModelView; +// uniform mat4 shadowProjection; +// uniform vec3 cameraPosition; uniform float frameTimeCounter; #include "/lib/Shadow_Params.glsl" @@ -68,6 +67,8 @@ uniform float waterEnteredAltitude; flat varying float HELD_ITEM_BRIGHTNESS; +uniform mat4 gbufferPreviousModelView; +uniform vec3 previousCameraPosition; #include "/lib/util.glsl" @@ -96,6 +97,7 @@ flat varying float HELD_ITEM_BRIGHTNESS; #include "/lib/lpv_render.glsl" #endif +#include "/lib/projections.glsl" #include "/lib/diffuse_lighting.glsl" #include "/lib/sky_gradient.glsl" @@ -105,12 +107,12 @@ vec3 toLinear(vec3 sRGB){ // #define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) -vec3 toScreenSpace(vec3 p) { - vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw); - vec3 p3 = p * 2. - 1.; - vec4 fragposition = iProjDiag * p3.xyzz + gbufferProjectionInverse[3]; - return fragposition.xyz / fragposition.w; -} +// vec3 toScreenSpace(vec3 p) { +// vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw); +// vec3 p3 = p * 2. - 1.; +// vec4 fragposition = iProjDiag * p3.xyzz + gbufferProjectionInverse[3]; +// return fragposition.xyz / fragposition.w; +// } uniform int framemod8; @@ -284,6 +286,7 @@ void main() { vec2 adjustedTexCoord = lmtexcoord.xy; #ifdef POM vec3 fragpos = toScreenSpace(gl_FragCoord.xyz*vec3(texelSize/RENDER_SCALE,1.0)-vec3(0.0)); + vec3 worldpos = mat3(gbufferModelViewInverse) * fragpos + gbufferModelViewInverse[3].xyz + cameraPosition; vec3 normal = normalMat.xyz; diff --git a/shaders/dimensions/all_translucent.fsh b/shaders/dimensions/all_translucent.fsh index 42aac32..dc7103e 100644 --- a/shaders/dimensions/all_translucent.fsh +++ b/shaders/dimensions/all_translucent.fsh @@ -1,5 +1,7 @@ #include "/lib/settings.glsl" +#undef FLASHLIGHT_BOUNCED_INDIRECT + // #if defined END_SHADER || defined NETHER_SHADER // #undef IS_LPV_ENABLED // #endif @@ -33,7 +35,6 @@ uniform vec4 entityColor; #endif - flat varying float HELD_ITEM_BRIGHTNESS; #if defined ENTITIES && defined IS_IRIS flat varying int NAMETAG; @@ -46,6 +47,7 @@ uniform sampler2D depthtex0; #ifdef DISTANT_HORIZONS uniform sampler2D dhDepthTex1; #endif + uniform sampler2D colortex7; uniform sampler2D colortex12; uniform sampler2D colortex13; @@ -400,16 +402,12 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) vec3 FragCoord = gl_FragCoord.xyz; - #ifdef HAND - convertHandDepth(FragCoord.z); - #endif - vec2 tempOffset = offsets[framemod8]; vec3 viewPos = toScreenSpace(FragCoord*vec3(texelSize/RENDER_SCALE,1.0)-vec3(vec2(tempOffset)*texelSize*0.5, 0.0)); + vec3 feetPlayerPos = mat3(gbufferModelViewInverse) * viewPos; - //////////////////////////////////////////////////////////////////////////////// //////////////////////////////// MATERIAL MASKS //////////////////////////////// //////////////////////////////////////////////////////////////////////////////// @@ -660,6 +658,11 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) Indirect_lighting += doBlockLightLighting( vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, exposure, feetPlayerPos, lpvPos); + vec4 flashLightSpecularData = vec4(0.0); + #ifdef FLASHLIGHT + Indirect_lighting += calculateFlashlight(FragCoord.xy*texelSize/RENDER_SCALE, viewPos, vec3(0.0), viewToWorld(normalize(normal)), flashLightSpecularData, false); + #endif + vec3 FinalColor = (Indirect_lighting + Direct_lighting) * Albedo; #if EMISSIVE_TYPE == 2 || EMISSIVE_TYPE == 3 @@ -712,7 +715,7 @@ if (gl_FragCoord.x * texelSize.x < 1.0 && gl_FragCoord.y * texelSize.y < 1.0 ) #endif - vec3 specularReflections = specularReflections(viewPos, normalize(feetPlayerPos), WsunVec, vec3(blueNoise(), vec2(interleaved_gradientNoise_temporal())), viewToWorld(normal), roughness, f0, Albedo, FinalColor*gl_FragData[0].a, DirectLightColor * Shadows, lightmap.y, isHand, reflectance); + vec3 specularReflections = specularReflections(viewPos, normalize(feetPlayerPos), WsunVec, vec3(blueNoise(), vec2(interleaved_gradientNoise_temporal())), viewToWorld(normal), roughness, f0, Albedo, FinalColor*gl_FragData[0].a, DirectLightColor * Shadows, lightmap.y, isHand, reflectance, flashLightSpecularData); gl_FragData[0].a = gl_FragData[0].a + (1.0-gl_FragData[0].a) * reflectance; diff --git a/shaders/dimensions/composite1.fsh b/shaders/dimensions/composite1.fsh index dee7ee8..4d6a3d7 100644 --- a/shaders/dimensions/composite1.fsh +++ b/shaders/dimensions/composite1.fsh @@ -91,6 +91,7 @@ uniform mat4 gbufferPreviousModelView; // uniform vec3 cameraPosition; uniform vec3 previousCameraPosition; uniform float updateFadeTime; +// uniform float centerDepthSmooth; // uniform float far; uniform float near; @@ -120,6 +121,7 @@ flat varying vec3 WsunVec; flat varying vec3 unsigned_WsunVec; flat varying vec3 WmoonVec; flat varying float exposure; +flat varying vec3 albedoSmooth; #ifdef IS_LPV_ENABLED uniform int heldItemId; @@ -152,6 +154,7 @@ float convertHandDepth_2(in float depth, bool hand) { #include "/lib/Shadow_Params.glsl" #include "/lib/Shadows.glsl" #include "/lib/stars.glsl" +#include "/lib/sky_gradient.glsl" #ifdef OVERWORLD_SHADER @@ -174,31 +177,6 @@ float convertHandDepth_2(in float depth, bool hand) { #include "/lib/lpv_render.glsl" #endif -#include "/lib/diffuse_lighting.glsl" - -float ld(float dist) { - return (2.0 * near) / (far + near - dist * (far - near)); -} - -#include "/lib/sky_gradient.glsl" - -vec3 decode (vec2 encn){ - vec3 n = vec3(0.0); - encn = encn * 2.0 - 1.0; - n.xy = abs(encn); - n.z = 1.0 - n.x - n.y; - n.xy = n.z <= 0.0 ? (1.0 - n.yx) * sign(encn) : encn; - return clamp(normalize(n.xyz),-1.0,1.0); -} - -vec2 decodeVec2(float a){ - const vec2 constant1 = 65535. / vec2( 256., 65536.); - const float constant2 = 256. / 255.; - return fract( a * constant1 ) * constant2 ; -} - -#include "/lib/end_fog.glsl" - // #define DEFERRED_SPECULAR #define DEFERRED_ENVIORNMENT_REFLECTION #define DEFERRED_BACKGROUND_REFLECTION @@ -214,8 +192,29 @@ vec2 decodeVec2(float a){ #endif #include "/lib/specular.glsl" +#include "/lib/diffuse_lighting.glsl" + +#include "/lib/end_fog.glsl" #include "/lib/DistantHorizons_projections.glsl" +float ld(float dist) { + return (2.0 * near) / (far + near - dist * (far - near)); +} + +vec3 decode (vec2 encn){ + vec3 n = vec3(0.0); + encn = encn * 2.0 - 1.0; + n.xy = abs(encn); + n.z = 1.0 - n.x - n.y; + n.xy = n.z <= 0.0 ? (1.0 - n.yx) * sign(encn) : encn; + return clamp(normalize(n.xyz),-1.0,1.0); +} + +vec2 decodeVec2(float a){ + const vec2 constant1 = 65535. / vec2( 256., 65536.); + const float constant2 = 256. / 255.; + return fract( a * constant1 ) * constant2 ; +} float DH_ld(float dist) { return (2.0 * dhNearPlane) / (dhFarPlane + dhNearPlane - dist * (dhFarPlane - dhNearPlane)); } @@ -405,6 +404,59 @@ vec2 SSRT_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise, boo return vec2(Shadow, SSS / steps); } +float SSRT_FlashLight_Shadows(vec3 viewPos, bool depthCheck, vec3 lightDir, float noise){ + + + 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 = 6.0; + + vec3 rayDir = direction * Stepmult * vec3(RENDER_SCALE,1.0); + vec3 screenPos = clipPosition * vec3(RENDER_SCALE,1.0) + rayDir*noise; + + + for (int i = 0; i < int(steps); i++) { + + float samplePos = texture2D(depthtex2, screenPos.xy).x; + + #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; + } + + screenPos += rayDir; + } + + return Shadow; +} + void Emission( inout vec3 Lighting, vec3 Albedo, @@ -605,7 +657,7 @@ vec3 SubsurfaceScattering_sun(vec3 albedo, float Scattering, float Density, floa 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) * (1-min(max((1-Density)-0.9, 0.0)/(1.0-0.9),1.0)); + vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth) * pow(Density, LabSSS_Curve);//* (1-min(max((1-Density)-0.9, 0.0)/(1.0-0.9),1.0)); scatter *= 1.0 + CustomPhase(lightPos)*6.0; // ~10x brighter at the peak @@ -622,8 +674,8 @@ vec3 SubsurfaceScattering_sky(vec3 albedo, float Scattering, float Density){ float scatterDepth = pow(Scattering,3.5); scatterDepth = 1-pow(1-scatterDepth,5); - vec3 absorbColor = exp(max(luma(albedo) - albedo*vec3(1.0,1.1,1.2), 0.0) * -1.0 * sss_absorbance_multiplier); - vec3 scatter = scatterDepth * mix(absorbColor, vec3(1.0), scatterDepth) * (1-min(max((1-Density)-0.9, 0.0)/(1.0-0.9),1.0));// * pow(Density, LabSSS_Curve); + 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); #endif // scatter *= 1.0 + exp(-7.0*(-playerPosNormalized.y*0.5+0.5)); @@ -643,8 +695,8 @@ void applyPuddles( float halfWet = min(wetnessAmount,1.0); float fullWet = clamp(wetnessAmount - 2.0,0.0,1.0); - // halfWet = 0.0; - // fullWet = 0.0; + // halfWet = 1.0; + // fullWet = 1.0; float noise = texture2D(noisetex, worldPos.xz * 0.02).b; @@ -678,6 +730,7 @@ void applyPuddles( // albedo = mix(albedo, vec3(1.0), snow); } + void main() { vec3 DEBUG = vec3(1.0); @@ -686,15 +739,18 @@ void main() { vec2 texcoord = (gl_FragCoord.xy*texelSize); float noise_2 = R2_dither(); - vec2 bnoise = blueNoise(gl_FragCoord.xy ).rg; - // #ifdef TAA + vec2 bnoise = blueNoise(gl_FragCoord.xy).rg; + + #ifdef TAA int seed = (frameCounter*5)%40000; - vec2 r2_sequence = R2_samples(seed).xy; - vec2 BN = fract(r2_sequence + bnoise); - float noise = BN.y; - // #else - // float noise = fract(R2_samples(3).y + bnoise.y); - // #endif + #else + int seed = 600; + #endif + + vec2 r2_sequence = R2_samples(seed).xy; + vec2 BN = fract(r2_sequence + bnoise); + float noise = BN.y; + // float z0 = texture2D(depthtex0,texcoord).x; // float z = texture2D(depthtex1,texcoord).x; @@ -912,7 +968,7 @@ void main() { if( nightVision > 0.0 ) Absorbtion += exp(-totEpsilon * 25.0) * nightVision; // apply caustics to the lighting, and make sure they dont look weird - DirectLightColor *= mix(1.0, waterCaustics(feetPlayerPos + cameraPosition, WsunVec)*WATER_CAUSTICS_BRIGHTNESS + 0.25, clamp(estimatedDepth,0,1)); + DirectLightColor *= mix(1.0, waterCaustics(feetPlayerPos + cameraPosition, WsunVec)*WATER_CAUSTICS_BRIGHTNESS, clamp(estimatedDepth,0,1)); } @@ -1133,6 +1189,17 @@ void main() { vec3 blockLightColor = doBlockLightLighting( vec3(TORCH_R,TORCH_G,TORCH_B), lightmap.x, exposure, feetPlayerPos, lpvPos); Indirect_lighting += blockLightColor; + vec4 flashLightSpecularData = vec4(0.0); + #ifdef FLASHLIGHT + vec3 newViewPos = viewPos; + + + float flashlightshadows = SSRT_FlashLight_Shadows(toScreenSpace_DH(texcoord/RENDER_SCALE, z, DH_depth1), isDHrange, newViewPos, interleaved_gradientNoise_temporal()); + + + Indirect_lighting += calculateFlashlight(texcoord, viewPos, albedoSmooth, slopednormal, flashLightSpecularData, hand); + #endif + ///////////////////////////////////////////////////////////////////////////////////// ///////////////////////////// EFFECTS FOR INDIRECT ///////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// @@ -1247,7 +1314,7 @@ void main() { vec3 specularNormal = slopednormal; if (dot(slopednormal, (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, isWater || (!isWater && isEyeInWater == 1)); + FINAL_COLOR = specularReflections(viewPos, feetPlayerPos_normalized, WsunVec, specularNoises, specularNormal, SpecularTex.r, SpecularTex.g, albedo, FINAL_COLOR, shadowColor, lightmap.y, hand, isWater || (!isWater && isEyeInWater == 1), flashLightSpecularData); #endif gl_FragData[0].rgb = FINAL_COLOR; @@ -1317,6 +1384,7 @@ void main() { gl_FragData[0].rgb = gl_FragData[0].rgb * vlBehingTranslucents.a + vlBehingTranslucents.rgb; } + ////// DEBUG VIEW STUFF #if DEBUG_VIEW == debug_SHADOWMAP diff --git a/shaders/dimensions/composite1.vsh b/shaders/dimensions/composite1.vsh index a2b2ec5..cbfa1d3 100644 --- a/shaders/dimensions/composite1.vsh +++ b/shaders/dimensions/composite1.vsh @@ -17,6 +17,7 @@ flat varying vec3 unsigned_WsunVec; flat varying vec3 averageSkyCol_Clouds; flat varying vec4 lightCol; flat varying vec3 moonCol; +flat varying vec3 albedoSmooth; flat varying float exposure; @@ -57,6 +58,10 @@ void main() { lightCol.a = float(sunElevation > 1e-5)*2.0 - 1.0; moonCol = texelFetch2D(colortex4,ivec2(9,37),0).rgb; + + #if defined FLASHLIGHT && defined FLASHLIGHT_BOUNCED_INDIRECT + albedoSmooth = texelFetch2D(colortex4,ivec2(15.5,2.5),0).rgb; + #endif averageSkyCol_Clouds = texelFetch2D(colortex4,ivec2(0,37),0).rgb; diff --git a/shaders/dimensions/composite3.fsh b/shaders/dimensions/composite3.fsh index 64a8ef8..c9ce320 100644 --- a/shaders/dimensions/composite3.fsh +++ b/shaders/dimensions/composite3.fsh @@ -13,7 +13,6 @@ uniform sampler2D noisetex; uniform sampler2D depthtex0; uniform sampler2D depthtex1; - // const bool colortex4MipmapEnabled = true; #ifdef DISTANT_HORIZONS uniform sampler2D dhDepthTex; uniform sampler2D dhDepthTex1; @@ -80,19 +79,21 @@ uniform float caveDetection; uniform float eyeAltitude; - #define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) #define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) float ld(float depth) { return 1.0 / (zMults.y - depth * zMults.z); // (-depth * (far - near)) = (2.0 * near)/ld - far - near } + float luma(vec3 color) { return dot(color,vec3(0.21, 0.72, 0.07)); } + vec3 toLinear(vec3 sRGB){ return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878); } + vec3 toScreenSpace(vec3 p) { vec4 iProjDiag = vec4(gbufferProjectionInverse[0].x, gbufferProjectionInverse[1].y, gbufferProjectionInverse[2].zw); vec3 playerPos = p * 2. - 1.; @@ -102,7 +103,6 @@ vec3 toScreenSpace(vec3 p) { #include "/lib/DistantHorizons_projections.glsl" - float interleaved_gradientNoise_temporal(){ #ifdef TAA return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887 * frameCounter); @@ -110,11 +110,13 @@ float interleaved_gradientNoise_temporal(){ return fract(52.9829189*fract(0.06711056*gl_FragCoord.x + 0.00583715*gl_FragCoord.y ) + 1.0/1.6180339887); #endif } + float interleaved_gradientNoise(){ vec2 coord = gl_FragCoord.xy; float noise = fract(52.9829189*fract(0.06711056*coord.x + 0.00583715*coord.y)); return noise; } + float R2_dither(){ vec2 coord = gl_FragCoord.xy ; @@ -125,6 +127,7 @@ float R2_dither(){ vec2 alpha = vec2(0.75487765, 0.56984026); return fract(alpha.x * coord.x + alpha.y * coord.y ) ; } + float blueNoise(){ #ifdef TAA return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887 * frameCounter); @@ -132,9 +135,11 @@ float blueNoise(){ return fract(texelFetch2D(noisetex, ivec2(gl_FragCoord.xy)%512, 0).a + 1.0/1.6180339887); #endif } + vec4 blueNoise(vec2 coord){ return texelFetch2D(colortex6, ivec2(coord)%512 , 0) ; } + vec3 normVec (vec3 vec){ return vec*inversesqrt(dot(vec,vec)); } @@ -142,67 +147,20 @@ vec3 normVec (vec3 vec){ 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); } + vec2 decodeVec2(float a){ const vec2 constant1 = 65535. / vec2( 256., 65536.); const float constant2 = 256. / 255.; return fract( a * constant1 ) * constant2 ; } -vec4 BilateralUpscale(sampler2D tex, sampler2D tex2, sampler2D depth, vec2 coord, float referenceDepth, inout float CLOUDALPHA){ - ivec2 scaling = ivec2(1.0/VL_RENDER_RESOLUTION); - ivec2 posDepth = ivec2(coord*VL_RENDER_RESOLUTION) * scaling; - ivec2 posColor = ivec2(coord*VL_RENDER_RESOLUTION); - ivec2 pos = ivec2(gl_FragCoord.xy*texelSize + 1); - - ivec2 getRadius[5] = ivec2[]( - ivec2(-1,-1), - ivec2( 1, 1), - ivec2(-1, 1), - ivec2( 1,-1), - ivec2( 0, 0) - ); - - #ifdef DISTANT_HORIZONS - float diffThreshold = 0.01; - #else - float diffThreshold = zMults.x; - #endif - - vec4 RESULT = vec4(0.0); - float SUM = 0.0; - - for (int i = 0; i < 5; i++) { - - ivec2 radius = getRadius[i]; - - #ifdef DISTANT_HORIZONS - float offsetDepth = sqrt(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling,0).a/65000.0); - #else - float offsetDepth = ld(texelFetch2D(depth, posDepth + radius * scaling + pos * scaling, 0).r); - #endif - - float EDGES = abs(offsetDepth - referenceDepth) < diffThreshold ? 1.0 : 1e-5; - - RESULT += texelFetch2D(tex, posColor + radius + pos, 0) * EDGES; - - #if defined OVERWORLD_SHADER && defined CLOUDS_INTERSECT_TERRAIN - CLOUDALPHA += texelFetch2D(tex2, posColor + radius + pos, 0).x * EDGES; - #endif - - SUM += EDGES; - } - - #if defined OVERWORLD_SHADER && defined CLOUDS_INTERSECT_TERRAIN - CLOUDALPHA = CLOUDALPHA / SUM; - #endif - - return RESULT / SUM; -} vec3 decode (vec2 encn){ vec3 n = vec3(0.0); @@ -213,12 +171,12 @@ vec3 decode (vec2 encn){ return clamp(normalize(n.xyz),-1.0,1.0); } - vec3 worldToView(vec3 worldPos) { vec4 pos = vec4(worldPos, 0.0); pos = gbufferModelView * pos; return pos.xyz; } + vec3 viewToWorld(vec3 viewPosition) { vec4 pos; pos.xyz = viewPosition; @@ -227,28 +185,6 @@ vec3 viewToWorld(vec3 viewPosition) { return pos.xyz; } -/// thanks stackoverflow https://stackoverflow.com/questions/944713/help-with-pixel-shader-effect-for-brightness-and-contrast#3027595 -void applyContrast(inout vec3 color, float contrast){ - color = ((color - 0.5) * max(contrast, 0.0)) + 0.5; -} - -void ApplyDistortion(inout vec2 Texcoord, vec2 TangentNormals, float lineardistance, bool isTranslucentEntity){ - - vec2 UnalteredTexcoord = Texcoord; - - float refractionStrength = isTranslucentEntity ? 0.25 : 1.0 ; - - // Texcoord = abs(Texcoord + (TangentNormals * clamp((ld(depths.x) - ld(depths.y)) * 0.5,0.0,0.15)) * RENDER_SCALE * refractionStrength ); - // Texcoord = abs(Texcoord + (TangentNormals * mix(0.01, 0.1, pow(clamp(1.0-lineardistance/(32*4),0.0,1.0),2))) * RENDER_SCALE * refractionStrength ); - Texcoord = abs(Texcoord + TangentNormals * RENDER_SCALE * 0.1 ); - - float DistortedAlpha = decodeVec2(texture2D(colortex11,Texcoord).b).g; - // float DistortedAlpha = decodeVec2(texelFetch2D(colortex11,ivec2(Texcoord/texelSize),0).b).g; - // float DistortedAlpha = texelFetch2D(colortex2,ivec2(Texcoord/texelSize),0).a; - - Texcoord = mix(Texcoord, UnalteredTexcoord, min(max(0.1-DistortedAlpha,0.0) * 1000.0,1.0)); // remove distortion on non-translucents -} - 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. @@ -376,12 +312,6 @@ vec3 toScreenSpace_DH_special(vec3 POS, bool depthCheck ) { return viewPos.xyz; } -vec3 tonemap(vec3 col){ - return col/(1+luma(col)); -} -vec3 invTonemap(vec3 col){ - return col/(1-luma(col)); -} vec4 VLTemporalFiltering(vec3 viewPos, bool depthCheck, out float DEBUG){ // vec2 texcoord = ((gl_FragCoord.xy)*2.0 + 0.5)*texelSize/2.0 ; @@ -494,7 +424,6 @@ void main() { if(albedo.a < 0.01) tangentNormals = vec2(0.0); - ////// --------------- UNPACK MISC --------------- ////// // 1.0 = water mask // 0.9 = entity mask @@ -509,26 +438,19 @@ void main() { ////// --------------- get volumetrics - #if defined OVERWORLD_SHADER && defined CLOUDS_INTERSECT_TERRAIN float cloudAlpha = 0.0; #else float cloudAlpha = 1.0; #endif + float DEBUG = 0.0; - vec4 temporallyFilteredVL = VLTemporalFiltering(viewPos, z >= 1.0,DEBUG); + + vec4 temporallyFilteredVL = VLTemporalFiltering(viewPos, z >= 1.0, DEBUG); gl_FragData[2] = temporallyFilteredVL; - // #ifdef DISTANT_HORIZONS - // vec4 vl = BilateralUpscale(colortex0, colortex14, colortex12, gl_FragCoord.xy - 1.5, sqrt(texture2D(colortex12,texcoord).a/65000.0), cloudAlpha); - // #else - // vec4 vl = BilateralUpscale(colortex0, colortex14, depthtex0, gl_FragCoord.xy - 1.5, frDepth,cloudAlpha); - // #endif - // vec4 temporallyFilteredVL = vl; - // temporallyFilteredVL = texture2D(colortex0, texcoord*VL_RENDER_RESOLUTION); - float bloomyFogMult = 1.0; ////// --------------- distort texcoords as a refraction effect @@ -647,8 +569,6 @@ void main() { color *= temporallyFilteredVL.a ; color += temporallyFilteredVL.rgb ; #endif - - // color.rgb = vec3(nameTagMask); ////// --------------- VARIOUS FOG EFFECTS (in front of volumetric fog) //////////// blindness, nightvision, liquid fogs and misc fogs @@ -679,23 +599,22 @@ void main() { ////// --------------- FINALIZE #ifdef display_LUT - - // if(hideGUI == 0){ - vec3 thingy = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy/150),0).rgb /1200.0; + float zoomLevel = 1.0; + vec3 thingy = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy/zoomLevel),0).rgb /1200.0; if(luma(thingy) > 0.0){ color.rgb = thingy; - // // vl.a = 1.0; + bloomyFogMult = 1.0; } - // } + #if defined OVERWORLD_SHADER - if( hideGUI == 1) color.rgb = skyCloudsFromTex(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 = vec3(DEBUG); + // 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 00eb456..05a058f 100644 --- a/shaders/dimensions/deferred.fsh +++ b/shaders/dimensions/deferred.fsh @@ -25,6 +25,17 @@ flat varying float centerDepth; uniform sampler2D noisetex; +uniform sampler2D colortex1; + +vec2 decodeVec2(float a){ + const vec2 constant1 = 65535. / vec2( 256., 65536.); + const float constant2 = 256. / 255.; + return fract( a * constant1 ) * constant2 ; +} +vec3 toLinear(vec3 sRGB){ + return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878); +} + uniform float frameTime; uniform int frameCounter; uniform float frameTimeCounter; @@ -42,6 +53,7 @@ uniform mat4 shadowModelViewI; uniform mat4 shadowProjection; uniform float sunElevation; uniform vec3 sunPosition; +uniform vec3 moonPosition; uniform vec3 cameraPosition; // uniform float far; uniform ivec2 eyeBrightnessSmooth; @@ -254,15 +266,29 @@ float mixhistory = 0.06; #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 > 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 > 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 > 16. && gl_FragCoord.x < 17. && gl_FragCoord.y > 19.+18. && gl_FragCoord.y < 19.+18.+1 ) - // gl_FragData[0] = vec4(rayleighAborbance,1.0); #endif - + #if defined FLASHLIGHT && defined FLASHLIGHT_BOUNCED_INDIRECT + // sample center pixel of albedo color, and interpolate it overtime. + if (gl_FragCoord.x > 15 && gl_FragCoord.x < 16 && gl_FragCoord.y > 2 && gl_FragCoord.y < 3){ + + mixhistory = 0.01; + + vec3 data = texelFetch2D(colortex1, ivec2(0.5/texelSize), 0).rgb; + vec3 decodeAlbedo = vec3(decodeVec2(data.x).x,decodeVec2(data.y).x, decodeVec2(data.z).x); + vec3 albedo = toLinear(decodeAlbedo); + + albedo = normalize(albedo + 1e-7) * (dot(albedo,vec3(0.21, 0.72, 0.07))*0.5+0.5); + + gl_FragData[0] = vec4(albedo,1.0); + } + #endif //////////////////////////////// /// --- ATMOSPHERE IMAGE --- /// //////////////////////////////// @@ -301,7 +327,12 @@ if (gl_FragCoord.x > 18.+257. && gl_FragCoord.y > 1. && gl_FragCoord.x < 18+257+ vec3 viewPos = mat3(gbufferModelView)*viewVector*1024.0; float noise = interleaved_gradientNoise_temporal(); - WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition + gbufferModelViewInverse[3].xyz) ;// * ( float(sunElevation > 1e-5)*2.0-1.0 ); + WsunVec = normalize(mat3(gbufferModelViewInverse) * sunPosition + gbufferModelViewInverse[3].xyz);// * ( float(sunElevation > 1e-5)*2.0-1.0 ); + vec3 WmoonVec = normalize(mat3(gbufferModelViewInverse) * moonPosition + gbufferModelViewInverse[3].xyz);// * ( ); + + if(dot(-WmoonVec, WsunVec) < 0.9999) WmoonVec = -WmoonVec; + + WsunVec = mix(WmoonVec, WsunVec, clamp(float(sunElevation > 1e-5)*2.0-1.0 ,0,1)); vec3 sky = texelFetch2D(colortex4,ivec2(gl_FragCoord.xy)-ivec2(257,0),0).rgb/150.0; sky = mix(averageSkyCol_Clouds * AmbientLightTint * 0.25, sky, pow(clamp(viewVector.y+1.0,0.0,1.0),5.0)); diff --git a/shaders/dimensions/fogBehindTranslucent_pass.fsh b/shaders/dimensions/fogBehindTranslucent_pass.fsh index 4e3512d..4270da3 100644 --- a/shaders/dimensions/fogBehindTranslucent_pass.fsh +++ b/shaders/dimensions/fogBehindTranslucent_pass.fsh @@ -48,6 +48,9 @@ uniform ivec2 eyeBrightnessSmooth; uniform float eyeAltitude; uniform float caveDetection; +uniform mat4 gbufferPreviousModelView; +uniform vec3 previousCameraPosition; + #define DHVLFOG #define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z) #define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz) @@ -440,7 +443,7 @@ void main() { indirectLightColor_dynamic += MIN_LIGHT_AMOUNT * 0.02 * 0.2 + nightVision*0.02; - indirectLightColor_dynamic += vec3(TORCH_R,TORCH_G,TORCH_B) * pow(1.0-sqrt(1.0-clamp(lightmap.x,0.0,1.0)),2.0) ; + indirectLightColor_dynamic += vec3(TORCH_R,TORCH_G,TORCH_B) * pow(1.0-sqrt(1.0-clamp(lightmap.x,0.0,1.0)),2.0) * TORCH_AMOUNT; vec4 finalVolumetrics = vec4(0.0,0.0,0.0,1.0); diff --git a/shaders/lib/TAA_jitter.glsl b/shaders/lib/TAA_jitter.glsl index ff5c988..0046166 100644 --- a/shaders/lib/TAA_jitter.glsl +++ b/shaders/lib/TAA_jitter.glsl @@ -1,31 +1,12 @@ // swap out jitter pattern to be a 4 frame pattern instead of an 8 frame halton sequence -#ifdef RESPONSIVE_TAA +#if defined RESPONSIVE_TAA || defined DH_TAA_OVERRIDE const vec2[4] offsets = vec2[4]( - - // vec2( 0.0, -1.0), - // vec2( 1.0, 0.0), - // vec2( 0.0, 1.0), - // vec2(-1.0, 0.0) - - // vec2(-1.0, -7.0)/8.0, - // vec2( 7.0, -1.0)/8.0, - // vec2( 1.0, 7.0)/8.0, - // vec2(-7.0, 1.0)/8.0 - vec2(-0.125, -0.875), vec2( 0.875, -0.125), vec2( 0.125, 0.875), vec2(-0.875, 0.125) - - - // vec2(-7.0, 1.0)/8.0, - // vec2( 7.0, -1.0)/8.0, - // vec2( 1.0, 7.0)/8.0, - // vec2(-1.0, -7.0)/8.0 - ); #else - const vec2[8] offsets = vec2[8]( vec2( 1.0, -3.0)/8.0, vec2(-1.0, 3.0)/8.0, @@ -36,5 +17,4 @@ vec2( 3.0, 7.0)/8.0, vec2( 7.0, 7.0)/8.0 ); - #endif \ No newline at end of file diff --git a/shaders/lib/diffuse_lighting.glsl b/shaders/lib/diffuse_lighting.glsl index afbd122..6afed12 100644 --- a/shaders/lib/diffuse_lighting.glsl +++ b/shaders/lib/diffuse_lighting.glsl @@ -86,4 +86,48 @@ vec3 doIndirectLighting( indirectLight += minimumLightColor * (MIN_LIGHT_AMOUNT * 0.02 * 0.2 + nightVision*0.02); return indirectLight; -} \ No newline at end of file +} + +uniform float centerDepthSmooth; +vec3 calculateFlashlight(in vec2 texcoord, in vec3 viewPos, in vec3 albedo, in vec3 normal, out vec4 flashLightSpecularData, bool hand){ + + vec3 shiftedViewPos = viewPos + vec3(-0.25, 0.2, 0.0); + vec3 shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos; + gbufferModelViewInverse[3].xyz + (cameraPosition - previousCameraPosition) * 3.0; + shiftedViewPos = mat3(gbufferPreviousModelView) * shiftedPlayerPos + gbufferPreviousModelView[3].xyz; + vec2 scaledViewPos = shiftedViewPos.xy / max(-shiftedViewPos.z - 0.5, 1e-7); + float linearDistance = length(shiftedPlayerPos); + float shiftedLinearDistance = length(scaledViewPos); + + float lightFalloff = 1.0 - clamp(1.0-linearDistance/FLASHLIGHT_RANGE, -0.999,1.0); + lightFalloff = max(exp(-10.0 * lightFalloff),0.0); + + #if defined FLASHLIGHT_SPECULAR && (defined DEFERRED_SPECULAR || defined FORWARD_SPECULAR) + float flashLightSpecular = lightFalloff * exp2(-7.0*shiftedLinearDistance*shiftedLinearDistance); + flashLightSpecularData = vec4(normalize(shiftedPlayerPos), flashLightSpecular); + #endif + + float projectedCircle = clamp(1.0 - shiftedLinearDistance*FLASHLIGHT_SIZE,0.0,1.0); + float lenseDirt = texture2D(noisetex, scaledViewPos * 0.2 + 0.1).b; + float lenseShape = (pow(abs(pow(abs(projectedCircle-1.0),2.0)*2.0 - 0.5),2.0) + lenseDirt*0.2) * 10.0; + + float offsetNdotL = clamp(dot(-normal, normalize(shiftedPlayerPos)),0,1); + vec3 flashlightDiffuse = vec3(1.0) * lightFalloff * offsetNdotL * pow(1.0-pow(1.0-projectedCircle,2),2) * lenseShape; + + if(hand){ + flashlightDiffuse = vec3(0.0); + flashLightSpecularData = vec4(0.0); + } + + #ifdef FLASHLIGHT_BOUNCED_INDIRECT + float lightWidth = 1.0+linearDistance*3.0; + vec3 pointPos = mat3(gbufferModelViewInverse) * (toScreenSpace(vec3(texcoord, centerDepthSmooth)) + vec3(-0.25, 0.2, 0.0)); + float flashLightHitPoint = distance(pointPos, shiftedPlayerPos); + + float indirectFlashLight = exp(-10.0 * (1.0 - clamp(1.0-length(shiftedViewPos.xy)/lightWidth,0.0,1.0)) ); + indirectFlashLight *= pow(clamp(1.0-flashLightHitPoint/lightWidth,0,1),2.0); + + flashlightDiffuse += albedo/150.0 * indirectFlashLight * lightFalloff; + #endif + + return flashlightDiffuse * vec3(FLASHLIGHT_R,FLASHLIGHT_G,FLASHLIGHT_B); +} diff --git a/shaders/lib/end_fog.glsl b/shaders/lib/end_fog.glsl index 9840e56..3fc6faa 100644 --- a/shaders/lib/end_fog.glsl +++ b/shaders/lib/end_fog.glsl @@ -299,38 +299,21 @@ vec4 GetVolumetricFog( color += (hazeLighting - hazeLighting*exp(-hazeDensity*dd*dL)) * absorbance; - // // determine where the vortex area ends and chaotic lightning area begins. - // float vortexBounds = clamp(vortexBoundRange - length(progressW), 0.0,1.0); + #if defined FLASHLIGHT && defined FLASHLIGHT_FOG_ILLUMINATION + vec3 shiftedViewPos = mat3(gbufferModelView)*(progressW-cameraPosition) + vec3(-0.25, 0.2, 0.0); + vec3 shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos; + vec2 scaledViewPos = shiftedViewPos.xy / max(-shiftedViewPos.z - 0.5, 1e-7); + float linearDistance = length(shiftedPlayerPos); + float shiftedLinearDistance = length(scaledViewPos); - // vec3 lightPosition = LightSourcePosition(progressW, cameraPosition, vortexBounds); - // vec3 lightColors = LightSourceColors(vortexBounds, lightningflash); + float lightFalloff = 1.0 - clamp(1.0-linearDistance/FLASHLIGHT_RANGE, -0.999,1.0); + lightFalloff = max(exp(-30.0 * lightFalloff),0.0); + float projectedCircle = clamp(1.0 - shiftedLinearDistance*FLASHLIGHT_SIZE,0.0,1.0); - // volumeDensity += max(1.0 - length(vec3(lightPosition.x,lightPosition.y*2,lightPosition.z))/50,0.0) * vortexBounds; - - // float clearArea = 1.0-min(max(1.0 - length(progressW - cameraPosition) / 100,0.0),1.0); - // float density = min(volumeDensity * clearArea, END_STORM_DENSTIY); + vec3 flashlightGlow = vec3(FLASHLIGHT_R,FLASHLIGHT_G,FLASHLIGHT_B) * lightFalloff * projectedCircle * 0.5; - // ///// ----- air lighting, the haze - // float distanceFog = max(1.0 - length(progressW - cameraPosition) / max(far, 32.0 * 13.0),0.0); - // float hazeDensity = min(exp2(distanceFog * -25)+0.0005,1.0); - // vec3 hazeColor = vec3(0.3,0.75,1.0) * 0.3; - // color += (hazeColor - hazeColor*exp(-hazeDensity*dd*dL)) * absorbance; - - // ///// ----- main lighting - // vec3 voidLighting = vec3(1.0,0.0,0.8) * 0.1 * (1-exp(volumeDensity * -25)) * max(exp2(-1 * sqrt(max(progressW.y - -60,0.0))),0.0) ; - - // vec3 ambient = vec3(0.5,0.75,1.0) * 0.2 * (exp((volumeDensity*volumeDensity) * -50) * 0.9 + 0.1); - // float shadows = 0; - // vec3 lightsources = LightSourceLighting(progressW, lightPosition, dither2, volumeDensity, lightColors, vortexBounds); - // vec3 lighting = lightsources + ambient + voidLighting; - - // #ifdef THE_ORB - // density += min(50.0*max(1.0 - length(lightPosition)/10,0.0),1.0); - // #endif - - // ///// ----- blend - // color += (lighting - lighting*exp(-(density)*dd*dL)) * absorbance; - // absorbance *= exp(-max(density,hazeDensity)*dd*dL); + color += (flashlightGlow - flashlightGlow * exp(-max(stormDensity,0.005)*dd*dL)) * absorbance; + #endif //------ LPV FOG EFFECT #if defined LPV_VL_FOG_ILLUMINATION && defined EXCLUDE_WRITE_TO_LUT diff --git a/shaders/lib/nether_fog.glsl b/shaders/lib/nether_fog.glsl index 2e88ef2..e3c6774 100644 --- a/shaders/lib/nether_fog.glsl +++ b/shaders/lib/nether_fog.glsl @@ -103,6 +103,22 @@ vec4 GetVolumetricFog( color += (ceilingSmoke - ceilingSmoke*ceilingSmokeVolumeCoeff) * (absorbance*0.5+0.5); absorbance *= ceilingSmokeVolumeCoeff; + #if defined FLASHLIGHT && defined FLASHLIGHT_FOG_ILLUMINATION + vec3 shiftedViewPos = mat3(gbufferModelView)*(progressW-cameraPosition) + vec3(-0.25, 0.2, 0.0); + vec3 shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos; + vec2 scaledViewPos = shiftedViewPos.xy / max(-shiftedViewPos.z - 0.5, 1e-7); + float linearDistance = length(shiftedPlayerPos); + float shiftedLinearDistance = length(scaledViewPos); + + float lightFalloff = 1.0 - clamp(1.0-linearDistance/FLASHLIGHT_RANGE, -0.999,1.0); + lightFalloff = max(exp(-30.0 * lightFalloff),0.0); + float projectedCircle = clamp(1.0 - shiftedLinearDistance*FLASHLIGHT_SIZE,0.0,1.0); + + vec3 flashlightGlow = vec3(FLASHLIGHT_R,FLASHLIGHT_G,FLASHLIGHT_B) * lightFalloff * projectedCircle * 0.5; + + color += (flashlightGlow - flashlightGlow * exp(-max(plumeDensity,0.005)*dd*dL)) * absorbance; + #endif + //------ LPV FOG EFFECT #if defined LPV_VL_FOG_ILLUMINATION && defined EXCLUDE_WRITE_TO_LUT color += LPV_FOG_ILLUMINATION(progressW-cameraPosition, dd, dL) * TorchBrightness_autoAdjust * absorbance; diff --git a/shaders/lib/overworld_fog.glsl b/shaders/lib/overworld_fog.glsl index 4de452d..abde1f1 100644 --- a/shaders/lib/overworld_fog.glsl +++ b/shaders/lib/overworld_fog.glsl @@ -231,6 +231,22 @@ vec4 GetVolumetricFog( color += (lighting - lighting * fogVolumeCoeff) * totalAbsorbance; + #if defined FLASHLIGHT && defined FLASHLIGHT_FOG_ILLUMINATION + vec3 shiftedViewPos = mat3(gbufferModelView)*(progressW-cameraPosition) + vec3(-0.25, 0.2, 0.0); + vec3 shiftedPlayerPos = mat3(gbufferModelViewInverse) * shiftedViewPos; + vec2 scaledViewPos = shiftedViewPos.xy / max(-shiftedViewPos.z - 0.5, 1e-7); + float linearDistance = length(shiftedPlayerPos); + float shiftedLinearDistance = length(scaledViewPos); + + float lightFalloff = 1.0 - clamp(1.0-linearDistance/FLASHLIGHT_RANGE, -0.999,1.0); + lightFalloff = max(exp(-30.0 * lightFalloff),0.0); + float projectedCircle = clamp(1.0 - shiftedLinearDistance*FLASHLIGHT_SIZE,0.0,1.0); + + vec3 flashlightGlow = vec3(FLASHLIGHT_R,FLASHLIGHT_G,FLASHLIGHT_B) * lightFalloff * projectedCircle * 0.5; + + color += (flashlightGlow - flashlightGlow * exp(-max(fogDensity,0.005)*dd*dL)) * totalAbsorbance; + #endif + // kill fog absorbance when in caves. totalAbsorbance *= mix(1.0, fogVolumeCoeff, lightLevelZero); //------------------------------------ @@ -261,7 +277,6 @@ vec4 GetVolumetricFog( atmosphereAbsorbance *= atmosphereVolumeCoeff*fogVolumeCoeff; - //------------------------------------ //------ LPV FOG EFFECT //------------------------------------ diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index a4fcd52..58e4964 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -618,6 +618,8 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) #ifdef IS_IRIS #define DAMAGE_TAKEN_EFFECT #define LOW_HEALTH_EFFECT +#define LOW_HEALTH_EFFECT_START 6.0 // [1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0] +#define CRITICALLY_LOW_HEALTH_EFFECT_START 2.0 // [1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0] #endif #define WATER_ON_CAMERA_EFFECT @@ -630,6 +632,33 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) #ifdef WATER_ON_CAMERA_EFFECT #endif +// #define FLASHLIGHT +#define FLASHLIGHT_SPECULAR +#define FLASHLIGHT_BOUNCED_INDIRECT +// #define FLASHLIGHT_FOG_ILLUMINATION +#define FLASHLIGHT_RANGE 32 // [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 60 70 80 90 100 ] +#define FLASHLIGHT_SIZE 2.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 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0] +#define FLASHLIGHT_R 1.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 FLASHLIGHT_G 0.9 // [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 FLASHLIGHT_B 0.8 // [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] + + +#ifdef FLASHLIGHT +#endif +#ifdef FLASHLIGHT_SPECULAR +#endif +#ifdef FLASHLIGHT_BOUNCED_INDIRECT +#endif +#ifdef FLASHLIGHT_FOG_ILLUMINATION +#endif + +#if !defined FLASHLIGHT + #undef FLASHLIGHT_SPECULAR +#endif +#if defined FLASHLIGHT + #undef Hand_Held_lights +#endif + ///////////////////////////////////////// @@ -740,6 +769,7 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) #define DH_SUBSURFACE_SCATTERING #define DH_SCREENSPACE_REFLECTIONS #define DH_NOISE_TEXTURE +#define DH_TAA_JITTER /////////////////////////////////////////// // ----- FLOODFILL [LPV] SETTINGS ----- // @@ -792,6 +822,8 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) #undef TAA #endif // fix settings +#ifdef DH_TAA_JITTER +#endif #ifdef DH_SCREENSPACE_REFLECTIONS #endif #ifdef DH_SUBSURFACE_SCATTERING diff --git a/shaders/lib/specular.glsl b/shaders/lib/specular.glsl index 38ee87f..114be20 100644 --- a/shaders/lib/specular.glsl +++ b/shaders/lib/specular.glsl @@ -288,6 +288,9 @@ vec3 specularReflections( #else , bool isWater #endif + + ,in vec4 flashLight_stuff + ){ #ifdef FORWARD_RENDERED_SPECULAR lightmap = pow(min(max(lightmap-0.6,0.0)*2.5,1.0),2.0); @@ -316,7 +319,7 @@ vec3 specularReflections( // get reflectance and f0/HCM values // float shlickFresnel = pow(clamp(1.0 + dot(-reflectedVector, samplePoints),0.0,1.0),5.0); - if(isHand) reflectedVector_L = reflect(playerPos, normal); + reflectedVector_L = isHand ? reflect(playerPos, normal) : reflectedVector_L; #else vec3 reflectedVector_L = reflect(playerPos, normal); #endif @@ -389,5 +392,10 @@ vec3 specularReflections( specularReflections += lightSourceReflection; #endif + #if defined FLASHLIGHT_SPECULAR + vec3 flashLightReflection = vec3(FLASHLIGHT_R,FLASHLIGHT_G,FLASHLIGHT_B) * flashLight_stuff.a * GGX(normal, -flashLight_stuff.xyz, -flashLight_stuff.xyz, roughness, reflectance, metalAlbedoTint); + specularReflections += flashLightReflection; + #endif + return specularReflections; } \ No newline at end of file diff --git a/shaders/shaders.properties b/shaders/shaders.properties index b15977a..8556144 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -134,7 +134,7 @@ alphaTest.gbuffers_water = false alphaTest.gbuffers_skybasic = false alphaTest.gbuffers_skytextured = false -sliders = CloudLayer2_scale CloudLayer0_scale CloudLayer1_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_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 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 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 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 Moon_temp Haze_amount RainFog_amount Sun_temp Puddle_Size 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 = 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 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_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 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 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 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 Moon_temp Haze_amount RainFog_amount Sun_temp Puddle_Size 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 = \ @@ -333,15 +333,22 @@ SHADER_VERSION_LABEL \ SHADOWS_GRADE_MUL MIDS_GRADE_MUL HIGHLIGHTS_GRADE_MUL ### COOL GAMEPLAY EFFECTS - screen.GAMEPLAY_EFFECTS = MOTION_AMOUNT DAMAGE_TAKEN_EFFECT LOW_HEALTH_EFFECT WATER_ON_CAMERA_EFFECT - + screen.GAMEPLAY_EFFECTS = FLASHLIGHT [FLASHLIGHT_SETTING] MOTION_AMOUNT WATER_ON_CAMERA_EFFECT DAMAGE_TAKEN_EFFECT LOW_HEALTH_EFFECT LOW_HEALTH_EFFECT_START CRITICALLY_LOW_HEALTH_EFFECT_START + screen.FLASHLIGHT_SETTING.columns = 2 + screen.FLASHLIGHT_SETTING = FLASHLIGHT FLASHLIGHT_R \ + FLASHLIGHT_SPECULAR FLASHLIGHT_G \ + FLASHLIGHT_BOUNCED_INDIRECT FLASHLIGHT_B \ + FLASHLIGHT_FOG_ILLUMINATION \ + FLASHLIGHT_RANGE \ + FLASHLIGHT_SIZE + ######## MOD SUPPORT SETTINGS screen.Mod_support = [DISTANT_HORIZONS_SETTINGS] screen.DISTANT_HORIZONS_SETTINGS.columns = 1 - screen.DISTANT_HORIZONS_SETTINGS = DH_OVERDRAW_PREVENTION OVERDRAW_MAX_DISTANCE DH_AMBIENT_OCCLUSION DH_SUBSURFACE_SCATTERING DH_SCREENSPACE_REFLECTIONS DH_NOISE_TEXTURE DISTANT_HORIZONS_SHADOWMAP shadowDistance shadowMapResolution TOGGLE_VL_FOG VOLUMETRIC_CLOUDS + screen.DISTANT_HORIZONS_SETTINGS = DH_OVERDRAW_PREVENTION OVERDRAW_MAX_DISTANCE DH_AMBIENT_OCCLUSION DH_SUBSURFACE_SCATTERING DH_SCREENSPACE_REFLECTIONS DH_NOISE_TEXTURE DH_TAA_JITTER DISTANT_HORIZONS_SHADOWMAP shadowDistance shadowMapResolution TOGGLE_VL_FOG VOLUMETRIC_CLOUDS ######## MISC SETTINGS @@ -355,7 +362,6 @@ SHADER_VERSION_LABEL \ screen.selection_box_outline.columns = 1 screen.selection_box_outline = SELECT_BOX SELECT_BOX_COL_R SELECT_BOX_COL_G SELECT_BOX_COL_B - ##################################### ####### WEATHER RELATED STUFF ####### ##################################### @@ -467,8 +473,8 @@ uniform.bool.worldTimeChangeCheck = abs(smooth(sunAngle, 1.0, 1.0) - sunAngle) #if defined LOW_HEALTH_EFFECT || defined DAMAGE_TAKEN_EFFECT #ifdef IS_IRIS variable.float.Currenthealth = currentPlayerHealth * maxPlayerHealth - uniform.float.oneHeart = smooth(if(Currenthealth <= 2.0 && currentPlayerHealth > -1.0, 1,0), 0.0,1.0) - uniform.float.threeHeart = smooth(if(Currenthealth <= 6.0 && currentPlayerHealth > -1.0, 1,0), 0.0,1.0) + uniform.float.oneHeart = smooth(if(Currenthealth <= CRITICALLY_LOW_HEALTH_EFFECT_START && currentPlayerHealth > -1.0, 1,0), 0.0,1.0) + uniform.float.threeHeart = smooth(if(Currenthealth <= max(LOW_HEALTH_EFFECT_START,CRITICALLY_LOW_HEALTH_EFFECT_START) && currentPlayerHealth > -1.0, 1,0), 0.0,1.0) variable.float.interpolatedHealth = smooth(if(is_hurt, 0.0, Currenthealth), 0.0, 1.0) @@ -539,6 +545,10 @@ uniform.vec2.texelSize = vec2(texelSizeX,texelSizeY) uniform.int.framemod8 = frameCounter%8 #endif +#if defined DISTANT_HORIZONS + uniform.int.framemod4_DH = frameCounter%4 +#endif + variable.float.sunPosXSTEUFF = sunPosition.x variable.float.sunPosYSTEUFF = sunPosition.y variable.float.sunPosZSTEUFF = sunPosition.z