# Procedural Mesh Component behaving weirdly when trying to apply material

**URL:** <https://forums.unrealengine.com/t/procedural-mesh-component-behaving-weirdly-when-trying-to-apply-material/385972>\
**Category:** Rendering\
**Tags:** vertices, procedural-mesh-comp, missing, unreal-engine, question\
**Created:** [February 23, 2017, 8:06pm UTC](https://forums.unrealengine.com/t/procedural-mesh-component-behaving-weirdly-when-trying-to-apply-material/385972 "2017-02-23T20:06:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MichaelEvans](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MichaelEvans](https://forums.unrealengine.com/u/MichaelEvans)\
**Post date:** [February 23, 2017, 8:06pm UTC](https://forums.unrealengine.com/t/procedural-mesh-component-behaving-weirdly-when-trying-to-apply-material/385972/1 "2017-02-23T20:06:28Z")

</div>

So basically I’m making procedural terrain using the procedural mesh component, and it works totally fine, until I apply different materials to it. Here’s the Issue. So basically I have a macro from a macro library which gets the material based on x,y,z position triangles. and when I just always return one material I get this

 ![127510-working.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/d/3/dd33d5b21feafa3af913000aae47ee109b5efa36.jpeg)

Then when I add any sort of actual selecting stuff, I’ve tried dozens of different things, all return similar results, then I get this.

 ![127521-notworking.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/1/5/6158eb8428570cb5236dd498955fe6aaa3e7cd51.jpeg)

So the triangles are actually not there, they’re not on the back side or invisible, even wireframe mode confirms this. I iterated through my various loops and everything checks out, all vertices are being correctly input into the arrays and all triangle/UV/Material data is correct, they just simply aren’t there and I have no idea why. Would appreciate any help.

Here’s some code

 ![127523-code1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/f/3/ff3addf535b6459573f260e50c26cf0812f6a6de.png)

 ![127524-code2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/7/0/2701b65bd6aa06b845a0534682ea491fea0b7af2.png)

 ![127525-code3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/4/f/e4fc111651b33d6e92a66df9c031ea550e51f07f.png)

---

<div class="post-metadata">

**Author:** ![MichaelEvans](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MichaelEvans](https://forums.unrealengine.com/u/MichaelEvans)\
**Post date:** [February 23, 2017, 8:29pm UTC](https://forums.unrealengine.com/t/procedural-mesh-component-behaving-weirdly-when-trying-to-apply-material/385972/2 "2017-02-23T20:29:23Z")

</div>

Well of course, after hours of trying to figure it out I post and within minutes I solve it myself…_sigh_  
How do I mark this as answered or remove it? I can’t seem to find that. Knowing my luck I’ll find it in about 30 seconds after posting this…Thanks anyway though!

---

<div class="post-metadata">

**Author:** ![Lutherbrian](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lutherbrian](https://forums.unrealengine.com/u/Lutherbrian)\
**Post date:** [January 3, 2018, 2:48pm UTC](https://forums.unrealengine.com/t/procedural-mesh-component-behaving-weirdly-when-trying-to-apply-material/385972/3 "2018-01-03T14:48:57Z")

</div>

How did you solve it?
