# Incorrect material instructions count

**URL:** <https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421>\
**Category:** Rendering\
**Tags:** unreal-engine, question\
**Created:** [March 9, 2017, 2:09pm UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421 "2017-03-09T14:09:26Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Illarvan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Illarvan](https://forums.unrealengine.com/u/Illarvan)\
**Post date:** [March 9, 2017, 2:09pm UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421/1 "2017-03-09T14:09:26Z")

</div>

![129283-texcount.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/4/2/b4248ef6572cc440c5ff4372582e349fddbea663.png)

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6e7b421a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6e7b421a](https://forums.unrealengine.com/u/anonymous_user_6e7b421a)\
**Post date:** [March 9, 2017, 8:29pm UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421/2 "2017-03-09T20:29:02Z")

</div>

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](https://issues.unrealengine.com/issue/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,

---

<div class="post-metadata">

**Author:** ![Illarvan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Illarvan](https://forums.unrealengine.com/u/Illarvan)\
**Post date:** [March 9, 2017, 8:38pm UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421/3 "2017-03-09T20:38:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Fairlightish](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fairlightish](https://forums.unrealengine.com/u/Fairlightish)\
**Post date:** [July 8, 2017, 12:53am UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421/4 "2017-07-08T00:53:14Z")

</div>

Same. Any update?

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/1/c/b1c966506a9a193b1af2c7b5f71393f62c7a6ec9.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6e7b421a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6e7b421a](https://forums.unrealengine.com/u/anonymous_user_6e7b421a)\
**Post date:** [July 10, 2017, 1:55pm UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421/5 "2017-07-10T13:55:07Z")

</div>

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

Thank you,

H.

---

<div class="post-metadata">

**Author:** ![toolpaddz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@toolpaddz](https://forums.unrealengine.com/u/toolpaddz)\
**Post date:** [May 21, 2019, 10:32am UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421/6 "2019-05-21T10:32:41Z")

</div>

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.

 ![277506-screenshot-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/9/c/89ce624f09a72b8ef5b94e3d4ad18a4da887b742.jpeg)

---

<div class="post-metadata">

**Author:** ![Zarsky](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Zarsky](https://forums.unrealengine.com/u/Zarsky)\
**Post date:** [May 6, 2021, 2:27pm UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421/7 "2021-05-06T14:27:14Z")

</div>

Still present in 4.25.4.

Is there a reason why it is not fixed yet?

---

<div class="post-metadata">

**Author:** ![Strom](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Strom](https://forums.unrealengine.com/u/Strom)\
**Post date:** [May 6, 2021, 5:35pm UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421/8 "2021-05-06T17:35:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kurylo3d](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kurylo3d/32/1150889_2.png) [@kurylo3d](https://forums.unrealengine.com/u/kurylo3d)\
**Post date:** [January 20, 2023, 12:09am UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421/9 "2023-01-20T00:09:56Z")

</div>

Im having this issue with unreal engine 5.1…

---

<div class="post-metadata">

**Author:** ![Arkiras](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arkiras/32/1008648_2.png) [@Arkiras](https://forums.unrealengine.com/u/Arkiras)\
**Post date:** [January 20, 2023, 3:24am UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421/10 "2023-01-20T03:24:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kurylo3d](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kurylo3d/32/1150889_2.png) [@kurylo3d](https://forums.unrealengine.com/u/kurylo3d)\
**Post date:** [January 20, 2023, 6:38am UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421/11 "2023-01-20T06:38:09Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Arkiras](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arkiras/32/1008648_2.png) [@Arkiras](https://forums.unrealengine.com/u/Arkiras)\
**Post date:** [January 20, 2023, 6:57pm UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421/12 "2023-01-20T18:57:11Z")

</div>

Yes that’s normal.

---

<div class="post-metadata">

**Author:** ![kurylo3d](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kurylo3d/32/1150889_2.png) [@kurylo3d](https://forums.unrealengine.com/u/kurylo3d)\
**Post date:** [January 20, 2023, 7:02pm UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421/13 "2023-01-20T19:02:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Arkiras](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arkiras/32/1008648_2.png) [@Arkiras](https://forums.unrealengine.com/u/Arkiras)\
**Post date:** [January 20, 2023, 7:07pm UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421/14 "2023-01-20T19:07:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kurylo3d](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kurylo3d/32/1150889_2.png) [@kurylo3d](https://forums.unrealengine.com/u/kurylo3d)\
**Post date:** [January 20, 2023, 7:52pm UTC](https://forums.unrealengine.com/t/incorrect-material-instructions-count/387421/15 "2023-01-20T19:52:53Z")

</div>

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.
