Fix depth function

This commit is contained in:
ExMatics HydrogenC
2024-10-10 21:15:46 +08:00
parent 561d40fd71
commit 7b4a9f1a63
3 changed files with 24 additions and 0 deletions
+12
View File
@@ -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;
@@ -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;
+8
View File
@@ -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;