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\$ – Bergquist3D Jul 10 '20 at 16:49
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\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.