diff --git a/Source/Engine/Level/Actors/Sky.cpp b/Source/Engine/Level/Actors/Sky.cpp index 674b5d1a9..2ab7aa0c3 100644 --- a/Source/Engine/Level/Actors/Sky.cpp +++ b/Source/Engine/Level/Actors/Sky.cpp @@ -99,7 +99,11 @@ void Sky::Draw(RenderContext& renderContext) psDesc.CullMode = CullMode::Inverted; psDesc.DepthWriteEnable = false; psDesc.DepthClipEnable = false; +#if FLAX_REVERSE_Z + psDesc.DepthFunc = ComparisonFunc::GreaterEqual; +#else psDesc.DepthFunc = ComparisonFunc::LessEqual; +#endif if (_psSky->Init(psDesc)) { diff --git a/Source/Shaders/Sky.shader b/Source/Shaders/Sky.shader index b5fe709be..4d175d59d 100644 --- a/Source/Shaders/Sky.shader +++ b/Source/Shaders/Sky.shader @@ -34,7 +34,11 @@ MaterialInput VS(ModelInput_PosOnly input) output.ScreenPos = output.Position; // Place pixels on the far plane - output.Position = output.Position.xyzz; +#if FLAX_REVERSE_Z + output.Position.z = 0; +#else + output.Position.z = output.Position.w; +#endif return output; }