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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How can I get polygon normals of a static mesh?

I'm trying to access normals of a static mesh via C++. I managed to find verteces and triangles in LODResources, but I didn't find anything related to triangle normals. Is there a way to get access to it or do I need to calculate them manually?

Cheers

Product Version: UE 4.11
Tags:
more ▼

asked Jul 26 '16 at 04:35 PM in C++ Programming

avatar image

eivanov
3 1 1 3

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

1 answer: sort voted first

Along the line of what you where already looking at:

 FVector Normal = StaticMesh->RenderData->LODResources[LOD_Idx].VertexBuffer.VertexTangentZ(VertIdx);

If you want face/triangle normals rather than vertex normals, you have to calculate them yourself.

  • VertIdx goes from 0 to VertexBuffer.GetNumVertices()

more ▼

answered Jul 27 '16 at 03:47 AM

avatar image

rantrod
1.5k 49 47 216

avatar image Aintaer Oct 27 '16 at 02:32 AM

When I try this in 4.13 I get a linking error

 error LNK2001: unresolved external symbol "__declspec(dllimport) union __m128 const GVectorPackingConstants" (__imp_?GVectorPackingConstants@@3T__m128@@B)
avatar image Aintaer Oct 27 '16 at 02:39 AM

I found that you need to include "RenderCore" into your dependencies for this to link properly.

avatar image Neytoz Mar 22 '17 at 11:51 AM

I love you! I had the same problem, and you saved me!

avatar image M-Pixel Jan 18 '18 at 12:19 AM

... meaning that you should add PublicDependencyModuleNames.AddRange(new string[] { "RenderCore" }); to the constructor of your Build.cs file. Or, if a PublicDependencyModuleNames.AddRange statement already exists, then you should add "RenderCore" to that existing array literal.

avatar image SuhaibGhrear May 31 '17 at 12:37 PM

yes yes ^_^ you need to include "RenderCore" into your dependencies for this to link properly.

(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