1
\$\begingroup\$

I tried to generate a mesh from code in Unity. The problem is, that the edges are automatically smoothed. When I import a model into Unity, I can set the smoothing angle of the edges, but is something like this possible with a generated mesh?

I would like to have no smoothing at all.

\$\endgroup\$
1
  • \$\begingroup\$ If anyone is looking, this tool can harden edges and smooth edges, along with the entire mesh. https://assetstore.unity.com/packages/slug/166155 It also has a bunch of other modeling tools if you wanted to edit your generated mesh. \$\endgroup\$ Commented Jul 10, 2020 at 16:49

1 Answer 1

2
\$\begingroup\$

The normal for a vertex is generated by taking the mean of the normals for each face that contains that vertex.

As such if a mesh contains two (or more) triangles that share vertices they will be displayed with a smoothed edge.

If you use separate vertices (they can have identical positions) then they will be displayed with a hard edge.

There is some coverage of this topic on Morten Nobel's blog post on procedurally generating meshes over here.

\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.