diff --git a/package/Shaders/Lighting.hlsl b/package/Shaders/Lighting.hlsl index 14c27cf475..141859991a 100644 --- a/package/Shaders/Lighting.hlsl +++ b/package/Shaders/Lighting.hlsl @@ -1979,16 +1979,6 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace if (dirShadow != 0.0 && (inWorld || inReflection)) dirShadow *= ShadowSampling::GetWorldShadow(input.WorldPosition, FrameBuffer::CameraPosAdjust[eyeIndex], eyeIndex); -# if defined(SKYLIGHTING) - float skylightingFadeOutFactor = 1.0; - if (!SharedData::InInterior) { - skylightingFadeOutFactor = Skylighting::getFadeOutFactor(input.WorldPosition.xyz); - // Shadow bias fix - float skylightingDirShadow = saturate(SphericalHarmonics::Unproject(skylightingSH, SharedData::DirLightDirection.xyz)); - dirShadow *= lerp(1.0, skylightingDirShadow * skylightingDirShadow, skylightingFadeOutFactor); - } -# endif - dirLightColorMultiplier *= dirShadow; float3 diffuseColor = 0.0.xxx; diff --git a/src/Features/Skylighting.cpp b/src/Features/Skylighting.cpp index 8b9545338b..a8aa648361 100644 --- a/src/Features/Skylighting.cpp +++ b/src/Features/Skylighting.cpp @@ -417,7 +417,15 @@ RE::BSLightingShaderProperty::Data* Skylighting::BSLightingShaderProperty_GetPre } } - if (property->flags.any(kZBufferWrite) && property->flags.none(kRefraction, kTempRefraction, kMultiTextureLandscape, kNoLODLandBlend, kLODLandscape, kEyeReflect, kDecal, kDynamicDecal)) { + bool valid = false; + + if (skylighting->inOcclusion) { + valid = property->flags.any(kZBufferWrite) && property->flags.none(kRefraction, kTempRefraction, kLODLandscape, kEyeReflect, kDecal, kDynamicDecal); + } else { + valid = property->flags.any(kZBufferWrite) && property->flags.none(kRefraction, kTempRefraction, kMultiTextureLandscape, kNoLODLandBlend, kLODLandscape, kEyeReflect, kDecal, kDynamicDecal); + } + + if (valid) { if (geometry->worldBound.radius > 32) { stl::enumeration technique; technique.set(RenderDepth);