diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ClearCoatEnableFeature.lua b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ClearCoatEnableFeature.lua index c132e3d927..1c520c6274 100644 --- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ClearCoatEnableFeature.lua +++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ClearCoatEnableFeature.lua @@ -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 diff --git a/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp index f0dbaa2928..fba970713b 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Mesh/MeshFeatureProcessor.cpp @@ -966,10 +966,25 @@ namespace AZ bool MeshDataInstance::MaterialRequiresForwardPassIblSpecular(Data::Instance 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(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;