- Home /
Faces on procedural mesh with directional light
I am generating a mesh with this marching cube code, then calculating the normals with Unity's builtin mesh.RegenerateNormals() function, however when I change the material smoothness from 0, you can see the faces of the mesh. You can also see the faces of the mesh when the directional light is near horizontal casting a shadow. I was wondering how to fix it and get the smooth shading I was expecting.
Smoothness > 0
Smoothness = 0
From the post you linked :
scrawk April 16, 2013 at 10:24 pm
Thanks. The lighting is correct. You can see the triangle faces because there is no normal smoothing. You will need to calculate this yourself for procedurally created meshes in Unity.
Want to know how to create smoothed normals from voxel data? See the simple voxel terrain project.
@alucardj thanks, that was it! I assumed that I'd be able to see the faces all the time if the normals weren't smooth, ins$$anonymous$$d of just when the light was hitting them.
Your answer
Follow this Question
Related Questions
Material(string) is obsolete. How else can a shader be loaded at runtime? 2 Answers
1 Mesh, 1 Material 2 UV channels 1 Normal map? 0 Answers
Determine whether or not model is "inside out" 2 Answers
How can I use Substance materials in Unity? 2 Answers
Standard shader looks incorrect on mobile (weird colors) 1 Answer