Procedural Mesh Component

Hello UE4 Community,

I have recently been working on an automatic foliage system and realized that I could use a procedural mesh to make terrain. I understand what the different nodes related to the procedural mesh might do (i.e. Set Triangles sets what the mesh is.) But there seems to be a lack of documentation when it comes to this component. Where do I get the triangles from in the first place? Do I use some node to convert a static mesh to triangles and then change it accordingly, or do I create the triangles from scratch? If either, HOW do I do it?

Thanks.

Often times if you are building a procedural mesh, you will want to build your own triangles. There are many many methods to build triangles that you can use. The basic idea is that you build a list of Vector3 entries where you store your triangles.

I’ll plug a link here for a diagram from a website that shows the basic idea of your list of triangles.
http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series3/Triangle_strip.php

In general, for procedural landscape (maybe I’m biased), I would start by building a square of your desired size where each triangle is x units wide and x units long.

Something like:

for x while x < 100:
  for y while y < 100:
    Vector3 pt1 = x, y, 0
    Vector3 pt2 = x, y + 1, 0
    Vector3 pt3 = x + 1, y, 0

This approach can be incredibly expensive but will work well for your first foray into procedural generation. After that, often times you’ll use some variation of noise formula or Voronoi diagrams and Delaunay triangles to build your meshes.

And another link for procedural terrain if interested:
http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/

Thank you. I’ll look into it.