Shadow artifects on mesh with Standard shader


I’m seeing unusual shadows on my mesh. The mesh is generated by code.
Here you can see how it looks very tily, i highlighted them with a yellow arrow, to the right you can see an example mesh.

alt text

And here you can see what this does in runtime:
alt text

Any ideas on how to fix this? Or make it look better?




I kind of figured out what was going on. I build my mesh the wrong way. I assumed a Cube had 8 vertexes, sharing the vertexes where the faces connect, but the primitive Cube in Unity has 24. Each face has its own 4 vertexes. The following wiki helped me to construct the new mesh

Hope this might help someone that faces the same problem.