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
+390
View File
@@ -0,0 +1,390 @@
// MinecraftPT — Settings
// All configurable options. Change values here or via the in-game GUI.
#ifndef SETTINGS_GLSL
#define SETTINGS_GLSL
// =============================== Path Tracing: Voxel ===============================
// Voxelization resolution (width x height x width)
// 4004=128³, 6004=192x128x192, 8004=256x128x256, 8006=256x192x256, 8008=256³
// 12004=384x128x384, 12006=384x192x384, 12008=384x256x384, 16004=512x128x512, 16008=512x256x512, 16016=512³
#define PT_VOXEL_RESOLUTION 8006
// Full block verification (more accurate, slightly slower)
#define PT_FULLBLOCK_VERIFICATION 0
// Full block detection from geometry (helps modded blocks)
#define PT_FULLBLOCK_DETECTION 0
// Sparse tracing — hierarchical empty-voxel skipping (much faster, recommended)
#define PT_SPARE_TRACING 1
// Detect emissive blocks from vanilla light level
#define VANILLA_EMISSIVE 1
// Trace through alpha pixels of blocks
#define PT_TRACING_ALPHA 0
// =============================== Path Tracing: Diffuse ===============================
// Max tracing distance for diffuse rays (blocks)
#define PT_DIFFUSE_TRACING_DISTANCE 32.0
// Samples per pixel for diffuse tracing (1 = 1 ray)
#define PT_DIFFUSE_SPP 1
// Screen space tracing for diffuse (SST) — helps short-range detail
#define PT_DIFFUSE_SST 1
// Diffuse refraction through translucent blocks
#define PT_DIFFUSE_REFRACTION 1
#define PT_DIFFUSE_REFRACTION_IOR 1.3
// ---- Diffuse denoiser ----
// Max temporal accumulation (frames)
#define PT_DIFFUSE_TEMPORAL_MAX_ACCUM 8
// Spatial filter detail (0=low,1=medium,2=high,3=ultra)
#define PT_DIFFUSE_SPATIAL_FILTER_DETAIL 2
#define PT_DIFFUSE_SPATIAL_FILTER_LUMINANCE_WEIGHT 0.4
#define PT_DIFFUSE_SPATIAL_FILTER_DEPTH_WEIGHT 0.8
#define PT_DIFFUSE_SPATIAL_FILTER_NORMAL_WEIGHT 0.4
// Fix history bleeding (0=off,1=on)
#define PT_DIFFUSE_TEMPORAL_HISTORY_FIX 1
// =============================== Path Tracing: Specular ===============================
// Enable rough specular (GGX) reflections
#define ENABLE_ROUGH_SPECULAR 1
// Clamp minimum roughness
#define ROUGHNESS_CLAMP 0
// Max tracing distance for specular rays
#define PT_SPECULAR_TRACING_DISTANCE 64.0
// Screen space reflection mode (0=off,1=combined,2=only screen space)
#define PT_SSR_MODE 1
// SSR quality (steps)
#define PT_SSR_QUALITY 32
// Reuse screen-space data in specular tracing
#define PT_SPECULAR_SCREEN_REUSE 1
// Smooth IRC specular
#define PT_SPECULAR_IRC_SMOOTH 0
// Skybox resolution for reflections (32/48/64/96/128)
#define SKYBOX_RESOLUTION 64
// =============================== Path Tracing: IRC ===============================
// Irradiance cache resolution (16/32/48/64)
#define PT_IRC_RESOLUTION 32
// Samples per IRC update
#define PT_IRC_SPP 8
// IRC blend weight (0-1)
#define PT_IRC_BLENDWEIGHT 0.5
// Self-bounce attenuation
#define PT_IRC_SELFBOUNCE_ATTENUATION 1.0
// =============================== Lighting ===============================
#define BLOCKLIGHT_BRIGHTNESS 1.0
#define SPHERELIGHT_BRIGHTNESS 1.0
#define BLOCKLIGHT_TEMPERATURE 1.5
#define PARTICLELIGHT_BRIGHTNESS 1.0
#define NOLIGHT_BRIGHTNESS 0.05
#define NIGHT_BRIGHTNESS 0.35
#define NETHER_BRIGHTNESS 1.0
#define COLD_MOONLIGHT 1
#define SUNRISE_ROTATION 0.0
#define SUN_ANGULAR_RADIUS 0.00465
#define SUNLIGHT_INTENSITY 1.0
// Light colors
#define BRIGHTNESS_TORCH 1.0
#define COLOR_TORCH_R 1.0
#define COLOR_TORCH_G 0.64
#define COLOR_TORCH_B 0.32
#define BRIGHTNESS_ENDROD 1.0
#define COLOR_ENDROD_R 1.0
#define COLOR_ENDROD_G 0.75
#define COLOR_ENDROD_B 0.6
#define BRIGHTNESS_FIRE 1.8
#define COLOR_FIRE_R 1.0
#define COLOR_FIRE_G 0.45
#define COLOR_FIRE_B 0.13
#define BRIGHTNESS_LIGHTBLOCK 1.0
#define COLOR_LIGHTBLOCK_R 1.0
#define COLOR_LIGHTBLOCK_G 1.0
#define COLOR_LIGHTBLOCK_B 1.0
#define BRIGHTNESS_SOULTORCH 0.4
#define COLOR_SOULTORCH_R 0.4
#define COLOR_SOULTORCH_G 0.98
#define COLOR_SOULTORCH_B 1.0
#define BRIGHTNESS_AMETHYST 0.3
#define COLOR_AMETHYST_R 0.84
#define COLOR_AMETHYST_G 0.52
#define COLOR_AMETHYST_B 1.28
#define BRIGHTNESS_REDSTONETORCH 0.1
#define COLOR_REDSTONETORCH_R 1.0
#define COLOR_REDSTONETORCH_G 0.48
#define COLOR_REDSTONETORCH_B 0.39
// Held light (torch in hand)
#define HELDLIGHT_BRIGHTNESS 1.0
#define HELDLIGHT_MODE 1
#define HELDLIGHT_FALLOFF 0.2
#define HELDLIGHT_COLOR_TEMPERATURE 1.5
#define SPECULAR_HELDLIGHT 0
#define HELDLIGHT_SHADOW 1
// =============================== Shadows ===============================
// Shadow map render distance (4/6/8/12/16/24/32/48/64/96/128)
#define SHADOW_RENDER_DISTANCE 16
// Variable penumbra shadows
#define VARIABLE_PENUMBRA_SHADOWS 1
#define VPS_SPREAD 1.0
// Shadow map quality (1/2/3)
#define SHADOW_QUALITY 2
#define SHADOW_BASIC_BLUR 0.0
// Use voxel shadow tracing instead of shadow map
#define PT_SHADOW 1
// Screen space shadows
#define SCREEN_SPACE_SHADOWS 1
// Colored shadows (from shadow map albedo)
#define COLORED_SHADOWS 1
#define HAND_SCREEN_SHADOW 1
// Prevent light leaking at sun-grazing angles
#define SUNLIGHT_LEAK_FIX 1
// RTWSM (warped shadow map)
#define RTW_RESOLUTION 512
#define RTW_BACKWARD_DIST_FACTOR 1.0
#define RTW_BACKWARD_NORMAL_FACTOR 0.8
#define RTW_BLUR_FACTOR 2.0
// =============================== Surface ===============================
// Block atlas texture resolution (0=auto)
#define TEXTURE_RESOLUTION 0
// LAB PBR texture format (0=legacy,1=LAB-PBR 1.3,2=LAB-PBR 1.4)
#define TEXTURE_PBR_FORMAT 1
// Emissiveness from LAB PBR
#define LABPBR_EMISSIVENESS 1
// Hardcoded emissive blocks
#define HARDCODED_EMISSIVENESS_MODE 1
// Subsurface scattering
#define LABPBR_SSS 1
#define SSS_QUALITY 4
#define SSS_STRENGTH 0.4
#define SSS_STRENGTH_OFFSET 0.0
#define SSS_BRIGHTNESS 1.0
// Porosity (wetness)
#define LABPBR_POROSITY 1
#define TEXTURE_DEFAULT_POROSITY 0.2
#define POROSITY_ABSORPTION 0.3
#define SURFACE_WETNESS 0.5
// Predefined metals
#define LABPBR_PREDEFINED_METAL 1
#define METAL_MINIMAL_F0 0.04
#define METAL_ORIGIN_COLOR 1.0
#define METALMASK_STRENGTH 1.0
// Parallax occlusion mapping
#define PARALLAX_MODE 0
#define ENTITIES_PARALLAX 0
#define PARALLAX_DEPTH 0.08
#define PARALLAX_QUALITY 6
// Waving plants
#define WAVING_PLANTS 1
#define SHADOW_WAVING_PLANTS 0
#define WAVING_RANGE 24.0
#define WAVING_SPEED 1.0
#define GRASS_AMPLITUDE 0.05
#define LEAVES_AMPLITUDE 0.08
// =============================== Water ===============================
#define WAVE_SCALE 8.0
#define WAVE_SPEED 1.0
#define WAVE_NORMAL_STRENGTH 0.4
#define WAVE_PARALLAX 1
#define WAVE_PARALLAX_DEPTH 0.4
#define WATER_FOG 1
#define WATER_SCATTERING_DENSITY 0.3
#define WATER_SCATTERING_R 0.3
#define WATER_SCATTERING_G 0.6
#define WATER_SCATTERING_B 0.8
#define WATER_ATTENUATION_R 0.6
#define WATER_ATTENUATION_G 0.4
#define WATER_ATTENUATION_B 0.3
#define UNDERWATER_VFOG 1
#define UNDERWATER_VFOG_QUALITY 8
#define UNDERWATER_VFOG_DENSITY 1.0
// Rain / wetness
#define drynessHalflife 0.25
#define wetnessHalflife 2.0
#define RAIN_SHADOW 0.98
#define RAIN_VISIBILITY 1.0
#define RAIN_SPLASH_EFFECT 1
#define RAIN_SPLASH_SPEED 1.0
#define RAIN_SPLASH_STRENGTH 1.0
#define RAIN_SPLASH_SCALE 1.0
#define RAIN_WIND_X 1.0
#define RAIN_WIND_Z 1.0
#define RAIN_DISTURBANCE 1.0
#define DISABLE_LOCAL_PRECIPITATION 0
// =============================== Sky / Atmosphere ===============================
#define ATMO_HORIZON 1
#define ATMO_REFLECTION_HORIZON 1
#define SKY_TEXTURE_BRIGHTNESS 1.0
#define HASHSTARS_BRIGHTNESS 1.0
#define STAR_TYPE 0
#define MOON_TEXTURE 1
#define BILINEAR_MOON_TEXTURE 1
#define END_PLANET_CYCLE 0
#define ACCRETIONDISC_ANGLE 0.0
#define BLACKHOLE_LQ 0
// =============================== Clouds ===============================
#define PLANAR_CLOUDS 1
#define VOLUMETRIC_CLOUDS 1
#define PC_ALTITUDE 128.0
#define PC_NOISE_SCALE 0.001
#define PC_CLEAR_COVERAGE 0.4
#define PC_CLEAR_DENSITY 0.5
#define PC_CLEAR_SUNLIGHTING 1.0
#define PC_CLEAR_SKYLIGHTING 0.6
#define PC_RAIN_COVERAGE 0.9
#define PC_RAIN_DENSITY 0.8
#define PC_RAIN_SUNLIGHTING 1.0
#define PC_RAIN_SKYLIGHTING 0.3
#define CLOUD_QUALITY 4
#define CLOUD_DETAILED_NOISE_STRENGTH 0.5
#define CLOUD_BASE_NOISE_SCALE 0.004
#define CLOUD_DETAILED_NOISE_SCALE 0.016
#define CLOUD_COVERAGE_NOISE_OFFSET 0.5
#define CLOUD_FADE 0.2
#define CLOUD_BOTTOM_BRIGHTNESS 0.6
#define CLOUD_OUTSCATTER_FACTOR 0.4
#define CLOUD_SHADOW 1
#define CLOUD_SPEED 1.0
#define CLOUD_CLEAR_ALTITUDE 192.0
#define CLOUD_CLEAR_THICKNESS 64.0
#define CLOUD_CLEAR_COVERY 0.5
#define CLOUD_CLEAR_DENSITY 0.35
#define CLOUD_CLEAR_SUNLIGHTING 1.0
#define CLOUD_CLEAR_SKYLIGHTING 0.7
#define CLOUD_CLEAR_SCALE 1.0
// =============================== Volumetric fog ===============================
#define VFOG 1
#define VFOG_REFLECTION 1
#define VFOG_REFRACTION 1
#define VFOG_HEIGHT 160.0
#define VFOG_HEIGHT_2 40.0
#define VFOG_FALLOFF 0.002
#define VFOG_DENSITY 1.0
#define VFOG_DENSITY_BASE 0.001
#define VFOG_QUALITY 24
#define VFOG_IGNORE_WORLDTIME 0
#define VFOG_SUNLIGHT_ABSORPTION 1.0
#define VFOG_RAIN_DENSITY_MUL 1.0
#define VFOG_SUNLIGHT_DENSITY 1.0
#define VFOG_STAINED 1
#define VFOG_FOG_DENSITY 0.05
#define VFOG_CLOUD_SHADOW 1
#define VFOG_NOISE_TYPE 1
#define VFOG_NOISE_OCTAVE 3
#define VFOG_NOISE_COVERAGE 0.3
#define VFOG_NOISE_HORIZONTAL_SCALE 0.004
#define VFOG_NOISE_VERTICAL_SCALE 0.01
#define LANDSCATTERING 1
#define LANDSCATTERING_STRENGTH 1.0
#define LANDSCATTERING_SHADOW 1
#define LANDSCATTERING_SHADOW_QUALITY 8
#define LANDSCATTERING_REFLECTION 1
#define LANDSCATTERING_REFRACTION 1
#define INDOOR_FOG 0
#define CAVE_FOG 1
#define CAVE_FOG_BRIGHTNESS 0.8
#define NETHERFOG_DENSITY 1.0
// =============================== Post-processing ===============================
// TAA
#define TAA_BLENDWEIGHT 0.9
#define TAA_AGGRESSION 0.05
#define TAA_SUBPIXEL_SHARPNING 0.8
// DOF
#define DOF 1
#define DISABLE_HAND_DOF 1
#define DOF_BLUR 0.5
#define DOF_QUALITY 12
#define DOF_COCSPREAD_QUALITY 12
#define DOF_MAX_COC 12.0
#define DOF_CATSEYE 0
#define DOF_CATSEYE_STRENGTH 1.0
#define DOF_CATSEYE_MIDPOINT 0.5
#define CAMERA_FOCUS_MODE 0
#define CAMERA_FOCAL_POINT 50.0
#define DOF_DEPTH_SMMOOTH_HALFLIFE 0.1
#define DOF_FOCUS_IGNORE_HAND_PARTICLE 0
// Exposure
#define AE_MODE 0
#define SMOOTH_EXPOSURE 0.3
#define AE_CURVE 0.6
#define AE_OFFSET 0.0
#define EXPOSURE_TIME 0.1
#define MANUAL_EXPOSURE 1.0
#define LUMINANCE_WEIGHT_MODE 0
#define LUMINANCE_WEIGHT_STRENGTH 1.0
#define EV_VALUE 0.0
// Motion blur
#define MOTION_BLUR 1
#define MOTION_BLUR_DITHER 1
#define MOTION_BLUR_QUALITY 8
#define MOTION_BLUR_SUTTER_MODE 0
#define MOTION_BLUR_SUTTER_ANGLE 0.0
#define MOTION_BLUR_SUTTER_SPEED 1.0
// Vignette
#define VIGNETTE 0
#define VIGNETTE_FALLOFF 1.0
#define VIGNETTE_ROUNDNESS 1.0
#define SNEAKING_VIGNETTE 1
// Bloom
#define BLOOM 1
#define BLOOM_AMOUNT 0.3
#define BLOOM_CLAMP_STRENGTH 1.0
#define NETHER_END_BLOOM_BOOST 1.0
// Color
#define TONEMAP_OPERATOR 0 // 0=ACES, 1=AGX, 2=filmic, 3=Vanilla
#define AGX_EV 0.0
#define AGX_HDR_EV 0.0
#define ABNEY_EFFECT_CORRECTION 1
#define AGX_HDR_MIDGREY 0.18
#define ADVANCED_COLOR 1
#define HIGHLIGHT_CURVE 1.0
#define SHADOW_CURVE 1.0
#define WHITE_POINT 1.0
#define BLACK_POINT 0.0
#define MIDTONE_HUE 0.0
#define MIDTONE_STRENGTH 0.0
#define HIGHLIGHT_HUE 0.0
#define HIGHLIGHT_STRENGTH 0.0
#define SHADOW_HUE 0.0
#define SHADOW_STRENGTH 0.0
#define KEEP_LUMINANCE 0
#define SATURATION 1.0
#define GAMMA 1.0
// =============================== Misc ===============================
#define CAVE_MODE 0
#define PT_HALF_RES 1
#define DEBUG_COUNTER 0
#define DEBUG_IRC 0
#define DISABLE_NIGHTVISION 0
#define DISABLE_BLINDNESS_DARKNESS 0
#define WHITE_DEBUG_WORLD 0
// RTWSM resolution
#if RTW_RESOLUTION == 256
#define RTW_RESOLUTION_Y 258
#elif RTW_RESOLUTION == 512
#define RTW_RESOLUTION_Y 514
#elif RTW_RESOLUTION == 1024
#define RTW_RESOLUTION_Y 1026
#endif
#endif