0
\$\begingroup\$

Whether I import a smooth shaded mesh from Blender or I generate a mesh in Unity manually using Unity's built in normal calculation function, I get a square grid pattern showing for the shading of my mesh (red line highlights a couple of the squares).

Each square outline is where a quad is located.

Is this normal? Is there any way that I can make this appear more smooth?

Edit:

Each point on the triangle exists only once. Points are shared between triangles. They are created with a simple loop:

        List<Vector3> vertexList = new List<Vector3>();

        for (int z = 0; z < zSize; z++)
        {
            for (int x = 0; x < xSize; x++)
            {
                Vector3 v = new Vector3(0, 0, 0);
                v.x = (x * vertexSpacing) - vertexSpacing;
                v.z = (z * vertexSpacing) - vertexSpacing;
                v.y = Mathf.PerlinNoise(v.x + g.transform.position.x, v.z + g.transform.position.z);
                vertexList.Add(v);
            }
        }

Grid pattern with no wireframe

Wireframe edges visible

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Can you show how you generate this mesh? Is there a single shared vertex at each grid corner, or do you have duplicate vertices there? This can affect the normal calculation and shading result. \$\endgroup\$
    – DMGregory
    Commented Aug 4 at 17:14
  • 1
    \$\begingroup\$ Need more information. How are you interpolating the normals, (per vertex) vertex shader then in fragment shader as colour values or (per fragment) frag shader interpolating normals and appling lighting? What colour model are you using? linear or logarithmic? Have you normalized the normals? There looks to be a specular value in the calculation, are the artifact there when you turn off specular? Are the artifact there when you set ambient to zero? Are you calculating vertex normals in a shader (the example code only shows vertex positions)? \$\endgroup\$
    – Blindman67
    Commented Aug 5 at 8:30

1 Answer 1

0
\$\begingroup\$

It looks like this is how normals are supposed to be and that the issue was being caused by me excessively stretching the triangles.

enter image description here

enter image description here

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .