Developer Notes

This issue has been closed as 'Won't Fix' due to an extended period of time without updates. If this issue is important to you please let us know by posting on the AnswerHub or UDN, and Epic will re-open the ticket for further review.

Description

When you have a Material with a static parameter and an Instance of that Material that has the "override" checkbox checked for that static parameter, but has the value set to the same value as the parent Material, even though the resulting shader code will be the same for the Material and it's Instance, during cooking a copy of the shader is created for the Material Instance, wasting space and memory.

Steps to Reproduce
  1. Create a material that has a Static Bool in it
  2. Create a material instance for that material
  3. Check the override box for the Static Bool, but set the value to the same value as the parent material
  4. Use that material on something in the current editor level, and save the level
  5. Press the "Launch" button to launch on windows (or mac)
  6. Go to the project's Saved/Cooked folder, and find the .uasset files that correspond to the Material and Material Instance
  7. Note that the size of the Material Instance .uasset file is probably several 100s of KB, when it could be just a few KB to point to the Material .uasset that has identical shader code

The same thing can happen when checking the Blend Mode override checkbox in the material property overrides of the material instance, but then setting the blend mode to the same as the parent (for example overriding a masked blend mode material and setting the instance to be masked as well). In this case, the cooked material instance is not only duplicating code, but is actually somehow larger that the parent material, even though it should be an identical shader.

Have Comments or More Details?

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

1
Login to Vote

Duplicate
ComponentUE - Graphics Features
Affects Versions4.8.34.9
Target Fix4.18
CreatedSep 9, 2015
ResolvedSep 6, 2017
UpdatedJun 23, 2018
View Jira Issue