diff --git a/Source/Engine/Renderer/LightPass.cpp b/Source/Engine/Renderer/LightPass.cpp index 3edddcb41..08b080cec 100644 --- a/Source/Engine/Renderer/LightPass.cpp +++ b/Source/Engine/Renderer/LightPass.cpp @@ -98,7 +98,11 @@ bool LightPass::setupResources() psDesc.CullMode = CullMode::Normal; if (_psLightPoint.Create(psDesc, shader, "PS_Point")) return true; +#if FLAX_REVERSE_Z + psDesc.DepthFunc = ComparisonFunc::Less; +#else psDesc.DepthFunc = ComparisonFunc::Greater; +#endif psDesc.CullMode = CullMode::Inverted; if (_psLightPointInside.Create(psDesc, shader, "PS_Point")) return true; @@ -113,7 +117,11 @@ bool LightPass::setupResources() psDesc.CullMode = CullMode::Normal; if (_psLightSpot.Create(psDesc, shader, "PS_Spot")) return true; +#if FLAX_REVERSE_Z + psDesc.DepthFunc = ComparisonFunc::Less; +#else psDesc.DepthFunc = ComparisonFunc::Greater; +#endif psDesc.CullMode = CullMode::Inverted; if (_psLightSpotInside.Create(psDesc, shader, "PS_Spot")) return true; @@ -129,7 +137,11 @@ bool LightPass::setupResources() psDesc.CullMode = CullMode::Normal; if (_psLightSky->Init(psDesc)) return true; +#if FLAX_REVERSE_Z + psDesc.DepthFunc = ComparisonFunc::Less; +#else psDesc.DepthFunc = ComparisonFunc::Greater; +#endif psDesc.CullMode = CullMode::Inverted; if (_psLightSkyInside->Init(psDesc)) return true; diff --git a/Source/Engine/Renderer/ReflectionsPass.cpp b/Source/Engine/Renderer/ReflectionsPass.cpp index ac4c2b703..2fe04b04e 100644 --- a/Source/Engine/Renderer/ReflectionsPass.cpp +++ b/Source/Engine/Renderer/ReflectionsPass.cpp @@ -301,7 +301,11 @@ bool ReflectionsPass::setupResources() psDesc.DepthEnable = true; if (_psProbe->Init(psDesc)) return true; +#if FLAX_REVERSE_Z + psDesc.DepthFunc = ComparisonFunc::Less; +#else psDesc.DepthFunc = ComparisonFunc::Greater; +#endif psDesc.CullMode = CullMode::Inverted; if (_psProbeInside->Init(psDesc)) return true; diff --git a/Source/Engine/Renderer/ShadowsPass.cpp b/Source/Engine/Renderer/ShadowsPass.cpp index b30005b51..85d401ee5 100644 --- a/Source/Engine/Renderer/ShadowsPass.cpp +++ b/Source/Engine/Renderer/ShadowsPass.cpp @@ -532,7 +532,11 @@ bool ShadowsPass::setupResources() psDesc.CullMode = CullMode::Normal; if (_psShadowPoint.Create(psDesc, shader, "PS_PointLight")) return true; +#if FLAX_REVERSE_Z + psDesc.DepthFunc = ComparisonFunc::Less; +#else psDesc.DepthFunc = ComparisonFunc::Greater; +#endif psDesc.CullMode = CullMode::Inverted; if (_psShadowPointInside.Create(psDesc, shader, "PS_PointLight")) return true; @@ -546,7 +550,11 @@ bool ShadowsPass::setupResources() psDesc.CullMode = CullMode::Normal; if (_psShadowSpot.Create(psDesc, shader, "PS_SpotLight")) return true; +#if FLAX_REVERSE_Z + psDesc.DepthFunc = ComparisonFunc::Less; +#else psDesc.DepthFunc = ComparisonFunc::Greater; +#endif psDesc.CullMode = CullMode::Inverted; if (_psShadowSpotInside.Create(psDesc, shader, "PS_SpotLight")) return true;