x

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"

Procedural Mesh blueprint triangle order

Hi there.

I decided to give procedural mesh generation a go using the Procedural Mesh blueprint component. I am familiar with CG in general and creating meshes from triangle buffers in OpenGL, but I had a question about how UE4's implementation of procedural meshes works.

When creating a mesh section (using the CreateMeshSection method), does the ordering of the vertex indices in the Triangles input matter? More specifically, does the order of vertices in each triangle (clockwise or counterclockwise) determine the normal of that triangle?

As a follow up, does UE4 use surface normals at all in rendering? If yes, how are they specified and can there be a conflict between vertex and face normals? If no, how are normals determined if you do not supply vertex normals when creating the mesh section?

Thanks in advance,

JT

Product Version: UE 4.11 Preview
Tags:
more ▼

asked Mar 21 '16 at 11:54 PM in Blueprint Scripting

avatar image

Psilox
13 1 2 3

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

1 answer: sort voted first

JT,

Give this answer a try. I had the same problem/question. I am making a cube via blueprint Create Mesh Section. Some of the triangles were not rendering. After some tinkering I decided to try changing the order of the triangles and see what happens. This has impacted the rendering. If I order the vertexes counter clockwise, I can see the triangle if my camera is below the rendered objects. If I move my camera to a location above the triangles, they will no longer render. I will assume that this has to do with the Normals and how they interact and define each of the triangles.

Hope the attached answer helps! Best of luck!

https://answers.unrealengine.com/questions/463807/understanding-vertices-in-procedural-mesh-componen.html

more ▼

answered Nov 13 '16 at 10:27 AM

avatar image

TreesAndDoughnut
28 3 3

avatar image TreesAndDoughnut Nov 13 '16 at 10:36 AM

I might have gotten the clockwise vs counter clockwise order mixed. I'm still tinkering with it.

avatar image Psilox Apr 05 '19 at 10:12 PM

Thanks for replying, I'd totally forgotten about this! I'm messing with procedural meshes again, and you're absolutely right in that UE4 ProceduralMeshComponent infers the direction of normals from the triangle order. If you're looking at the triangle face, a clockwise order will make the normal point away from you, and a counter-clockwise order will make the normal point toward you.

If you're facing two triangles, each with vertices labeled in order from 1 to 3:

        2
 
 1           3

The normal of this triangle will point away from you, so the surface won't be visible.

        3
 
 1           2

The normal of this triangle will point toward you, so the surface will be visible.

Hopefully anyone who stumbles on this will understand where to go from here now.

(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