Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to use Procedural Mesh Component in Blueprint?

I see Procedural Mesh Component in UE4.9 and I have studied this link:



but I dont know how to build triangle mesh like git example using Blueprint in UE4.9:


Product Version: UE 4.9
more ▼

asked Sep 02 '15 at 04:46 AM in Blueprint Scripting

avatar image

30 4 8 14

avatar image chr33z Sep 02 '15 at 03:16 PM

In the wiki is mentioned, that this apporach no longer works in 4.8+. So I went and tried the Procedural Mesh Component in a Blueprint.

Basically you can add Procedural Mesh Component to an Actor and provide Vertices, Triangles and UVs to generate a mesh that is rendered at the actors location. I will briefly summarize what I did:

  • I wrote a custom Component that generates the Vertices (from a file).

  • I store all Vertices in a UStruct, that is accessible in Blueprints.

  • I wrote a Blueprint function that generates Triangles und UVs for my Vertices

  • I use the generated Vertices, Triangles and UVs as input for "Create Mesh Section"-Node

  • I apply a Material and Transformation to the generated mesh

I currently use 4.8.3 but this should work for 4.9, too.

(Edited to fix list formatting)

avatar image IIIIID Sep 03 '15 at 02:42 AM

thanks, I'll try it

avatar image Abductor Nov 03 '15 at 01:44 PM

That sounds exactly what I am trying to archive. Could you provide some more details about what you did (Code and Blueprint-Screenshots)?

That would be awsome!

avatar image chr33z Nov 03 '15 at 08:02 PM

I have the code at my university and will work on it again on thursday. I can send you some screenshots from my blueprints to show you how it looks.

avatar image Abductor Nov 04 '15 at 07:13 AM

That would be very appreciated. I`m sure it would help lots of people

avatar image chr33z Nov 06 '15 at 02:58 PM

I added the screenshots as an answer, because comments won't allow long posts.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I post this as an answer becaus the comment section is too small and won't allow long comments...

Info: I'm on version 4.8.3

Here are some screenshots from my Blueprint setup. There is lots of other stuff there that is not so important and I will try to describe the basic setup:

Generating a Mesh and Updating the Procedural Mesh Component

In my setup, LeftEyeGeometry and RightEyeGeometry are both Procedural Mesh Components that both get a generated mesh. The mesh is generated in the function "Generate Geometry From Distortion", the Procedural Mesh Components are updated with the function "Create Mesh Section"

Overview over Generate Geometry From Distortion Function

In my case I generate a mesh from an xml file that contains 2D data points. The function "Create Mesh Section" expects at least an array of vertices (the 3d data points that make up the mesh), an array of triangles (integer: the vertices that make up the faces of the mesh) and an array of UV-coordinates (2d vector: a 2D vector that maps a vertice into UV coordinates for texture mapping).

The function "Generate Geometry From Distortion" generates these three arrays. recommend reading some code about mesh generation, because my implementation is just a translation in blueprint code from existing implementations. Here is the link I used: link text

In the "Generate Vertices"-Comment I just map all vertices to coordinates from -1 to 1 (easyer to scale and my data points are not normalized) and map the X->Y and Y->Z (because I wanted my data points to be in the Y/Z plane).

Variable initialization Here I prepare some variables for the function. NumX is the horizontal vertice count, NumY the vertical count. Vertices is an array of vertices (upper-left to lower-right) in 2D coordinates.

(See picture in comment) Generate UV-Coordinates for each vertice

(See picture in comment) Compare this part with the implementation on link text!

Don't forget to provide a Material for your Procedural Mesh Components!

You can start with a simple example and build a mesh with 4 vertices by hand. The Vertices, Triangle und UV arrays can be build by hand and you can get comfortable with the function "Create Mesh Section". Note that you wont see a mesh if the triangles face the wrong direction.

I hope my explanation is not too reduced. If there are any questions, feel free to ask!

overview.jpg (356.8 kB)
part1.jpg (303.1 kB)
more ▼

answered Nov 06 '15 at 02:54 PM

avatar image

28 3 5 10

avatar image chr33z Nov 06 '15 at 02:58 PM

UV Coordinate Generation Triangle generation Part 1 Triangle Generation Part 2

part2.jpg (296.2 kB)
part3_1.jpg (298.5 kB)
part3_2.jpg (323.2 kB)
avatar image manuaganu Dec 22 '15 at 05:12 AM

I tried to follow your steps...I just set values in "create mesh section".

But unable to see any geometry.

Is there any pre-requirement for it ?

avatar image chr33z Dec 22 '15 at 07:36 AM

I found debugging a little tedious to say the least. There are some things to look out for:

  • The triangles can define the polygon in the wrong direction. That means the normals of the mesh face away from your initial position and you won't see them at first.

  • There is no material assigned to the mesh. Enable wireframe mode and see if there is a mesh. You can also make the material double-sided

  • The mesh is to small (or to big). If you enter vertex coordinates between -1 and 1 then the mesh is in fact a maximum of 2 units in dimension. Try to zoom in (or out)

I started with a minimal example (I am away from my PC for the holidays so this is how I remember it):

  • vertices: [(-1,0,-1), (1,0,-1), (1,0,1)]

  • triangles: either [0,1,2] or [0,2,1]

  • uvs: either [(0,0), (1,0), (1,1)] or [(0,0), (1,1), (1,0)]

Triangles define which vertices make up one polygon and and which direction the normal of the polygon is facing. UVs are, if I recall correctly, in the same order as the triangles and are defined in coordinate space (0,0) to (1,1)

Hope this helps

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question