diff --git a/package/Shaders/Lighting.hlsl b/package/Shaders/Lighting.hlsl index 9c7fb533f..103b8eab3 100644 --- a/package/Shaders/Lighting.hlsl +++ b/package/Shaders/Lighting.hlsl @@ -2046,6 +2046,7 @@ PS_OUTPUT main(PS_INPUT input, bool frontFace psout.Depth = lerp(depthSampled, input.Position.z, blendFactorTerrain > screenNoise); # endif + psout.Depth = lerp(max(depthSampled, input.Position.z), input.Position.z, blendFactorTerrain > screenNoise); # endif psout.MotionVectors.zw = float2(0.0, psout.Diffuse.w); diff --git a/src/Features/TerrainBlending.h b/src/Features/TerrainBlending.h index ec53bacaa..d6f73237f 100644 --- a/src/Features/TerrainBlending.h +++ b/src/Features/TerrainBlending.h @@ -132,7 +132,8 @@ struct TerrainBlending : Feature singleton->renderTerrainDepth = inTerrain; } - func(a_pass, a_technique, a_alphaTest, a_renderFlags); // Run terrain twice + if (inTerrain) + func(a_pass, a_technique, a_alphaTest, a_renderFlags); // Run terrain twice } else if (singleton->renderWorld) { // Entering or exiting terrain section bool inTerrain = a_pass->shaderProperty && a_pass->shaderProperty->flags.all(RE::BSShaderProperty::EShaderPropertyFlag::kMultiTextureLandscape);