Merge branch 'development' into cmake/warn_virtual

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

# Conflicts:
#	Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.h
This commit is contained in:
Esteban Papp
2021-09-14 16:54:52 -07:00
37 changed files with 45 additions and 539 deletions
@@ -37,9 +37,7 @@ namespace AZ
->Field("Shadowmap Max Size", &AreaLightComponentConfig::m_shadowmapMaxSize)
->Field("Shadow Filter Method", &AreaLightComponentConfig::m_shadowFilterMethod)
->Field("Softening Boundary Width", &AreaLightComponentConfig::m_boundaryWidthInDegrees)
->Field("Prediction Sample Count", &AreaLightComponentConfig::m_predictionSampleCount)
->Field("Filtering Sample Count", &AreaLightComponentConfig::m_filteringSampleCount)
->Field("Pcf Method", &AreaLightComponentConfig::m_pcfMethod)
->Field("Esm Exponent", &AreaLightComponentConfig::m_esmExponent)
;
}
@@ -182,31 +180,9 @@ namespace AZ
m_shadowFilterMethod == ShadowFilterMethod::EsmPcf);
}
bool AreaLightComponentConfig::IsPcfBoundarySearchDisabled() const
{
if (IsShadowPcfDisabled())
{
return true;
}
return m_pcfMethod != PcfMethod::BoundarySearch;
}
bool AreaLightComponentConfig::IsEsmDisabled() const
{
return !(m_shadowFilterMethod == ShadowFilterMethod::Esm || m_shadowFilterMethod == ShadowFilterMethod::EsmPcf);
}
bool AreaLightComponentConfig::IsSofteningBoundaryWidthDisabled() const
{
// softening boundary width is always available with ESM. It controls the width of the blur kernel during the ESM gaussian
// blur passes
if (!IsEsmDisabled())
return false;
// with PCF, softening boundary width is used with the boundary search method and NOT the bicubic pcf methods
return IsPcfBoundarySearchDisabled();
}
}
}
@@ -76,12 +76,8 @@ namespace AZ::Render
->Event("SetShadowFilterMethod", &AreaLightRequestBus::Events::SetShadowFilterMethod)
->Event("GetSofteningBoundaryWidthAngle", &AreaLightRequestBus::Events::GetSofteningBoundaryWidthAngle)
->Event("SetSofteningBoundaryWidthAngle", &AreaLightRequestBus::Events::SetSofteningBoundaryWidthAngle)
->Event("GetPredictionSampleCount", &AreaLightRequestBus::Events::GetPredictionSampleCount)
->Event("SetPredictionSampleCount", &AreaLightRequestBus::Events::SetPredictionSampleCount)
->Event("GetFilteringSampleCount", &AreaLightRequestBus::Events::GetFilteringSampleCount)
->Event("SetFilteringSampleCount", &AreaLightRequestBus::Events::SetFilteringSampleCount)
->Event("GetPcfMethod", &AreaLightRequestBus::Events::GetPcfMethod)
->Event("SetPcfMethod", &AreaLightRequestBus::Events::SetPcfMethod)
->Event("GetEsmExponent", &AreaLightRequestBus::Events::GetEsmExponent)
->Event("SetEsmExponent", &AreaLightRequestBus::Events::SetEsmExponent)
@@ -100,9 +96,7 @@ namespace AZ::Render
->VirtualProperty("ShadowmapMaxSize", "GetShadowmapMaxSize", "SetShadowmapMaxSize")
->VirtualProperty("ShadowFilterMethod", "GetShadowFilterMethod", "SetShadowFilterMethod")
->VirtualProperty("SofteningBoundaryWidthAngle", "GetSofteningBoundaryWidthAngle", "SetSofteningBoundaryWidthAngle")
->VirtualProperty("PredictionSampleCount", "GetPredictionSampleCount", "SetPredictionSampleCount")
->VirtualProperty("FilteringSampleCount", "GetFilteringSampleCount", "SetFilteringSampleCount")
->VirtualProperty("PcfMethod", "GetPcfMethod", "SetPcfMethod")
->VirtualProperty("EsmExponent", "GetEsmExponent", "SetEsmExponent");
;
}
@@ -314,9 +308,7 @@ namespace AZ::Render
m_lightShapeDelegate->SetShadowmapMaxSize(m_configuration.m_shadowmapMaxSize);
m_lightShapeDelegate->SetShadowFilterMethod(m_configuration.m_shadowFilterMethod);
m_lightShapeDelegate->SetSofteningBoundaryWidthAngle(m_configuration.m_boundaryWidthInDegrees);
m_lightShapeDelegate->SetPredictionSampleCount(m_configuration.m_predictionSampleCount);
m_lightShapeDelegate->SetFilteringSampleCount(m_configuration.m_filteringSampleCount);
m_lightShapeDelegate->SetPcfMethod(m_configuration.m_pcfMethod);
m_lightShapeDelegate->SetEsmExponent(m_configuration.m_esmExponent);
}
}
@@ -528,20 +520,6 @@ namespace AZ::Render
}
}
uint32_t AreaLightComponentController::GetPredictionSampleCount() const
{
return m_configuration.m_predictionSampleCount;
}
void AreaLightComponentController::SetPredictionSampleCount(uint32_t count)
{
m_configuration.m_predictionSampleCount = static_cast<uint16_t>(count);
if (m_lightShapeDelegate)
{
m_lightShapeDelegate->SetPredictionSampleCount(count);
}
}
uint32_t AreaLightComponentController::GetFilteringSampleCount() const
{
return m_configuration.m_filteringSampleCount;
@@ -568,20 +546,6 @@ namespace AZ::Render
m_lightShapeDelegate->DrawDebugDisplay(transform, m_configuration.m_color, debugDisplay, isSelected);
}
}
PcfMethod AreaLightComponentController::GetPcfMethod() const
{
return m_configuration.m_pcfMethod;
}
void AreaLightComponentController::SetPcfMethod(PcfMethod method)
{
m_configuration.m_pcfMethod = method;
if (m_lightShapeDelegate)
{
m_lightShapeDelegate->SetPcfMethod(method);
}
}
float AreaLightComponentController::GetEsmExponent() const
{
@@ -84,12 +84,8 @@ namespace AZ
void SetShadowFilterMethod(ShadowFilterMethod method) override;
float GetSofteningBoundaryWidthAngle() const override;
void SetSofteningBoundaryWidthAngle(float width) override;
uint32_t GetPredictionSampleCount() const override;
void SetPredictionSampleCount(uint32_t count) override;
uint32_t GetFilteringSampleCount() const override;
void SetFilteringSampleCount(uint32_t count) override;
PcfMethod GetPcfMethod() const override;
void SetPcfMethod(PcfMethod method) override;
float GetEsmExponent() const override;
void SetEsmExponent(float exponent) override;
@@ -38,9 +38,7 @@ namespace AZ
->Field("IsDebugColoringEnabled", &DirectionalLightComponentConfig::m_isDebugColoringEnabled)
->Field("ShadowFilterMethod", &DirectionalLightComponentConfig::m_shadowFilterMethod)
->Field("SofteningBoundaryWidth", &DirectionalLightComponentConfig::m_boundaryWidth)
->Field("PcfPredictionSampleCount", &DirectionalLightComponentConfig::m_predictionSampleCount)
->Field("PcfFilteringSampleCount", &DirectionalLightComponentConfig::m_filteringSampleCount)
->Field("Pcf Method", &DirectionalLightComponentConfig::m_pcfMethod)
->Field("ShadowReceiverPlaneBiasEnabled", &DirectionalLightComponentConfig::m_receiverPlaneBiasEnabled);
}
}
@@ -118,31 +116,9 @@ namespace AZ
m_shadowFilterMethod == ShadowFilterMethod::EsmPcf);
}
bool DirectionalLightComponentConfig::IsPcfBoundarySearchDisabled() const
{
if (IsShadowPcfDisabled())
{
return true;
}
return m_pcfMethod != PcfMethod::BoundarySearch;
}
bool DirectionalLightComponentConfig::IsEsmDisabled() const
{
return !(m_shadowFilterMethod == ShadowFilterMethod::Esm || m_shadowFilterMethod == ShadowFilterMethod::EsmPcf);
}
bool DirectionalLightComponentConfig::IsSofteningBoundaryWidthDisabled() const
{
// softening boundary width is always available with ESM. It controls the width of the blur kernel during the ESM gaussian
// blur passes
if (!IsEsmDisabled())
return false;
// with PCF, softening boundary width is used with the boundary search method and NOT the bicubic pcf methods
return IsPcfBoundarySearchDisabled();
}
} // namespace Render
} // namespace AZ
@@ -82,12 +82,8 @@ namespace AZ
->Event("SetShadowFilterMethod", &DirectionalLightRequestBus::Events::SetShadowFilterMethod)
->Event("GetSofteningBoundaryWidth", &DirectionalLightRequestBus::Events::GetSofteningBoundaryWidth)
->Event("SetSofteningBoundaryWidth", &DirectionalLightRequestBus::Events::SetSofteningBoundaryWidth)
->Event("GetPredictionSampleCount", &DirectionalLightRequestBus::Events::GetPredictionSampleCount)
->Event("SetPredictionSampleCount", &DirectionalLightRequestBus::Events::SetPredictionSampleCount)
->Event("GetFilteringSampleCount", &DirectionalLightRequestBus::Events::GetFilteringSampleCount)
->Event("SetFilteringSampleCount", &DirectionalLightRequestBus::Events::SetFilteringSampleCount)
->Event("GetPcfMethod", &DirectionalLightRequestBus::Events::GetPcfMethod)
->Event("SetPcfMethod", &DirectionalLightRequestBus::Events::SetPcfMethod)
->Event("GetShadowReceiverPlaneBiasEnabled", &DirectionalLightRequestBus::Events::GetShadowReceiverPlaneBiasEnabled)
->Event("SetShadowReceiverPlaneBiasEnabled", &DirectionalLightRequestBus::Events::SetShadowReceiverPlaneBiasEnabled)
->VirtualProperty("Color", "GetColor", "SetColor")
@@ -104,9 +100,7 @@ namespace AZ
->VirtualProperty("DebugColoringEnabled", "GetDebugColoringEnabled", "SetDebugColoringEnabled")
->VirtualProperty("ShadowFilterMethod", "GetShadowFilterMethod", "SetShadowFilterMethod")
->VirtualProperty("SofteningBoundaryWidth", "GetSofteningBoundaryWidth", "SetSofteningBoundaryWidth")
->VirtualProperty("PredictionSampleCount", "GetPredictionSampleCount", "SetPredictionSampleCount")
->VirtualProperty("FilteringSampleCount", "GetFilteringSampleCount", "SetFilteringSampleCount")
->VirtualProperty("PcfMethod", "GetPcfMethod", "SetPcfMethod")
->VirtualProperty("ShadowReceiverPlaneBiasEnabled", "GetShadowReceiverPlaneBiasEnabled", "SetShadowReceiverPlaneBiasEnabled");
;
}
@@ -425,21 +419,6 @@ namespace AZ
}
}
uint32_t DirectionalLightComponentController::GetPredictionSampleCount() const
{
return aznumeric_cast<uint32_t>(m_configuration.m_predictionSampleCount);
}
void DirectionalLightComponentController::SetPredictionSampleCount(uint32_t count)
{
const uint16_t count16 = GetMin(Shadow::MaxPcfSamplingCount, aznumeric_cast<uint16_t>(count));
m_configuration.m_predictionSampleCount = count16;
if (m_featureProcessor)
{
m_featureProcessor->SetPredictionSampleCount(m_lightHandle, count16);
}
}
uint32_t DirectionalLightComponentController::GetFilteringSampleCount() const
{
return aznumeric_cast<uint32_t>(m_configuration.m_filteringSampleCount);
@@ -539,9 +518,7 @@ namespace AZ
SetDebugColoringEnabled(m_configuration.m_isDebugColoringEnabled);
SetShadowFilterMethod(m_configuration.m_shadowFilterMethod);
SetSofteningBoundaryWidth(m_configuration.m_boundaryWidth);
SetPredictionSampleCount(m_configuration.m_predictionSampleCount);
SetFilteringSampleCount(m_configuration.m_filteringSampleCount);
SetPcfMethod(m_configuration.m_pcfMethod);
SetShadowReceiverPlaneBiasEnabled(m_configuration.m_receiverPlaneBiasEnabled);
// [GFX TODO][ATOM-1726] share config for multiple light (e.g., light ID).
@@ -631,17 +608,6 @@ namespace AZ
}
}
PcfMethod DirectionalLightComponentController::GetPcfMethod() const
{
return m_configuration.m_pcfMethod;
}
void DirectionalLightComponentController::SetPcfMethod(PcfMethod method)
{
m_configuration.m_pcfMethod = method;
m_featureProcessor->SetPcfMethod(m_lightHandle, method);
}
bool DirectionalLightComponentController::GetShadowReceiverPlaneBiasEnabled() const
{
return m_configuration.m_receiverPlaneBiasEnabled;
@@ -78,12 +78,8 @@ namespace AZ
void SetShadowFilterMethod(ShadowFilterMethod method) override;
float GetSofteningBoundaryWidth() const override;
void SetSofteningBoundaryWidth(float width) override;
uint32_t GetPredictionSampleCount() const override;
void SetPredictionSampleCount(uint32_t count) override;
uint32_t GetFilteringSampleCount() const override;
void SetFilteringSampleCount(uint32_t count) override;
PcfMethod GetPcfMethod() const override;
void SetPcfMethod(PcfMethod method) override;
bool GetShadowReceiverPlaneBiasEnabled() const override;
void SetShadowReceiverPlaneBiasEnabled(bool enable) override;
@@ -155,14 +155,6 @@ namespace AZ::Render
}
}
void DiskLightDelegate::SetPredictionSampleCount(uint32_t count)
{
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), static_cast<uint16_t>(count));
}
}
void DiskLightDelegate::SetFilteringSampleCount(uint32_t count)
{
if (GetShadowsEnabled() && GetLightHandle().IsValid())
@@ -171,14 +163,6 @@ namespace AZ::Render
}
}
void DiskLightDelegate::SetPcfMethod(PcfMethod method)
{
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetPcfMethod(GetLightHandle(), method);
}
}
void DiskLightDelegate::SetEsmExponent(float exponent)
{
if (GetShadowsEnabled() && GetLightHandle().IsValid())
@@ -45,9 +45,7 @@ namespace AZ
void SetShadowmapMaxSize(ShadowmapSize size) override;
void SetShadowFilterMethod(ShadowFilterMethod method) override;
void SetSofteningBoundaryWidthAngle(float widthInDegrees) override;
void SetPredictionSampleCount(uint32_t count) override;
void SetFilteringSampleCount(uint32_t count) override;
void SetPcfMethod(PcfMethod method) override;
void SetEsmExponent(float exponent) override;
private:
@@ -162,29 +162,13 @@ namespace AZ
->Attribute(Edit::Attributes::Max, 1.f)
->Attribute(Edit::Attributes::Suffix, " deg")
->Attribute(Edit::Attributes::Visibility, &AreaLightComponentConfig::SupportsShadows)
->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::IsSofteningBoundaryWidthDisabled)
->DataElement(Edit::UIHandlers::Slider, &AreaLightComponentConfig::m_predictionSampleCount, "Prediction sample count",
"Sample count for prediction of whether the pixel is on the boundary. Specific to PCF and ESM+PCF.")
->Attribute(Edit::Attributes::Min, 4)
->Attribute(Edit::Attributes::Max, 16)
->Attribute(Edit::Attributes::Visibility, &AreaLightComponentConfig::SupportsShadows)
->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::IsPcfBoundarySearchDisabled)
->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::IsEsmDisabled)
->DataElement(Edit::UIHandlers::Slider, &AreaLightComponentConfig::m_filteringSampleCount, "Filtering sample count",
"This is only used when the pixel is predicted to be on the boundary. Specific to PCF and ESM+PCF.")
->Attribute(Edit::Attributes::Min, 4)
->Attribute(Edit::Attributes::Max, 64)
->Attribute(Edit::Attributes::Visibility, &AreaLightComponentConfig::SupportsShadows)
->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::IsShadowPcfDisabled)
->DataElement(
Edit::UIHandlers::ComboBox, &AreaLightComponentConfig::m_pcfMethod, "PCF method",
"Type of PCF to use.\n"
" Bicubic: a smooth, fixed-size kernel \n"
" Boundary search: do several taps to first determine if we are on a shadow boundary\n")
->EnumAttribute(PcfMethod::Bicubic, "Bicubic")
->EnumAttribute(PcfMethod::BoundarySearch, "Boundary search")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::Visibility, &AreaLightComponentConfig::SupportsShadows)
->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::IsShadowPcfDisabled)
->DataElement(
Edit::UIHandlers::Slider, &AreaLightComponentConfig::m_esmExponent, "ESM exponent",
"Exponent used by ESM shadows. "
@@ -141,14 +141,7 @@ namespace AZ
->Attribute(Edit::Attributes::Max, 0.1f)
->Attribute(Edit::Attributes::Suffix, " m")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &DirectionalLightComponentConfig::IsSofteningBoundaryWidthDisabled)
->DataElement(Edit::UIHandlers::Slider, &DirectionalLightComponentConfig::m_predictionSampleCount, "Prediction sample count",
"Sample count for prediction of whether the pixel is on the boundary. "
"Specific to PCF and ESM+PCF.")
->Attribute(Edit::Attributes::Min, 4)
->Attribute(Edit::Attributes::Max, 16)
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &DirectionalLightComponentConfig::IsPcfBoundarySearchDisabled)
->Attribute(Edit::Attributes::ReadOnly, &DirectionalLightComponentConfig::IsEsmDisabled)
->DataElement(Edit::UIHandlers::Slider, &DirectionalLightComponentConfig::m_filteringSampleCount, "Filtering sample count",
"This is used only when the pixel is predicted as on the boundary. "
"Specific to PCF and ESM+PCF.")
@@ -156,15 +149,6 @@ namespace AZ
->Attribute(Edit::Attributes::Max, 64)
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &DirectionalLightComponentConfig::IsShadowPcfDisabled)
->DataElement(
Edit::UIHandlers::ComboBox, &DirectionalLightComponentConfig::m_pcfMethod, "Pcf method",
"Type of PCF to use.\n"
" Bicubic: a smooth, fixed-size kernel \n"
" Boundary search: do several taps to first determine if we are on a shadow boundary\n")
->EnumAttribute(PcfMethod::Bicubic, "Bicubic")
->EnumAttribute(PcfMethod::BoundarySearch, "Boundary search")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::ReadOnly, &DirectionalLightComponentConfig::IsShadowPcfDisabled)
->DataElement(
Edit::UIHandlers::CheckBox, &DirectionalLightComponentConfig::m_receiverPlaneBiasEnabled,
"Shadow Receiver Plane Bias Enable",
@@ -57,9 +57,7 @@ namespace AZ
void SetShadowmapMaxSize([[maybe_unused]] ShadowmapSize size) override {};
void SetShadowFilterMethod([[maybe_unused]] ShadowFilterMethod method) override {};
void SetSofteningBoundaryWidthAngle([[maybe_unused]] float widthInDegrees) override {};
void SetPredictionSampleCount([[maybe_unused]] uint32_t count) override {};
void SetFilteringSampleCount([[maybe_unused]] uint32_t count) override {};
void SetPcfMethod([[maybe_unused]] PcfMethod method) override {};
void SetEsmExponent([[maybe_unused]] float esmExponent) override{};
protected:
@@ -77,12 +77,8 @@ namespace AZ
virtual void SetShadowFilterMethod(ShadowFilterMethod method) = 0;
//! Sets the width of boundary between shadowed area and lit area in degrees.
virtual void SetSofteningBoundaryWidthAngle(float widthInDegrees) = 0;
//! Sets the sample count to predict the boundary of the shadow. Max 16, should be less than filtering sample count.
virtual void SetPredictionSampleCount(uint32_t count) = 0;
//! Sets the sample count for filtering of the shadow boundary, max 64.
virtual void SetFilteringSampleCount(uint32_t count) = 0;
//! Sets the Pcf (Percentage closer filtering) method to use.
virtual void SetPcfMethod(PcfMethod method) = 0;
//! Sets the Esm exponent to use. Higher values produce a steeper falloff between light and shadow.
virtual void SetEsmExponent(float exponent) = 0;
};
@@ -100,14 +100,6 @@ namespace AZ::Render
}
}
void SphereLightDelegate::SetPredictionSampleCount(uint32_t count)
{
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), static_cast<uint16_t>(count));
}
}
void SphereLightDelegate::SetFilteringSampleCount(uint32_t count)
{
if (GetShadowsEnabled() && GetLightHandle().IsValid())
@@ -116,14 +108,6 @@ namespace AZ::Render
}
}
void SphereLightDelegate::SetPcfMethod(PcfMethod method)
{
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetPcfMethod(GetLightHandle(), method);
}
}
void SphereLightDelegate::SetEsmExponent(float esmExponent)
{
if (GetShadowsEnabled() && GetLightHandle().IsValid())
@@ -35,9 +35,7 @@ namespace AZ
void SetShadowmapMaxSize(ShadowmapSize size) override;
void SetShadowFilterMethod(ShadowFilterMethod method) override;
void SetSofteningBoundaryWidthAngle(float widthInDegrees) override;
void SetPredictionSampleCount(uint32_t count) override;
void SetFilteringSampleCount(uint32_t count) override;
void SetPcfMethod(PcfMethod method) override;
void SetEsmExponent(float esmExponent) override;
private: