From eedd020064b32e8b8ebe640ed57e3c6fafaad040 Mon Sep 17 00:00:00 2001 From: DIvan2000 Date: Mon, 10 Aug 2026 04:29:26 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BE=D1=82=D0=BA=D0=BE=D1=80=D1=80=D0=B5?= =?UTF-8?q?=D0=BA=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=20?= =?UTF-8?q?=D0=BF=D0=B0=D1=80=D0=B0=D0=BC=D0=B5=D1=82=D1=80=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/render/fog/FogEnvironmentContext.java | 9 +++++---- src/client/resources/assets/veila/shaders/sim.frag | 14 +++++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/client/java/su/divan2000/veila/client/render/fog/FogEnvironmentContext.java b/src/client/java/su/divan2000/veila/client/render/fog/FogEnvironmentContext.java index cb9cedd..339848a 100644 --- a/src/client/java/su/divan2000/veila/client/render/fog/FogEnvironmentContext.java +++ b/src/client/java/su/divan2000/veila/client/render/fog/FogEnvironmentContext.java @@ -39,6 +39,7 @@ public final class FogEnvironmentContext { long timeOfDay = world.getTimeOfDay() % 24000L; long totalDays = world.getTimeOfDay() / 24000L; + float timeOfDayNorm = timeOfDay/24000.0F; // === 1. Трапеция для EMISSION === double noiseValue = dayNoise.sample(totalDays * 0.05, 0); @@ -73,10 +74,10 @@ public final class FogEnvironmentContext { double dayNoiseValue = dayNoise.sample(totalDays * 0.1, 100); float rawFogDayRandom = (float)(0.5 + dayNoiseValue * 0.5); - // === 4. HeightFadeMax (90 ± 10 от дневного шума) === - double heightNoise = dayNoise.sample(totalDays * 0.1, 200); - float rawHeightFadeMax = 90.0f + (float)(heightNoise * 10.0); - rawHeightFadeMax = Math.max(80.0f, Math.min(100.0f, rawHeightFadeMax)); + // === 4. HeightFadeMax (110 +15/-20 от дневного шума) === + double heightNoise = dayNoise.sample(totalDays * 0.5, 200)+dayNoise.sample(timeOfDayNorm*2, totalDays)*0.25; + float rawHeightFadeMax = 110.0f + (float)(heightNoise * 15.0); + rawHeightFadeMax = Math.max(90.0f, Math.min(125.0f, rawHeightFadeMax)); // === 5. Сглаживание === float lerpSpeed = 0.08f; diff --git a/src/client/resources/assets/veila/shaders/sim.frag b/src/client/resources/assets/veila/shaders/sim.frag index 2220e7b..6475fc1 100644 --- a/src/client/resources/assets/veila/shaders/sim.frag +++ b/src/client/resources/assets/veila/shaders/sim.frag @@ -30,6 +30,7 @@ const float MIN_Y = -64.0; const float SIZE_Y = 384.0; const float UNDERGROUND_TARGET_DENSITY = 0.008; // Подземная дымка (слабее поверхностной) +const float UNDERGROUND_EMISSION = 1.0; float getEmission(uint magnitude, bool isAbsorber) { if (isAbsorber || magnitude == 0u) return 0.0; @@ -51,8 +52,15 @@ void main() { float biomeHumidity = biomeParams.b; float biomeTimeSensitivity = biomeParams.a; + // Под землёй и в закрытых местах туман ведёт себя иначе + float skyLight = texture(SkyLightSampler, uv).r; + float skyLightSmooth = smoothstep(0.2, 0.8, skyLight); + // === Emission === - float finalEmission = biomeEmission * EmissionMultiplier * GlobalEmissionMultiplier; + float emissionTimeFactor = mix(1.0, EmissionMultiplier, biomeTimeSensitivity); + + float surfaceEmission = biomeEmission * emissionTimeFactor; + float finalEmission = mix(UNDERGROUND_EMISSION, surfaceEmission, skyLightSmooth) * GlobalEmissionMultiplier; // === Target Density === // 1. Определяем, туманный ли сегодня день @@ -72,10 +80,6 @@ void main() { float worldY = uv.y * SIZE_Y + MIN_Y; float heightFade = 1.0 - clamp((worldY - HEIGHT_FADE_MIN) / (HeightFadeMax - HEIGHT_FADE_MIN), 0.0, 1.0); - // 4. Под землёй дымка другая - float skyLight = texture(SkyLightSampler, uv).r; - float skyLightSmooth = smoothstep(0.2, 0.8, skyLight); - // 4. Итоговая плотность float surfaceTargetDensity = biomeTargetDensityBase * hasFogToday * timeFactor * heightFade; float finalTargetDensity = mix(UNDERGROUND_TARGET_DENSITY, surfaceTargetDensity, skyLightSmooth);