#include "/Lib/Settings.glsl" #include "/Lib/Utilities.glsl" #include "/Lib/BasicFunctions/LightingConstants.glsl" // MinecraftPT — Cloud Shadow // Cloud shadow projection onto the ground from the cloud layer. #ifndef CLOUD_SHADOW_GLSL uniform sampler3D CloudNoise3D; #define CLOUD_SHADOW_GLSL float GetCloudShadow(vec3 worldPos){ float cloudAlt = mix(CLOUD_CLEAR_ALTITUDE, CLOUD_RAIN_ALTITUDE, wetness); float cloudDensity = mix(CLOUD_CLEAR_DENSITY, CLOUD_RAIN_DENSITY, wetness); // Project ground position onto cloud layer vec3 shadowDir = normalize(GetSunDirWorld()); vec3 cloudPos = worldPos + shadowDir * (cloudAlt - worldPos.y) / shadowDir.y; // Sample cloud density at that position vec2 p = cloudPos.xz * CLOUD_BASE_NOISE_SCALE + frameTimeCounter * 0.001 * CLOUD_SPEED; float n = textureLod(CloudNoise3D, vec3(p, 0.2), 0.0).r; float shadow = 1.0 - saturate((n - 0.5) * cloudDensity * 2.0 * CLOUD_SHADOW); return shadow; } #endif