Merge branch 'development' into Atom/dmcdiar/ATOM-4126

This commit is contained in:
dmcdiar
2021-09-15 18:22:38 -07:00
1231 changed files with 51892 additions and 50685 deletions
@@ -75,7 +75,7 @@ namespace AZ
////////////////////////////////////////////////////////////////////////
// AttachmentComponentRequests
void Reattach(bool detachFirst);
void Reattach(bool detachFirst) override;
void Attach(AZ::EntityId targetId, const char* targetBoneName, const AZ::Transform& offset) override;
void Detach() override;
void SetAttachmentOffset(const AZ::Transform& offset) override;
@@ -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;
};
@@ -31,8 +31,7 @@ namespace AZ
float GetEffectiveSolidAngle() const override { return PhotometricValue::OmnidirectionalSteradians; }
private:
virtual void HandleShapeChanged();
void HandleShapeChanged() override;
};
} // namespace Render
@@ -34,7 +34,7 @@ namespace AZ
void SetShutterAngles(float innerAngleDegrees, float outerAngleDegrees) override;
private:
virtual void HandleShapeChanged();
void HandleShapeChanged() override;
};
} // namespace Render
@@ -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:
@@ -257,6 +257,16 @@ namespace AZ
&AzToolsFramework::ToolsApplicationEvents::InvalidatePropertyDisplay,
AzToolsFramework::Refresh_AttributesAndValues);
}
void EditorMaterialComponent::OnMaterialInstanceCreated(const MaterialAssignment& materialAssignment)
{
// PSO-impacting property changes are allowed in the editor
// because the saved slice data can be analyzed to pre-compile the necessary PSOs.
if (materialAssignment.m_materialInstance)
{
materialAssignment.m_materialInstance->SetPsoHandlingOverride(AZ::RPI::MaterialPropertyPsoHandling::Allowed);
}
}
void EditorMaterialComponent::UpdateConfiguration(const MaterialComponentConfig& config)
{
@@ -280,19 +290,19 @@ namespace AZ
{
continue;
}
MaterialAssignment& materialAssignment = config.m_materials[materialSlot->m_id];
// Only material slots with a valid asset IDs or property overrides will be copied
// to minimize the amount of data stored in the controller and game component
if (materialSlot->m_materialAsset.GetId().IsValid())
{
MaterialAssignment& materialAssignment = config.m_materials[materialSlot->m_id];
materialAssignment.m_materialAsset = materialSlot->m_materialAsset;
materialAssignment.m_propertyOverrides = materialSlot->m_propertyOverrides;
materialAssignment.m_matModUvOverrides = materialSlot->m_matModUvOverrides;
}
else if (!materialSlot->m_propertyOverrides.empty() || !materialSlot->m_matModUvOverrides.empty())
{
MaterialAssignment& materialAssignment = config.m_materials[materialSlot->m_id];
materialAssignment.m_materialAsset = materialSlot->m_defaultMaterialAsset;
materialAssignment.m_propertyOverrides = materialSlot->m_propertyOverrides;
materialAssignment.m_matModUvOverrides = materialSlot->m_matModUvOverrides;
@@ -51,6 +51,7 @@ namespace AZ
//! MaterialComponentNotificationBus::Handler overrides...
void OnMaterialsEdited(const MaterialAssignmentMap& materials) override;
void OnMaterialInstanceCreated(const MaterialAssignment& materialAssignment) override;
// Apply a material component configuration to the active controller
void UpdateConfiguration(const MaterialComponentConfig& config);
@@ -249,6 +249,7 @@ namespace AZ
for (auto& materialPair : m_configuration.m_materials)
{
materialPair.second.RebuildInstance();
MaterialComponentNotificationBus::Event(m_entityId, &MaterialComponentNotifications::OnMaterialInstanceCreated, materialPair.second);
QueuePropertyChanges(materialPair.first);
}
QueueMaterialUpdateNotification();
@@ -364,6 +365,7 @@ namespace AZ
{
materialAssignment.m_propertyOverrides[AZ::Name(propertyName)] = value;
materialAssignment.RebuildInstance();
MaterialComponentNotificationBus::Event(m_entityId, &MaterialComponentNotifications::OnMaterialInstanceCreated, materialAssignment);
QueueMaterialUpdateNotification();
}
else
@@ -561,6 +563,7 @@ namespace AZ
if (materialIt->second.m_propertyOverrides.empty())
{
materialIt->second.RebuildInstance();
MaterialComponentNotificationBus::Event(m_entityId, &MaterialComponentNotifications::OnMaterialInstanceCreated, materialIt->second);
QueueMaterialUpdateNotification();
}
@@ -581,6 +584,7 @@ namespace AZ
{
materialIt->second.m_propertyOverrides = {};
materialIt->second.RebuildInstance();
MaterialComponentNotificationBus::Event(m_entityId, &MaterialComponentNotifications::OnMaterialInstanceCreated, materialIt->second);
QueueMaterialUpdateNotification();
MaterialComponentNotificationBus::Event(m_entityId, &MaterialComponentNotifications::OnMaterialsEdited, m_configuration.m_materials);
}
@@ -595,6 +599,7 @@ namespace AZ
{
materialPair.second.m_propertyOverrides = {};
materialPair.second.RebuildInstance();
MaterialComponentNotificationBus::Event(m_entityId, &MaterialComponentNotifications::OnMaterialInstanceCreated, materialPair.second);
QueueMaterialUpdateNotification();
cleared = true;
}
@@ -30,9 +30,6 @@ namespace AZ
{
namespace Render
{
//! A configuration structure for the MeshComponentController
class MeshComponentConfig final
: public AZ::ComponentConfig
@@ -107,14 +104,14 @@ namespace AZ
void SetLodType(RPI::Cullable::LodType lodType) override;
RPI::Cullable::LodType GetLodType() const override;
virtual void SetLodOverride(RPI::Cullable::LodOverride lodOverride);
virtual RPI::Cullable::LodOverride GetLodOverride() const;
void SetLodOverride(RPI::Cullable::LodOverride lodOverride) override;
RPI::Cullable::LodOverride GetLodOverride() const override;
virtual void SetMinimumScreenCoverage(float minimumScreenCoverage);
virtual float GetMinimumScreenCoverage() const;
void SetMinimumScreenCoverage(float minimumScreenCoverage) override;
float GetMinimumScreenCoverage() const override;
virtual void SetQualityDecayRate(float qualityDecayRate);
virtual float GetQualityDecayRate() const;
void SetQualityDecayRate(float qualityDecayRate) override;
float GetQualityDecayRate() const override;
void SetVisibility(bool visible) override;
bool GetVisibility() const override;
@@ -130,7 +127,7 @@ namespace AZ
void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
// MaterialReceiverRequestBus::Handler overrides ...
virtual MaterialAssignmentId FindMaterialAssignmentId(
MaterialAssignmentId FindMaterialAssignmentId(
const MaterialAssignmentLodIndex lod, const AZStd::string& label) const override;
RPI::ModelMaterialSlotMap GetModelMaterialSlots() const override;
MaterialAssignmentMap GetMaterialAssignments() const override;
@@ -8,6 +8,7 @@
#include <PostProcess/RadiusWeightModifier/RadiusWeightModifierComponentController.h>
#include <AzCore/RTTI/BehaviorContext.h>
#include <AzCore/Serialization/SerializeContext.h>
namespace AZ
{
@@ -147,8 +147,6 @@ namespace SurfaceData
bool SurfaceDataMeshComponent::DoRayTrace(const AZ::Vector3& inPosition, AZ::Vector3& outPosition, AZ::Vector3& outNormal) const
{
AZ_PROFILE_FUNCTION(Entity);
AZStd::lock_guard<decltype(m_cacheMutex)> lock(m_cacheMutex);
// test AABB as first pass to claim the point
@@ -46,8 +46,6 @@ namespace AZ
RPI::ViewPtr m_view = nullptr;
Entity* m_modelEntity = nullptr;
double m_simulateTime = 0.0f;
float m_deltaTime = 0.0f;
int m_thumbnailSize = 512;
//! Incoming thumbnail requests are appended to this queue and processed one at a time in OnTick function.
@@ -81,11 +81,8 @@ namespace AZ
m_context->GetData()->m_view->SetCameraTransform(Matrix3x4::CreateFromTransform(cameraTransform));
}
void CaptureStep::OnTick(float deltaTime, ScriptTimePoint time)
void CaptureStep::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] ScriptTimePoint time)
{
m_context->GetData()->m_deltaTime = deltaTime;
m_context->GetData()->m_simulateTime = time.GetSeconds();
if (m_readyToCapture && m_ticksToCapture-- <= 0)
{
m_context->GetData()->m_renderPipeline->AddToRenderTickOnce();
@@ -72,34 +72,6 @@ namespace AZ
data->m_scene = RPI::Scene::CreateScene(sceneDesc);
// Setup scene srg modification callback (to push per-frame values to the shaders)
RPI::ShaderResourceGroupCallback callback = [data](RPI::ShaderResourceGroup* srg)
{
if (srg == nullptr)
{
return;
}
bool needCompile = false;
RHI::ShaderInputConstantIndex timeIndex = srg->FindShaderInputConstantIndex(Name{ "m_time" });
if (timeIndex.IsValid())
{
srg->SetConstant(timeIndex, aznumeric_cast<float>(data->m_simulateTime));
needCompile = true;
}
RHI::ShaderInputConstantIndex deltaTimeIndex = srg->FindShaderInputConstantIndex(Name{ "m_deltaTime" });
if (deltaTimeIndex.IsValid())
{
srg->SetConstant(deltaTimeIndex, data->m_deltaTime);
needCompile = true;
}
if (needCompile)
{
srg->Compile();
}
};
data->m_scene->SetShaderResourceGroupCallback(callback);
// Bind m_defaultScene to the GameEntityContext's AzFramework::Scene
auto* sceneSystem = AzFramework::SceneSystemInterface::Get();
AZ_Assert(sceneSystem, "Thumbnail system failed to get scene system implementation.");