diff --git a/shaders/dimensions/all_solid.vsh b/shaders/dimensions/all_solid.vsh index d46a742..a40cecc 100644 --- a/shaders/dimensions/all_solid.vsh +++ b/shaders/dimensions/all_solid.vsh @@ -53,6 +53,11 @@ float pi2wt = PI48*frameTimeCounter; attribute vec4 mc_Entity; attribute vec4 mc_midTexCoord; +#if defined WORLD && !defined HAND + uniform float wetnessAmount; + uniform float snowAmount; +#endif + uniform int blockEntityId; uniform int entityId; flat varying float blockID; @@ -249,6 +254,10 @@ void main() { PORTAL = 1; lmtexcoord.w = 0.0; } + + #if defined Puddles || ShaderSnow > 0 + if(blockID == 215) lmtexcoord.w = 0.0; + #endif #endif NameTags = 0; diff --git a/shaders/dimensions/composite3.fsh b/shaders/dimensions/composite3.fsh index 1311f07..77536e4 100644 --- a/shaders/dimensions/composite3.fsh +++ b/shaders/dimensions/composite3.fsh @@ -90,7 +90,7 @@ uniform float caveDetection; uniform sampler2D lightningTex15; uniform sampler2D lightningTex16; - #define LIGHTNING_ONLY; + #define LIGHTNINGONLY; #include "/lib/volumetricClouds.glsl" #else uniform sampler2D colortex4; @@ -700,19 +700,21 @@ bool isLightning = false; lightningTex.rgb *= vec3(CUSTOM_LIGHTNING_R, CUSTOM_LIGHTNING_G, CUSTOM_LIGHTNING_B) * CUMULONIMBUS_LIGHTNING_BRIGHTNESS * 0.01; - if(cloudDepth.g > 0.0) lightningTex.rgb *= smoothstep(7550, 0.0, lightningDist - cloudDepth.g); + if(cloudDepth.g > 0.0) lightningTex.rgb *= smoothstep(7000.0, 1500.0, lightningDist - cloudDepth.g); - #if defined CUSTOM_LIGHTNING_POS && CUSTOM_LIGHTNING_TEX > 0 - lightningTex.a *= pow(lightningTex.a, 2.0); + if(lightningTex.rgb != vec3(0.0)) { + #if defined CUSTOM_LIGHTNING_POS && CUSTOM_LIGHTNING_TEX > 0 + lightningTex.a *= pow(lightningTex.a, 2.0); - lightningTex.rgb *= 75; - #else - lightningTex.a *= pow(lightningTex.a, lightningStart); // fade alpha in for cool expansion effect + lightningTex.rgb *= 75; + #else + lightningTex.a *= pow(lightningTex.a, lightningStart); // fade alpha in for cool expansion effect - lightningTex.rgb += 120 * lightningMid * lightningTex.rgb; // bright flash in the middle + lightningTex.rgb += 120 * lightningMid * lightningTex.rgb; // bright flash in the middle - lightningTex.rgb *= 75 * lightningFade; // fade out - #endif + lightningTex.rgb *= 75 * lightningFade; // fade out + #endif + } if (length(lightningTex.rgb) == 0.0) lightningTex.a = 0.0; } diff --git a/shaders/lang/en_us.lang b/shaders/lang/en_us.lang index 845c929..84f303c 100644 --- a/shaders/lang/en_us.lang +++ b/shaders/lang/en_us.lang @@ -238,9 +238,9 @@ screen.Clouds = Cloud Settings screen.CUSTOM_LIGHTNING = Custom Lightning option.CUSTOM_LIGHTNING_POS = Custom Position - option.CUSTOM_LIGHTNING_POS_X = X - option.CUSTOM_LIGHTNING_POS_Y = Y - option.CUSTOM_LIGHTNING_POS_Z = Z + //option.CUSTOM_LIGHTNING_POS_X = X + //option.CUSTOM_LIGHTNING_POS_Y = Y + //option.CUSTOM_LIGHTNING_POS_Z = Z option.CUSTOM_LIGHTNING_R = R option.CUSTOM_LIGHTNING_G = G option.CUSTOM_LIGHTNING_B = B @@ -249,7 +249,7 @@ screen.Clouds = Cloud Settings value.CUSTOM_LIGHTNING_TEX.0 = Random screen.READ_DESCRIPTION = READ DESCRIPTION - screen.READ_DESCRIPTION.comment = Set custom postion values in shaders/lib/settings.glsl + screen.READ_DESCRIPTION.comment = Set custom postion values in your shader config! screen.HighAltitudeClouds = High Altitude Clouds option.CloudLayer2 = Altostratus Clouds diff --git a/shaders/lib/res_params.glsl b/shaders/lib/res_params.glsl index 0123120..d0dccd9 100644 --- a/shaders/lib/res_params.glsl +++ b/shaders/lib/res_params.glsl @@ -13,4 +13,4 @@ #endif #define BLOOM_QUALITY 0.5 // Reduces the resolution at which bloom is computed. (0.5 = half of default resolution) [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. ] -#define VL_RENDER_RESOLUTION 0.5 // Reduces the resolution at which volumetric fog is computed. (0.5 = half of default resolution) [0.25 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0] \ No newline at end of file +#define VL_RENDER_RESOLUTION 0.5 // Reduces the resolution at which volumetric fog is computed. (0.5 = half of default resolution) [0.25 0.5 1.0] \ No newline at end of file diff --git a/shaders/lib/volumetricClouds.glsl b/shaders/lib/volumetricClouds.glsl index 97b3f24..5f9b0ba 100644 --- a/shaders/lib/volumetricClouds.glsl +++ b/shaders/lib/volumetricClouds.glsl @@ -492,6 +492,7 @@ vec4 raymarchCloud( density = parameters.cirrus.y; density *= smoothstep(195000, 50000, length(newPos)); } + if (density == 0.0) return vec4(color, totalAbsorbance); bool ifAboveOrBelowPlane = max(mix(-1.0, 1.0, clamp(cameraPosition.y - minHeight,0.0,1.0)) * normalize(rayDirection).y,0.0) > 0.0; @@ -561,11 +562,11 @@ vec4 raymarchCloud( #endif for(int i = 0; i < samples; i++) { - + vec3 newPos = rayPosition - cameraPosition; // check if the ray staring position is going farther than the reference distance, if yes, dont begin marching. this is to check for intersections with the world. #ifndef VL_CLOUDS_DEFERRED - if(length(rayPosition - cameraPosition) > referenceDistance) break; + if(length(newPos) > referenceDistance) break; #endif // check if the pixel is in the bounding box before doing work. @@ -576,7 +577,7 @@ vec4 raymarchCloud( float shapeWithDensityFaded = shape*density * pow(clamp((rayPosition.y - minHeight)/(max(maxHeight-minHeight,1.0)*0.25),0.0,1.0),2.0); if(shapeWithDensityFaded > densityTresholdCheck){ - cloudPlaneDistance.x = length(rayPosition - cameraPosition); cloudPlaneDistance.y = 0.0; + cloudPlaneDistance.x = length(newPos); cloudPlaneDistance.y = 0.0; } // check if the pixel has visible clouds before doing work. @@ -598,15 +599,13 @@ vec4 raymarchCloud( } #endif // altostratus layer -> all cumulus layers - #if (defined CloudLayer0 && defined CloudLayer2) || (defined CloudLayer0 && defined CloudLayer2) + #ifdef CloudLayer2 shadowStartPos = rayPosition + sunVector / abs(sunVector.y) * max(CloudLayer2_height - rayPosition.y, 0.0); sunShadowMask += getCloudShape(ALTOSTRATUS_LAYER, 0, shadowStartPos, CloudLayer2_height, CloudLayer2_height) * parameters.altostratus.y * (1.0-abs(sunVector.y)); #endif vec3 lighting = getCloudLighting(LayerIndex, shapeWithDensity, shapeWithDensityFaded, sunShadowMask, sunScattering, sunMultiScattering, moonScattering, moonMultiScattering, indirectShadowMask, skyScattering * skylightOcclusion, rayPosition); - vec3 newPos = rayPosition - cameraPosition; - float lightningIntensity = 0.0; // normal lightning strikes @@ -729,9 +728,9 @@ vec4 GetVolumetricClouds( float lViewPosM = length(viewPos) < maxdist ? length(viewPos) - 1.0 : 100000000.0; vec4 NormPlayerPos = normalize(gbufferModelViewInverse * vec4(viewPos, 1.0) + vec4(gbufferModelViewInverse[3].xyz,0.0)); - vec3 signedSunVec = sunVector; + // vec3 signedSunVec = sunVector; vec3 unsignedSunVec = sunVector; //mix(moonVector, sunVector, clamp(float(sunElevation > 1e-5)*2.0-1.0 ,0,1)); - vec3 signedMoonVec = moonVector; + // vec3 signedMoonVec = moonVector; vec3 unsignedMoonVec = moonVector; float SdotV = dot(unsignedSunVec, NormPlayerPos.xyz); @@ -811,35 +810,39 @@ vec4 GetVolumetricClouds( vec4 largeCumulusClouds = cloudColor; #ifdef CloudLayer1 - cloudheight = CloudLayer1_tallness; - minHeight = CloudLayer1_height; - maxHeight = cloudheight + minHeight; - - cloudMix = clamp(smoothstep(minHeight - 400.0, minHeight + 45.0, cameraPosition.y),0.0,clamp(smoothstep(maxHeight + 300.0, maxHeight - 60.0, cameraPosition.y) ,0.0,1.0)); - cloudDist.xz = mix(vec2(255.0), vec2(6.2), cloudMix); - rayDirection = NormPlayerPos.xyz * (cloudheight/length(NormPlayerPos.xyz/cloudDist)/samples); - rayPosition = getRayOrigin(rayDirection, cameraPosition, dither.y, minHeight, maxHeight); - vec2 cloudLayer1_Distance = vec2(startDistance, 1.0); float largeCumulusDistance = length(rayPosition - cameraPosition); - if(smallCumulusClouds.a > 1e-5 || cameraPosition.y > minHeight) largeCumulusClouds = raymarchCloud(LARGECUMULUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering2, sunMultiScattering2, moonScattering2, moonMultiScattering2, skyScattering, lViewPosM, sampledSkyCol, cloudLayer1_Distance); + if(smallCumulusClouds.a > 1e-5 || cameraPosition.y > minHeight) { + cloudheight = CloudLayer1_tallness; + minHeight = CloudLayer1_height; + maxHeight = cloudheight + minHeight; + + cloudMix = clamp(smoothstep(minHeight - 400.0, minHeight + 45.0, cameraPosition.y),0.0,clamp(smoothstep(maxHeight + 300.0, maxHeight - 60.0, cameraPosition.y) ,0.0,1.0)); + cloudDist.xz = mix(vec2(255.0), vec2(6.2), cloudMix); + rayDirection = NormPlayerPos.xyz * (cloudheight/length(NormPlayerPos.xyz/cloudDist)/samples); + rayPosition = getRayOrigin(rayDirection, cameraPosition, dither.y, minHeight, maxHeight); + + largeCumulusClouds = raymarchCloud(LARGECUMULUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering2, sunMultiScattering2, moonScattering2, moonMultiScattering2, skyScattering, lViewPosM, sampledSkyCol, cloudLayer1_Distance); + } #endif ////------- RENDER CUMULONIMBUS CLOUDS vec4 cumulonimbusClouds = cloudColor; #ifdef CUMULONIMBUS - cloudheight = 240*17; - minHeight = 600; - maxHeight = cloudheight + minHeight; - - cloudDist.xz = vec2(255.0); - rayDirection = NormPlayerPos.xyz * (cloudheight/length(NormPlayerPos.xyz/cloudDist)/samples); - rayPosition = getRayOrigin(rayDirection, cameraPosition, dither.y, minHeight, maxHeight); - vec2 cloudLayer4_Distance = vec2(startDistance, 1.0); float cumulonimbusDistance = length(rayPosition - cameraPosition); - cumulonimbusClouds = raymarchCloud(CUMULONIMBUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering2, sunMultiScattering2, moonScattering2, moonMultiScattering2, skyScattering, lViewPosM, sampledSkyCol, cloudLayer4_Distance); + if(smallCumulusClouds.a > 1e-5 && largeCumulusClouds.a > 1e-5) { + cloudheight = 240*17; + minHeight = 600; + maxHeight = cloudheight + minHeight; + + cloudDist.xz = vec2(8.0); + rayDirection = NormPlayerPos.xyz * (cloudheight/length(NormPlayerPos.xyz/cloudDist)/samples); + rayPosition = getRayOrigin(rayDirection, cameraPosition, dither.y, minHeight, maxHeight); + + cumulonimbusClouds = raymarchCloud(CUMULONIMBUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering2, sunMultiScattering2, moonScattering2, moonMultiScattering2, skyScattering, lViewPosM, sampledSkyCol, cloudLayer4_Distance); + } #endif moonVis = smoothstep(-0.04, 0.15, -sunElevation); @@ -850,32 +853,36 @@ vec4 GetVolumetricClouds( vec4 altoStratusClouds = cloudColor; #ifdef CloudLayer2 - cloudheight = 5.0; - minHeight = CloudLayer2_height; - maxHeight = cloudheight + minHeight; - - cloudDist.xz = mix(vec2(255.0), vec2(5.0), clamp(cameraPosition.y - minHeight,0.0,clamp((maxHeight-15) - cameraPosition.y ,0.0,1.0))); - rayDirection = NormPlayerPos.xyz * (cloudheight/length(NormPlayerPos.xyz/cloudDist)); - rayPosition = getRayOrigin(rayDirection, cameraPosition, dither.y, minHeight, maxHeight); - vec2 cloudLayer2_Distance = vec2(startDistance, 1.0); - if(smallCumulusClouds.a > 1e-5 || largeCumulusClouds.a > 1e-5) altoStratusClouds = raymarchCloud(ALTOSTRATUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering, sunMultiScattering, moonScattering2, moonMultiScattering2, skyScattering, lViewPosM, sampledSkyCol, cloudLayer2_Distance); + if(smallCumulusClouds.a > 1e-5 && largeCumulusClouds.a > 1e-5 && cumulonimbusClouds.a > 1e-5) { + cloudheight = 5.0; + minHeight = CloudLayer2_height; + maxHeight = cloudheight + minHeight; + + cloudDist.xz = mix(vec2(255.0), vec2(5.0), clamp(cameraPosition.y - minHeight,0.0,clamp((maxHeight-15) - cameraPosition.y ,0.0,1.0))); + rayDirection = NormPlayerPos.xyz * (cloudheight/length(NormPlayerPos.xyz/cloudDist)); + rayPosition = getRayOrigin(rayDirection, cameraPosition, dither.y, minHeight, maxHeight); + + altoStratusClouds = raymarchCloud(ALTOSTRATUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering, sunMultiScattering, moonScattering2, moonMultiScattering2, skyScattering, lViewPosM, sampledSkyCol, cloudLayer2_Distance); + } #endif ////------- RENDER CIRRUS CLOUDS vec4 cirrusClouds = cloudColor; #ifdef CloudLayer3 - cloudheight = 5.0; - minHeight = CloudLayer3_height; - maxHeight = cloudheight + minHeight; - - cloudDist.xz = mix(vec2(255.0), vec2(5.0), clamp(cameraPosition.y - minHeight,0.0,clamp((maxHeight-15) - cameraPosition.y ,0.0,1.0))); - rayDirection = NormPlayerPos.xyz * (cloudheight/length(NormPlayerPos.xyz/cloudDist)); - rayPosition = getRayOrigin(rayDirection, cameraPosition, dither.y, minHeight, maxHeight); - vec2 cloudLayer3_Distance = vec2(startDistance, 1.0); - if(smallCumulusClouds.a > 1e-5 || largeCumulusClouds.a > 1e-5) cirrusClouds = raymarchCloud(CIRRUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering, sunMultiScattering, moonScattering2, moonMultiScattering2, skyScattering, lViewPosM, sampledSkyCol, cloudLayer3_Distance); + if(smallCumulusClouds.a > 1e-5 && largeCumulusClouds.a > 1e-5 && cumulonimbusClouds.a > 1e-5 && altoStratusClouds.a > 1e-5) { + cloudheight = 5.0; + minHeight = CloudLayer3_height; + maxHeight = cloudheight + minHeight; + + cloudDist.xz = mix(vec2(255.0), vec2(5.0), clamp(cameraPosition.y - minHeight,0.0,clamp((maxHeight-15) - cameraPosition.y ,0.0,1.0))); + rayDirection = NormPlayerPos.xyz * (cloudheight/length(NormPlayerPos.xyz/cloudDist)); + rayPosition = getRayOrigin(rayDirection, cameraPosition, dither.y, minHeight, maxHeight); + + cirrusClouds = raymarchCloud(CIRRUS_LAYER, samples, rayPosition, rayDirection, dither.x, minHeight, maxHeight, unsignedSunVec, unsignedMoonVec, sunScattering, sunMultiScattering, moonScattering2, moonMultiScattering2, skyScattering, lViewPosM, sampledSkyCol, cloudLayer3_Distance); + } #endif ////------- BLEND LAYERS