1
\$\begingroup\$

On this generated mesh, I have sharp edges, because each square has duplicate vertices separate from its neighbours.

I can't remove the duplicate vertices because I'm using them to provide unique UV texture coordinates on each square. If I share the vertices then the texture wraps around the surface in an unwanted way.

Is there a way I can get smooth shading along these edges, even without shared vertices?

Screenshot of generated model showing hard creases

\$\endgroup\$
0
\$\begingroup\$

You don't need to remove duplicated vertices, smooth lighting doesn't come from triangles sharing vertices. You just need to set the normals correctly.

First I'd go through every triangle and set the normals of the vertices of the triangle to the normal of the triangle, then go through every vertex pair, check if their positions are the same and if they are, set their normals to the average of their current ones.

\$\endgroup\$
  • \$\begingroup\$ Thank's, that's what i thought. so i need to create my own normal for the mesh. \$\endgroup\$ – Dreugui Jun 6 '19 at 7:21

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.