Merge branch 'stabilization/2110' into Atom/santorac/MaterialEditorHandlesMissingTextures

This commit is contained in:
santorac
2021-11-17 12:15:57 -08:00
249 changed files with 3564 additions and 2053 deletions
@@ -132,6 +132,13 @@ namespace AZ
//! Sets the Esm exponent. Higher values produce a steeper falloff between light and shadow.
virtual void SetEsmExponent(float exponent) = 0;
//! Reduces acne by biasing the shadowmap lookup along the geometric normal.
//! @return Returns the amount of bias to apply.
virtual float GetNormalShadowBias() const = 0;
//! 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;
};
//! The EBus for requests to for setting and getting light component properties.
@@ -57,6 +57,7 @@ namespace AZ
// Shadows (only used for supported shapes)
bool m_enableShadow = false;
float m_bias = 0.1f;
float m_normalShadowBias = 0.0f;
ShadowmapSize m_shadowmapMaxSize = ShadowmapSize::Size256;
ShadowFilterMethod m_shadowFilterMethod = ShadowFilterMethod::None;
uint16_t m_filteringSampleCount = 12;
@@ -34,6 +34,7 @@ namespace AZ
// Shadows
->Field("Enable Shadow", &AreaLightComponentConfig::m_enableShadow)
->Field("Shadow Bias", &AreaLightComponentConfig::m_bias)
->Field("Normal Shadow Bias", &AreaLightComponentConfig::m_normalShadowBias)
->Field("Shadowmap Max Size", &AreaLightComponentConfig::m_shadowmapMaxSize)
->Field("Shadow Filter Method", &AreaLightComponentConfig::m_shadowFilterMethod)
->Field("Filtering Sample Count", &AreaLightComponentConfig::m_filteringSampleCount)
@@ -70,6 +70,8 @@ namespace AZ::Render
->Event("SetEnableShadow", &AreaLightRequestBus::Events::SetEnableShadow)
->Event("GetShadowBias", &AreaLightRequestBus::Events::GetShadowBias)
->Event("SetShadowBias", &AreaLightRequestBus::Events::SetShadowBias)
->Event("GetNormalShadowBias", &AreaLightRequestBus::Events::GetNormalShadowBias)
->Event("SetNormalShadowBias", &AreaLightRequestBus::Events::SetNormalShadowBias)
->Event("GetShadowmapMaxSize", &AreaLightRequestBus::Events::GetShadowmapMaxSize)
->Event("SetShadowmapMaxSize", &AreaLightRequestBus::Events::SetShadowmapMaxSize)
->Event("GetShadowFilterMethod", &AreaLightRequestBus::Events::GetShadowFilterMethod)
@@ -91,6 +93,7 @@ namespace AZ::Render
->VirtualProperty("ShadowsEnabled", "GetEnableShadow", "SetEnableShadow")
->VirtualProperty("ShadowBias", "GetShadowBias", "SetShadowBias")
->VirtualProperty("NormalShadowBias", "GetNormalShadowBias", "SetNormalShadowBias")
->VirtualProperty("ShadowmapMaxSize", "GetShadowmapMaxSize", "SetShadowmapMaxSize")
->VirtualProperty("ShadowFilterMethod", "GetShadowFilterMethod", "SetShadowFilterMethod")
->VirtualProperty("FilteringSampleCount", "GetFilteringSampleCount", "SetFilteringSampleCount")
@@ -302,6 +305,7 @@ namespace AZ::Render
if (m_configuration.m_enableShadow)
{
m_lightShapeDelegate->SetShadowBias(m_configuration.m_bias);
m_lightShapeDelegate->SetNormalShadowBias(m_configuration.m_normalShadowBias);
m_lightShapeDelegate->SetShadowmapMaxSize(m_configuration.m_shadowmapMaxSize);
m_lightShapeDelegate->SetShadowFilterMethod(m_configuration.m_shadowFilterMethod);
m_lightShapeDelegate->SetFilteringSampleCount(m_configuration.m_filteringSampleCount);
@@ -474,6 +478,20 @@ namespace AZ::Render
}
}
void AreaLightComponentController::SetNormalShadowBias(float bias)
{
m_configuration.m_normalShadowBias = bias;
if (m_lightShapeDelegate)
{
m_lightShapeDelegate->SetNormalShadowBias(bias);
}
}
float AreaLightComponentController::GetNormalShadowBias() const
{
return m_configuration.m_normalShadowBias;
}
ShadowmapSize AreaLightComponentController::GetShadowmapMaxSize() const
{
return m_configuration.m_shadowmapMaxSize;
@@ -86,6 +86,8 @@ namespace AZ
void SetFilteringSampleCount(uint32_t count) override;
float GetEsmExponent() const override;
void SetEsmExponent(float exponent) override;
float GetNormalShadowBias() const override;
void SetNormalShadowBias(float bias) override;
void HandleDisplayEntityViewport(
const AzFramework::ViewportInfo& viewportInfo,
@@ -138,6 +138,14 @@ namespace AZ::Render
}
}
void DiskLightDelegate::SetNormalShadowBias(float bias)
{
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetNormalShadowBias(GetLightHandle(), bias);
}
}
void DiskLightDelegate::SetShadowmapMaxSize(ShadowmapSize size)
{
if (GetShadowsEnabled() && GetLightHandle().IsValid())
@@ -46,6 +46,7 @@ namespace AZ
void SetShadowFilterMethod(ShadowFilterMethod method) override;
void SetFilteringSampleCount(uint32_t count) override;
void SetEsmExponent(float exponent) override;
void SetNormalShadowBias(float bias) override;
private:
@@ -136,7 +136,7 @@ namespace AZ
->Attribute(Edit::Attributes::Min, 0.0f)
->Attribute(Edit::Attributes::Max, 100.0f)
->Attribute(Edit::Attributes::SoftMin, 0.0f)
->Attribute(Edit::Attributes::SoftMax, 2.0f)
->Attribute(Edit::Attributes::SoftMax, 10.0f)
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::Visibility, &AreaLightComponentConfig::SupportsShadows)
->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::ShadowsDisabled)
@@ -171,7 +171,16 @@ namespace AZ
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::Visibility, &AreaLightComponentConfig::SupportsShadows)
->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::IsEsmDisabled)
;
->DataElement(
Edit::UIHandlers::Slider, &AreaLightComponentConfig::m_normalShadowBias, "Normal Shadow Bias\n",
"Reduces acne by biasing the shadowmap lookup along the geometric normal.\n"
"If this is 0, no biasing is applied.")
->Attribute(Edit::Attributes::Min, 0.f)
->Attribute(Edit::Attributes::Max, 10.0f)
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
->Attribute(Edit::Attributes::Visibility, &AreaLightComponentConfig::SupportsShadows)
->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::ShadowsDisabled)
;
}
}
@@ -58,7 +58,8 @@ namespace AZ
void SetShadowFilterMethod([[maybe_unused]] ShadowFilterMethod method) override {};
void SetFilteringSampleCount([[maybe_unused]] uint32_t count) override {};
void SetEsmExponent([[maybe_unused]] float esmExponent) override{};
void SetNormalShadowBias([[maybe_unused]] float bias) override{};
protected:
void InitBase(EntityId entityId);
@@ -79,6 +79,8 @@ namespace AZ
virtual void SetFilteringSampleCount(uint32_t count) = 0;
//! Sets the Esm exponent to use. Higher values produce a steeper falloff between light and shadow.
virtual void SetEsmExponent(float exponent) = 0;
//! Sets the normal bias. Reduces acne by biasing the shadowmap lookup along the geometric normal.
virtual void SetNormalShadowBias(float bias) = 0;
};
} // namespace Render
} // namespace AZ
@@ -107,4 +107,13 @@ namespace AZ::Render
GetFeatureProcessor()->SetEsmExponent(GetLightHandle(), esmExponent);
}
}
void SphereLightDelegate::SetNormalShadowBias(float bias)
{
if (GetShadowsEnabled() && GetLightHandle().IsValid())
{
GetFeatureProcessor()->SetNormalShadowBias(GetLightHandle(), bias);
}
}
} // namespace AZ::Render
@@ -36,6 +36,7 @@ namespace AZ
void SetShadowFilterMethod(ShadowFilterMethod method) override;
void SetFilteringSampleCount(uint32_t count) override;
void SetEsmExponent(float esmExponent) override;
void SetNormalShadowBias(float bias) override;
private: