When a Material Instance is loaded that has a nullptr layer in StaticParametrs.Materiallayers. The Material Instance will create it's own CachedExpressionData but the ConnectedParameterMask will be 0 and Nanite material logic that calls functions like HasVertexPositionOffsetConnected will return false.
You can look for material instances with nullptr Material Layers by looking at materials in the [Link Removed] which can be opened from Asset Editor > Tools > Audit > Material Analyzer. If a nullptr Material Layer is found you will see the "None 000000000000000000" in the Material Layer Parameters column.
One workaround is to remove the nullptr material layers by adding code in UMaterialInstance::Serialize() and then load and re-save the affected materials.
Super::Serialize(Ar); #if WITH_EDITOR // Remove layers if only a nullptr layer is serialized if (Ar.IsLoading() && !StaticParametersRuntime.MaterialLayers.Layers.IsEmpty() && StaticParametersRuntime.MaterialLayers.Layers[0] == nullptr) { StaticParametersRuntime.MaterialLayers.Empty(); StaticParametersRuntime.bHasMaterialLayers = false; }
These repro steps are unconfirmed - the Material Instance test asset with the nullptr material layer was created in an older version of the engine so this is a guess of how it was created.
Expected
The unused material layer in the material instance doesn't cause the WPO and opacity mask to break. The material layer can be removed from the Material Instance.
Actual
The opacity mask and WPO will not work, and the opacity mask texture won't even be bound and the Material Layer cannot be removed in the Material Editor UI.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-229356 in the post.
0 |
Component | UE - Rendering Architecture - Materials |
---|---|
Affects Versions | 5.5, 5.4.4 |
Target Fix | 5.7 |
Created | Oct 31, 2024 |
---|---|
Updated | Nov 1, 2024 |