Merge remote-tracking branch 'upstream/development' into michabr/lyshine_shader_loc

This commit is contained in:
abrmich
2022-01-04 11:33:30 -08:00
98 changed files with 1709 additions and 220 deletions
@@ -184,6 +184,14 @@ namespace AZ
//! Reduces acne by biasing the shadowmap lookup along the geometric normal.
//! @param normalShadowBias Sets the amount of normal shadow bias to apply.
virtual void SetNormalShadowBias(float normalShadowBias) = 0;
//! Gets whether the directional shadow map has cascade blending enabled.
//! This smooths out the border between cascades at the cost of some performance in the blend area.
virtual bool GetCascadeBlendingEnabled() const = 0;
//! Sets whether the directional shadow map has cascade blending enabled.
//! @param enable flag specifying whether to enable cascade blending.
virtual void SetCascadeBlendingEnabled(bool enable) = 0;
};
using DirectionalLightRequestBus = EBus<DirectionalLightRequests>;
@@ -115,6 +115,9 @@ namespace AZ
//! Reduces shadow acne by applying a small amount of offset along shadow-space z.
float m_shadowBias = 0.0f;
// If true, sample between two adjacent shadow map cascades in a small boundary area to smooth out the transition.
bool m_cascadeBlendingEnabled = false;
bool IsSplitManual() const;
bool IsSplitAutomatic() const;
bool IsCascadeCorrectionDisabled() const;
@@ -40,7 +40,8 @@ namespace AZ
->Field("PcfFilteringSampleCount", &DirectionalLightComponentConfig::m_filteringSampleCount)
->Field("ShadowReceiverPlaneBiasEnabled", &DirectionalLightComponentConfig::m_receiverPlaneBiasEnabled)
->Field("Shadow Bias", &DirectionalLightComponentConfig::m_shadowBias)
->Field("Normal Shadow Bias", &DirectionalLightComponentConfig::m_normalShadowBias);
->Field("Normal Shadow Bias", &DirectionalLightComponentConfig::m_normalShadowBias)
->Field("CascadeBlendingEnabled", &DirectionalLightComponentConfig::m_cascadeBlendingEnabled);
}
}
@@ -113,8 +114,7 @@ namespace AZ
bool DirectionalLightComponentConfig::IsShadowPcfDisabled() const
{
return !(m_shadowFilterMethod == ShadowFilterMethod::Pcf ||
m_shadowFilterMethod == ShadowFilterMethod::EsmPcf);
return !(m_shadowFilterMethod == ShadowFilterMethod::Pcf);
}
bool DirectionalLightComponentConfig::IsEsmDisabled() const
@@ -88,6 +88,8 @@ namespace AZ
->Event("SetShadowBias", &DirectionalLightRequestBus::Events::SetShadowBias)
->Event("GetNormalShadowBias", &DirectionalLightRequestBus::Events::GetNormalShadowBias)
->Event("SetNormalShadowBias", &DirectionalLightRequestBus::Events::SetNormalShadowBias)
->Event("GetCascadeBlendingEnabled", &DirectionalLightRequestBus::Events::GetCascadeBlendingEnabled)
->Event("SetCascadeBlendingEnabled", &DirectionalLightRequestBus::Events::SetCascadeBlendingEnabled)
->VirtualProperty("Color", "GetColor", "SetColor")
->VirtualProperty("Intensity", "GetIntensity", "SetIntensity")
->VirtualProperty("AngularDiameter", "GetAngularDiameter", "SetAngularDiameter")
@@ -104,7 +106,8 @@ namespace AZ
->VirtualProperty("FilteringSampleCount", "GetFilteringSampleCount", "SetFilteringSampleCount")
->VirtualProperty("ShadowReceiverPlaneBiasEnabled", "GetShadowReceiverPlaneBiasEnabled", "SetShadowReceiverPlaneBiasEnabled")
->VirtualProperty("ShadowBias", "GetShadowBias", "SetShadowBias")
->VirtualProperty("NormalShadowBias", "GetNormalShadowBias", "SetNormalShadowBias");
->VirtualProperty("NormalShadowBias", "GetNormalShadowBias", "SetNormalShadowBias")
->VirtualProperty("BlendBetweenCascadesEnabled", "GetCascadeBlendingEnabled", "SetCascadeBlendingEnabled");
;
}
}
@@ -537,6 +540,7 @@ namespace AZ
SetNormalShadowBias(m_configuration.m_normalShadowBias);
SetFilteringSampleCount(m_configuration.m_filteringSampleCount);
SetShadowReceiverPlaneBiasEnabled(m_configuration.m_receiverPlaneBiasEnabled);
SetCascadeBlendingEnabled(m_configuration.m_cascadeBlendingEnabled);
// [GFX TODO][ATOM-1726] share config for multiple light (e.g., light ID).
// [GFX TODO][ATOM-2416] adapt to multiple viewports.
@@ -636,5 +640,16 @@ namespace AZ
m_featureProcessor->SetShadowReceiverPlaneBiasEnabled(m_lightHandle, enable);
}
bool DirectionalLightComponentController::GetCascadeBlendingEnabled() const
{
return m_configuration.m_cascadeBlendingEnabled;
}
void DirectionalLightComponentController::SetCascadeBlendingEnabled(bool enable)
{
m_configuration.m_cascadeBlendingEnabled = enable;
m_featureProcessor->SetCascadeBlendingEnabled(m_lightHandle, enable);
}
} // namespace Render
} // namespace AZ
@@ -83,7 +83,9 @@ namespace AZ
float GetShadowBias() const override;
void SetShadowBias(float bias) override;
float GetNormalShadowBias() const override;
void SetNormalShadowBias(float bias) override;
void SetNormalShadowBias(float bias) override;
bool GetCascadeBlendingEnabled() const override;
void SetCascadeBlendingEnabled(bool enable) override;
private:
friend class EditorDirectionalLightComponent;
@@ -161,7 +161,11 @@ namespace AZ
->Attribute(Edit::Attributes::Min, 0.f)
->Attribute(Edit::Attributes::Max, 10.0f)
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
;
->DataElement(
Edit::UIHandlers::CheckBox, &DirectionalLightComponentConfig::m_cascadeBlendingEnabled,
"Blend between cascades\n", "Enables smooth blending between shadow map cascades.")
->Attribute(Edit::Attributes::ReadOnly, &DirectionalLightComponentConfig::IsShadowPcfDisabled)
;
}
}