Result:
Material will generate following HLSL code inside CalcPixelMaterialInputs(), which results in two PS texture lookups.
MaterialFloat4 Local0 = ProcessMaterialLinearColorTextureLookup(Texture2DSampleBias(Material.Texture2D_0,Material.Texture2D_0Sampler,Parameters.TexCoords[0].xy,View.MaterialTextureMipBias));
MaterialFloat4 Local1 = ProcessMaterialLinearColorTextureLookup(Texture2DSampleBias(Material.Texture2D_0,Material.Texture2D_0Sampler,Parameters.TexCoords[0].xy,View.MaterialTextureMipBias));
Expected:
Local0 and Local1 are exactly the same. The identical texture sampling code should be merged.
Note:
This only happens if we use MaterialAttribute as inputs and wrapped it inside Material Function. Doesn't happen if we use MakeMaterialAttribute in a material directly.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-79425 in the post.
9 |
Component | UE - Graphics Features |
---|---|
Affects Versions | 4.23 |
Created | Aug 27, 2019 |
---|---|
Updated | Dec 2, 2022 |