Changed the clearcloat enable Lua functor to set the forwardPassIBL shader option.

Changed MeshFeatureProcessor to look for this shader option to determine if the material requires forward pass IBL specular.
This commit is contained in:
dmcdiar
2021-04-20 03:28:42 -07:00
parent f2a757f21e
commit a4acfc8261
2 changed files with 19 additions and 3 deletions
@@ -26,4 +26,5 @@ end
function Process(context)
local enable = context:GetMaterialPropertyValue_bool("clearCoat.enable")
context:SetShaderOptionValue_bool("o_clearCoat_feature_enabled", enable)
context:SetShaderOptionValue_bool("o_materialUseForwardPassIBLSpecular", enable)
end
@@ -966,10 +966,25 @@ namespace AZ
bool MeshDataInstance::MaterialRequiresForwardPassIblSpecular(Data::Instance<RPI::Material> material) const
{
RPI::MaterialPropertyIndex propertyIndex = material->FindPropertyIndex(AZ::Name("general.forwardPassIBLSpecular"));
if (propertyIndex.IsValid())
// look for a shader that has the o_materialUseForwardPassIBLSpecular option set
// Note: this should be changed to have the material automatically set the forwardPassIBLSpecular
// property and look for that instead of the shader option.
// [GFX TODO][ATOM-5040] Address Property Metadata Feedback Loop
for (auto& shaderItem : material->GetShaderCollection())
{
return material->GetPropertyValue<bool>(propertyIndex);
if (shaderItem.IsEnabled())
{
RPI::ShaderOptionIndex index = shaderItem.GetShaderOptionGroup().GetShaderOptionLayout()->FindShaderOptionIndex(Name{ "o_materialUseForwardPassIBLSpecular" });
if (index.IsValid())
{
RPI::ShaderOptionValue value = shaderItem.GetShaderOptionGroup().GetValue(Name{ "o_materialUseForwardPassIBLSpecular" });
if (value.GetIndex() != 0)
{
return true;
}
}
}
}
return false;