# Material compile error \[SM5\]

**URL:** <https://forums.unrealengine.com/t/material-compile-error-sm5/359623>\
**Category:** Rendering\
**Tags:** unreal-engine, question\
**Created:** [June 4, 2016, 4:36pm UTC](https://forums.unrealengine.com/t/material-compile-error-sm5/359623 "2016-06-04T16:36:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_e89aeeac](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e89aeeac](https://forums.unrealengine.com/u/anonymous_user_e89aeeac)\
**Post date:** [June 4, 2016, 4:36pm UTC](https://forums.unrealengine.com/t/material-compile-error-sm5/359623/1 "2016-06-04T16:36:58Z")

</div>

Hello!

In UE 4.12 I have two errors when I try to compile material like in picture.

Error [SM5] Material.usf(1564,118): error X3004: undeclared identifier ‘Local0’

Error [SM5] Material.usf(1564,53): error X3013: ‘Texture2DSample’: function does not take 3 parameters

 ![93325-test.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/6/7/967fa42062a53b8f991e7e15435900de17f385e8.png)

To work around the problem you must remove TexCoord node or add TexCoord node for each texture

 ![93326-workaround-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/9/9/299a9dfcc8df03e106d57033f805bbab1fab411a.png)

or make LERP alpha value not zero

 ![93327-workaround-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/4/3/343a7e91873324bef085ec2a085ba0fc23c5da58.png)

or convert LERP alpha constant to parameter.

 ![93328-workaround-3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/3/c/d3cf1c12746877f8ac37529f58d6382495d91325.png)

Sorry for my bad english.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e89aeeac](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e89aeeac](https://forums.unrealengine.com/u/anonymous_user_e89aeeac)\
**Post date:** [June 4, 2016, 4:53pm UTC](https://forums.unrealengine.com/t/material-compile-error-sm5/359623/2 "2016-06-04T16:53:44Z")

</div>

Connecting directly to the normal vector also fixes the problem.

 ![93331-workaround-4.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/2/d/d2d025df2c4fdfd245dc4bcf582e6fc4a6154501.png)

---

<div class="post-metadata">

**Author:** ![Luos](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/luos/32/918700_2.png) [@Luos](https://forums.unrealengine.com/u/Luos)\
**Post date:** [June 5, 2016, 4:51am UTC](https://forums.unrealengine.com/t/material-compile-error-sm5/359623/3 "2016-06-05T04:51:03Z")

</div>

Instead of flattening the normal like that, try the " Flatten normal" node available 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e89aeeac](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e89aeeac](https://forums.unrealengine.com/u/anonymous_user_e89aeeac)\
**Post date:** [June 5, 2016, 1:03pm UTC](https://forums.unrealengine.com/t/material-compile-error-sm5/359623/4 "2016-06-05T13:03:51Z")

</div>

With FlattenNormal I also have a problem but when Flatness = 1 (FlattenNormal is LERP with blue color and nothing more):

 ![93442-error.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/f/1/2f1c44d41972af8f1ee816e18868758a45ed9785.png)

This is only a demonstration to reproduce the error.

In a real project I have a shader where this error occurs as a consequence of the optimization calculations for certain values of the input data (like landscape layer weights).

---

<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:** [June 6, 2016, 8:06pm UTC](https://forums.unrealengine.com/t/material-compile-error-sm5/359623/5 "2016-06-06T20:06:29Z")

</div>

Try placing a single Texture Coordinate for each of the Texture samples.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e89aeeac](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e89aeeac](https://forums.unrealengine.com/u/anonymous_user_e89aeeac)\
**Post date:** [June 6, 2016, 8:16pm UTC](https://forums.unrealengine.com/t/material-compile-error-sm5/359623/6 "2016-06-06T20:16:58Z")

</div>

Yes, this is one of the workarounds. I wrote about this in my question.

---

<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:** [June 8, 2016, 9:08pm UTC](https://forums.unrealengine.com/t/material-compile-error-sm5/359623/7 "2016-06-08T21:08:04Z")

</div>

Hey Igor,

I have gone ahead and entered a bug report for this issue, UE-31792. Once the issue has been addressed by our engineers it will be added to a our known issues for an upcoming full engine release or hotfix.

Let me know if you have further questions or need additional assistance.

Thank you,

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e89aeeac](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e89aeeac](https://forums.unrealengine.com/u/anonymous_user_e89aeeac)\
**Post date:** [June 8, 2016, 9:13pm UTC](https://forums.unrealengine.com/t/material-compile-error-sm5/359623/8 "2016-06-08T21:13:27Z")

</div>

Thank you!
