From 133340b2eae2aa56898ea887d55cb38c5932ed27 Mon Sep 17 00:00:00 2001 From: ExMatics HydrogenC <33123710+HydrogenC@users.noreply.github.com> Date: Thu, 6 Jun 2024 12:56:32 +0800 Subject: [PATCH] Fix sky color being too dark --- Source/Engine/Level/Actors/Sky.cpp | 4 ++++ Source/Shaders/Sky.shader | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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; }