Merge remote-tracking branch 'upstream/stabilization/2106' into nvsickle/MergeStabilizationJun18
This commit is contained in:
+13
-13
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
#include <AtomLyIntegration/CommonFeatures/CoreLights/AreaLightComponentConfig.h>
|
||||
#include <AzCore/std/limits.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
@@ -21,7 +22,7 @@ namespace AZ
|
||||
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<AreaLightComponentConfig, ComponentConfig>()
|
||||
->Version(5) // ATOM-14637
|
||||
->Version(6) // ATOM-15654
|
||||
->Field("LightType", &AreaLightComponentConfig::m_lightType)
|
||||
->Field("Color", &AreaLightComponentConfig::m_color)
|
||||
->Field("IntensityMode", &AreaLightComponentConfig::m_intensityMode)
|
||||
@@ -41,7 +42,8 @@ namespace AZ
|
||||
->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("Pcf Method", &AreaLightComponentConfig::m_pcfMethod)
|
||||
->Field("Esm Exponent", &AreaLightComponentConfig::m_esmExponent)
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -134,23 +136,15 @@ namespace AZ
|
||||
case PhotometricUnit::Nit:
|
||||
return 0.0f;
|
||||
case PhotometricUnit::Ev100Luminance:
|
||||
return -10.0f;
|
||||
return AZStd::numeric_limits<float>::lowest();
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float AreaLightComponentConfig::GetIntensityMax() const
|
||||
{
|
||||
switch (m_intensityMode)
|
||||
{
|
||||
case PhotometricUnit::Candela:
|
||||
case PhotometricUnit::Lumen:
|
||||
case PhotometricUnit::Nit:
|
||||
return 1'000'000.0f;
|
||||
case PhotometricUnit::Ev100Luminance:
|
||||
return 20.0f;
|
||||
}
|
||||
return 0.0f;
|
||||
// While there is no hard-max, a max must be included when there is a hard min.
|
||||
return AZStd::numeric_limits<float>::max();
|
||||
}
|
||||
|
||||
float AreaLightComponentConfig::GetIntensitySoftMin() const
|
||||
@@ -200,5 +194,11 @@ namespace AZ
|
||||
|
||||
return m_pcfMethod != PcfMethod::BoundarySearch;
|
||||
}
|
||||
|
||||
bool AreaLightComponentConfig::IsEsmDisabled() const
|
||||
{
|
||||
return !(m_shadowFilterMethod == ShadowFilterMethod::Esm || m_shadowFilterMethod == ShadowFilterMethod::EsmPcf);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+21
-3
@@ -84,7 +84,9 @@ namespace AZ::Render
|
||||
->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)
|
||||
|
||||
->VirtualProperty("AttenuationRadius", "GetAttenuationRadius", "SetAttenuationRadius")
|
||||
->VirtualProperty("Color", "GetColor", "SetColor")
|
||||
->VirtualProperty("EmitsLightBothDirections", "GetEmitsLightBothDirections", "SetEmitsLightBothDirections")
|
||||
@@ -101,8 +103,9 @@ namespace AZ::Render
|
||||
->VirtualProperty("SofteningBoundaryWidthAngle", "GetSofteningBoundaryWidthAngle", "SetSofteningBoundaryWidthAngle")
|
||||
->VirtualProperty("PredictionSampleCount", "GetPredictionSampleCount", "SetPredictionSampleCount")
|
||||
->VirtualProperty("FilteringSampleCount", "GetFilteringSampleCount", "SetFilteringSampleCount")
|
||||
->VirtualProperty("PcfMethod", "GetPcfMethod", "SetPcfMethod");
|
||||
;
|
||||
->VirtualProperty("PcfMethod", "GetPcfMethod", "SetPcfMethod")
|
||||
->VirtualProperty("EsmExponent", "GetEsmExponent", "SetEsmExponent");
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,6 +317,7 @@ namespace AZ::Render
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -565,6 +569,20 @@ namespace AZ::Render
|
||||
}
|
||||
}
|
||||
|
||||
float AreaLightComponentController::GetEsmExponent() const
|
||||
{
|
||||
return m_configuration.m_esmExponent;
|
||||
}
|
||||
|
||||
void AreaLightComponentController::SetEsmExponent(float esmExponent)
|
||||
{
|
||||
m_configuration.m_esmExponent = esmExponent;
|
||||
if (m_lightShapeDelegate)
|
||||
{
|
||||
m_lightShapeDelegate->SetEsmExponent(esmExponent);
|
||||
}
|
||||
}
|
||||
|
||||
void AreaLightComponentController::CreateLightShapeDelegate()
|
||||
{
|
||||
switch (m_configuration.m_lightType)
|
||||
|
||||
+2
@@ -92,6 +92,8 @@ namespace AZ
|
||||
void SetFilteringSampleCount(uint32_t count) override;
|
||||
PcfMethod GetPcfMethod() const override;
|
||||
void SetPcfMethod(PcfMethod method) override;
|
||||
float GetEsmExponent() const override;
|
||||
void SetEsmExponent(float exponent) override;
|
||||
|
||||
void HandleDisplayEntityViewport(
|
||||
const AzFramework::ViewportInfo& viewportInfo,
|
||||
|
||||
@@ -175,5 +175,13 @@ namespace AZ::Render
|
||||
}
|
||||
}
|
||||
|
||||
void DiskLightDelegate::SetEsmExponent(float exponent)
|
||||
{
|
||||
if (GetShadowsEnabled() && GetLightHandle().IsValid())
|
||||
{
|
||||
GetFeatureProcessor()->SetEsmExponent(GetLightHandle(), exponent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace AZ::Render
|
||||
|
||||
@@ -51,6 +51,7 @@ namespace AZ
|
||||
void SetPredictionSampleCount(uint32_t count) override;
|
||||
void SetFilteringSampleCount(uint32_t count) override;
|
||||
void SetPcfMethod(PcfMethod method) override;
|
||||
void SetEsmExponent(float exponent) override;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
+13
-2
@@ -179,8 +179,19 @@ namespace AZ
|
||||
->EnumAttribute(PcfMethod::BoundarySearch, "Boundary search")
|
||||
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
|
||||
->Attribute(Edit::Attributes::Visibility, &AreaLightComponentConfig::SupportsShadows)
|
||||
->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::IsShadowPcfDisabled);
|
||||
;
|
||||
->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::IsShadowPcfDisabled)
|
||||
->DataElement(
|
||||
Edit::UIHandlers::Slider, &AreaLightComponentConfig::m_esmExponent, "Esm Exponent",
|
||||
"Exponent used by Esm shadows. "
|
||||
"Larger values increase the sharpness of the border between lit and unlit areas.")
|
||||
->Attribute(Edit::Attributes::Min, 50.0f)
|
||||
->Attribute(Edit::Attributes::Max, 5000.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Decimals, 0)
|
||||
->Attribute(AZ::Edit::Attributes::SliderCurveMidpoint, 0.05f)
|
||||
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
|
||||
->Attribute(Edit::Attributes::Visibility, &AreaLightComponentConfig::SupportsShadows)
|
||||
->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::IsEsmDisabled)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace AZ
|
||||
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:
|
||||
void InitBase(EntityId entityId);
|
||||
|
||||
@@ -85,6 +85,8 @@ namespace AZ
|
||||
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;
|
||||
};
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
|
||||
@@ -122,5 +122,14 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
void SphereLightDelegate::SetEsmExponent(float esmExponent)
|
||||
{
|
||||
if (GetShadowsEnabled() && GetLightHandle().IsValid())
|
||||
{
|
||||
GetFeatureProcessor()->SetEsmExponent(GetLightHandle(), esmExponent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace Render
|
||||
} // namespace AZ
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace AZ
|
||||
void SetPredictionSampleCount(uint32_t count) override;
|
||||
void SetFilteringSampleCount(uint32_t count) override;
|
||||
void SetPcfMethod(PcfMethod method) override;
|
||||
void SetEsmExponent(float esmExponent) override;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
+4
-1
@@ -32,7 +32,7 @@ namespace AZ
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
const char* EditorMaterialComponent::GenerateMaterialsButtonText = "Generate Source Materials...";
|
||||
const char* EditorMaterialComponent::GenerateMaterialsButtonText = "Generate/Manage Source Materials...";
|
||||
const char* EditorMaterialComponent::GenerateMaterialsToolTipText = "Generate editable source material files from materials provided by the model.";
|
||||
|
||||
const char* EditorMaterialComponent::ResetMaterialsButtonText = "Reset Materials";
|
||||
@@ -228,10 +228,13 @@ namespace AZ
|
||||
action = menu->addAction(GenerateMaterialsButtonText, [this]() { OpenMaterialExporter(); });
|
||||
action->setToolTip(GenerateMaterialsToolTipText);
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
action = menu->addAction(ResetMaterialsButtonText, [this]() { ResetMaterialSlots(); });
|
||||
action->setToolTip(ResetMaterialsToolTipText);
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
action = menu->addAction("Clear Model Materials", [this]() {
|
||||
AzToolsFramework::ScopedUndoBatch undoBatch("Clearing model materials.");
|
||||
SetDirty();
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ namespace AZ
|
||||
|
||||
// Constructing a dialog with a table to display all configurable material export items
|
||||
QDialog dialog(activeWindow);
|
||||
dialog.setWindowTitle("Generate Source Materials");
|
||||
dialog.setWindowTitle("Generate/Manage Source Materials");
|
||||
|
||||
const QStringList headerLabels = { "Material Slot", "Material Filename", "Overwrite" };
|
||||
const int MaterialSlotColumn = 0;
|
||||
|
||||
+8
-16
@@ -273,32 +273,24 @@ namespace AZ
|
||||
|
||||
QAction* action = nullptr;
|
||||
|
||||
action = menu.addAction("Open Material Editor...", [this]() { EditorMaterialSystemComponentRequestBus::Broadcast(&EditorMaterialSystemComponentRequestBus::Events::OpenInMaterialEditor, ""); });
|
||||
action->setVisible(!m_materialAsset.GetId().IsValid());
|
||||
|
||||
action = menu.addAction("Clear", [this]() { Clear(); });
|
||||
action->setEnabled(m_materialAsset.GetId().IsValid() || !m_propertyOverrides.empty() || !m_matModUvOverrides.empty());
|
||||
|
||||
action = menu.addAction("Set Default Asset", [this]() { SetDefaultAsset(); });
|
||||
action = menu.addAction("Generate/Manage Source Material...", [this]() { OpenMaterialExporter(); });
|
||||
action->setEnabled(m_id.m_materialAssetId.IsValid());
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
action = menu.addAction("Generate Source Material...", [this]() { OpenMaterialExporter(); });
|
||||
action->setEnabled(m_id.m_materialAssetId.IsValid());
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
const auto instanceAssetId = m_materialAsset.GetId().IsValid() ? m_materialAsset.GetId() : m_id.m_materialAssetId;
|
||||
action = menu.addAction("Edit Source Material...", [this]() { OpenMaterialEditor(); });
|
||||
action->setEnabled(HasSourceData());
|
||||
|
||||
action = menu.addAction("Edit Material Instance...", [this]() { OpenMaterialInspector(); });
|
||||
action->setEnabled(m_materialAsset.GetId().IsValid());
|
||||
|
||||
action = menu.addAction("Edit Material Model UV Map...", [this]() { OpenUvNameMapInspector(); });
|
||||
action = menu.addAction("Edit Material Instance UV Map...", [this]() { OpenUvNameMapInspector(); });
|
||||
action->setEnabled(m_materialAsset.GetId().IsValid());
|
||||
|
||||
action = menu.addAction("Edit Material in Material Editor...", [this]() { OpenMaterialEditor(); });
|
||||
action->setEnabled(HasSourceData());
|
||||
menu.addSeparator();
|
||||
|
||||
action = menu.addAction("Clear Material Instance Overrides", [this]() { m_propertyOverrides = {}; m_matModUvOverrides = {}; });
|
||||
action->setEnabled(!m_propertyOverrides.empty() || !m_matModUvOverrides.empty());
|
||||
|
||||
menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user