Initial commit: Minecraft 光追着色器包(从零实现的 path tracing)

This commit is contained in:
WpyQwq
2026-09-19 12:06:22 +08:00
commit 59e30822f8
314 changed files with 9259 additions and 0 deletions
@@ -0,0 +1,28 @@
#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