Description

It would seem that updating a material does not update the associated platform stats in a material instance editor, only the parameters.

Can workaround by manually invoking shader compile in the material instance editor.

It is expected that the material instance stats updates when the base material is changed.

I made a local testing change in MaterialInstanceEditor.cpp, in void FMaterialInstanceEditor::RebuildMaterialInstanceEditor() that adds NotifyExternalMaterialChange() to the function, which triggers instance compilation when base material is changed. While this does address this specific repro, I'm not sure this entirely the best possible fix for this solution, since I'm not very familiar with this area of engine code.

Would someone be able to suggest a better fix?

void FMaterialInstanceEditor::RebuildMaterialInstanceEditor() 
{ 
    if( MaterialEditorInstance ) 
    { 
        ReInitMaterialFunctionProxies(); 
        MaterialEditorInstance->CopyBasePropertiesFromParent(); 
        MaterialEditorInstance->RegenerateArrays(); 
        RebuildInheritanceList(); // Required b/c recompiled parent materials result in invalid weak object pointers 
        UpdatePropertyWindow(); 
        NotifyExternalMaterialChange(); // Add this line here     
    }
}
Steps to Reproduce

Steps to Reproduce

1. In 5.4 editor, make a material with some test nodes eg. VectorNoise gated behind a static switch.
2. Use Window --> Platform Stats to show stats such as instruction count
3. Make a material instance of the material and open it in editor. Open Window --> Platform Stats as well in the instance editor.
4. Note flipping the static switch in the instance DOES update Platform Stats in the instance editor, since it triggers shader recompilation
5. Twiddle the original base material's bp graph, Save or Apply.
6. Note the material's Platform Stats updates, since shader compilation in the base material is triggered
7. Note the material instance's Platform Stats does NOT update since it does not trigger compilation in the instance PreviewMaterial.
8. Flipping the static switch in the instance editor does now update the platform stats since

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-231474 in the post.

0
Login to Vote

Unresolved
ComponentUE - Rendering Architecture - Materials
Affects Versions5.4
Target Fix5.6
CreatedNov 26, 2024
UpdatedNov 27, 2024
View Jira Issue