diff --git a/package/Shaders/ISVolumetricLightingGenerateCS.hlsl b/package/Shaders/ISVolumetricLightingGenerateCS.hlsl index 93a47e5b4f..7053aedfee 100644 --- a/package/Shaders/ISVolumetricLightingGenerateCS.hlsl +++ b/package/Shaders/ISVolumetricLightingGenerateCS.hlsl @@ -113,6 +113,11 @@ cbuffer PerTechnique : register(b0) float phaseContribution = lerp(1, phaseFactor, PhaseContribution); float shadowContribution = noShadow; + +# if defined(TERRAIN_SHADOWS) || defined(CLOUD_SHADOWS) + shadowContribution *= sqrt(ShadowSampling::GetWorldShadow(positionWS.xyz, PosAdjust[eyeIndex], eyeIndex)); +# endif + float vl = shadowContribution * densityContribution * phaseContribution; DensityRW[dispatchID.xyz] = vl; diff --git a/src/Features/SkySync.cpp b/src/Features/SkySync.cpp index 24af218512..df4fc14ad0 100644 --- a/src/Features/SkySync.cpp +++ b/src/Features/SkySync.cpp @@ -85,7 +85,6 @@ void SkySync::PostPostLoad() stl::detour_thunk(REL::RelocationID(25626, 26169)); stl::detour_thunk(REL::RelocationID(25682, 26229)); stl::detour_thunk(REL::RelocationID(25695, 26242)); - stl::write_thunk_call(REL::RelocationID(100475, 107193).address() + 0x354); gSunPosition = reinterpret_cast(REL::RelocationID(527924, 414871).address()); gSunGlareSize = reinterpret_cast(REL::RelocationID(502611, 370235).address()); @@ -415,7 +414,6 @@ void SkySync::ShadowFader::SetLighting(const RE::Sun* sun, RE::NiPoint3 dir, flo sun->light->Update(updateData); intensity = std::clamp(intensity, 0.0f, 1.0f); - volumetricLightingIntensityFactor = intensity; } inline void SkySync::ShadowFader::ClampDirection(RE::NiPoint3& dir) @@ -436,14 +434,6 @@ inline void SkySync::ShadowFader::ClampDirection(RE::NiPoint3& dir) dir.z = sinElev; } -SkySync::VolumetricLightingDescriptor* SkySync::ApplyVolumetricLighting_VolumetricLightingDescriptor_Get::thunk() -{ - const auto volumetricLightingDescriptor = func(); - if (globals::features::skySync.settings.Enabled) - volumetricLightingDescriptor->lightingIntensity *= volumetricLightingIntensityFactor; - return volumetricLightingDescriptor; -} - void SkySync::ClimateTimings::Update(const RE::TESClimate* climate) { const float SunriseBeginOffset = globals::features::skySync.settings.SunriseBeginOffset; diff --git a/src/Features/SkySync.h b/src/Features/SkySync.h index f8e355b076..941d5667f4 100644 --- a/src/Features/SkySync.h +++ b/src/Features/SkySync.h @@ -69,19 +69,6 @@ struct SkySync : Feature static inline REL::Relocation func; }; - struct VolumetricLightingDescriptor - { - float lightingIntensity; - }; - - struct ApplyVolumetricLighting_VolumetricLightingDescriptor_Get - { - static VolumetricLightingDescriptor* thunk(); - static inline REL::Relocation func; - }; - - inline static float volumetricLightingIntensityFactor = 1.0f; - private: enum class MoonLightSource : uint8_t {