# How can i texture my procedurally generated mesh?

**URL:** <https://forums.unrealengine.com/t/how-can-i-texture-my-procedurally-generated-mesh/372364>\
**Category:** Rendering\
**Tags:** procedural-mesh-comp, unreal-engine, CPP, question\
**Created:** [October 3, 2016, 8:30pm UTC](https://forums.unrealengine.com/t/how-can-i-texture-my-procedurally-generated-mesh/372364 "2016-10-03T20:30:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_03c19ced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_03c19ced](https://forums.unrealengine.com/u/anonymous_user_03c19ced)\
**Post date:** [October 3, 2016, 8:30pm UTC](https://forums.unrealengine.com/t/how-can-i-texture-my-procedurally-generated-mesh/372364/1 "2016-10-03T20:30:04Z")

</div>

I already applied a material to the procedurally generated terrain that has its vertices generated by a perlin noise function in c++, the thing is i want to make the terrain to have different textures based on the height of the vertices.  
Like the unreal engine terrain that can be multilayered with different textures.

---

<div class="post-metadata">

**Author:** ![MadisonAster](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MadisonAster](https://forums.unrealengine.com/u/MadisonAster)\
**Post date:** [October 3, 2016, 9:59pm UTC](https://forums.unrealengine.com/t/how-can-i-texture-my-procedurally-generated-mesh/372364/2 "2016-10-03T21:59:47Z")

</div>

I think terrain materials may fail you here. From my understanding terrain geometry generated by the editor traditionally uses a height-field for it’s displacement, from there it generates a planar projection for the uvs. Terrian layers work on a similar masking technique where you paint in different masks. The editor probably won’t apply painting tools to anything other than a landscape mesh though.

* * *

If the painting tools are crucial for you, you might hack around the issue by spitting out a heightfield from your generated mesh, importing that as a landscape (that you could hide later on), painting your terrain layers onto the landscape, then figuring out where the landscape tool is stuffing it’s layer textures, re-projecting those onto your original geometry, and using them as masks inside the material editor.

Alternatively, if your hang-up is strictly related to the material’s calculation, and you aren’t worried about painting tools, you should check out the Absolute World Position node inside the material editor. If your generated mesh is sufficiently wrangle-able, you may be able to just do the math directly in the material editor and construct your layers manually.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_03c19ced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_03c19ced](https://forums.unrealengine.com/u/anonymous_user_03c19ced)\
**Post date:** [October 4, 2016, 6:06pm UTC](https://forums.unrealengine.com/t/how-can-i-texture-my-procedurally-generated-mesh/372364/3 "2016-10-04T18:06:06Z")

</div>

Im not using painting tools, im trying to pass to height of the vertices in its material and then decide wich texture should be applied at that vertex location

Also thx for response 🙂

---

<div class="post-metadata">

**Author:** ![FunnyCheeze](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FunnyCheeze](https://forums.unrealengine.com/u/FunnyCheeze)\
**Post date:** [March 31, 2018, 2:00pm UTC](https://forums.unrealengine.com/t/how-can-i-texture-my-procedurally-generated-mesh/372364/4 "2018-03-31T14:00:26Z")

</div>

Help, any results?
