Incorrect material instructions count

I was trying to optimise some of my materials, when I noticed the count seemed wrong.
I created a new material with nothing inside and as you can see the instructions and sample count are both way off.

I created a new 4.15 project and it didn’t happen in there, so I was just wondering what caused it, and what can fix it?

Thanks in advance, Tom.

Hey Illarvan,

I was able to confirm what you are reporting and have gone ahead and entered a bug report for the issue. You can track the report following the link below on our public issues tracker.

UE-42738

Once the issue has been addressed by our engineers the ticket will be updated and reflected in the public tracker. Let me know if you have further questions or need additional assistance.

Cheers,

Hi Andrew, that’s great that it’s reproduce-able. However, at least in my instance, I have an incorrect count on every material even ones I’ve just created (like in the image I posted). Even restarting the editor doesn’t fix the count.

Same. Any update?

Please refer to the public bug tracker for any updates to the issue. The target fix is marked for 4.18.

Thank you,

H.

The bug has been marked as cannot reproduce. Why? You were able to repro it, Andrew, right?

I’m experiencing this if Forward Shading is enabled in the project settings. Creating a new material from scratch yields 608 pixel shader instructions and 134 vertex shader instructions in UE4.22.1.

Still present in 4.25.4.

Is there a reason why it is not fixed yet?

The numbers shown include the base shaders, a set of parameterized shaders created to allow advanced features in the rendering pipeline. If you show the HLSL code from a blank material, you will see the code.

Physically Based Rendering (PBR) can not be accomplished by simply plugging values into a simple rendering equation.

Metallic, for example, requires a texture sampler for the reflections and a matrix transform to calculate the reflection coordinate based on the pixel’s world position and normal.

The change in the numbers was probably a design decision to include the base shaders’ instruction counts in addition to the material’s counts to reflect a more accurate value.

Im having this issue with unreal engine 5.1…

Are you using the forward renderer? Because higher instruction counts are expected when using forward rendering.

no im not. in fact an empty material defaults to this…

Base pass shader : 211 instructions
Base pass vertex shader : 263 instructions
Texture samplers 2/16
Texture Lookups (Est.): VS(0), PS(3)
Shader Count : 4

Is this normal?

Yes that’s normal.

how come it doesnt change at all when i add things… like multiplying random color values…

It does change. Plugging in a constant multiplied by another constant won’t change anything because the engine does constant folding to simplify that to a single value, and the material already is using default values for everything, so the cost is exactly the same.

Convert the constants to parameters and the cost will go up.

There are times where i add material utilities i created which have like 50 nodes… and often it doesnt change either…

I dont know seems pretty random… things that look like they sh4ould be super expensive sometimes end up super cheap… other times things are way more expensive then i assumed they would be.