title: Cube created by vertices and triangles as mesh renders different than normal cube?
body: <p>For something I want to do with these cubes I need to create the mesh myself so I know which vertices are which and am able to manipulate the geometry.</p>
  <p>But why does my scripted cube (on the left) look so different in shading than the Unity one?</p>
  <p>Both use the same material.</p>
  <p><a href="https://i.stack.imgur.com/gNRgD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gNRgD.png" alt="problem" /></a></p>
  <p>I guess it has something to do with the Phong?</p>
  <p>This is the code I use to create my own cube:</p>
  <pre><code>private void CreateCube() 
  {
  
      GameObject cubeObject;
      cubeObject = Instantiate(prefab, new Vector3(0, 0, 0), Quaternion.identity);
  
      Vector3[] vertices;
      int[] triangles;
  
      vertices = new Vector3[8];
  
      // BOTTOM VERTICES
      vertices[0] = new Vector3(0, 0, 0); //BBL
      vertices[1] = new Vector3(1, 0, 0); //BBR
      vertices[2] = new Vector3(0, 0, 1); //BTL
      vertices[3] = new Vector3(1, 0, 1); //BTR
      // TOP VERTICES
      vertices[4] = new Vector3(0, 1, 0); //TBL
      vertices[5] = new Vector3(1, 1, 0); //TBR
      vertices[6] = new Vector3(0, 1, 1); //TTL
      vertices[7] = new Vector3(1, 1, 1); //TTR
  
      triangles = new int[36];
  
      // BOTTOM TRIANGLES
      triangles[0] = 1; //BBR
      triangles[1] = 2; //BTL
      triangles[2] = 0; //BBL
      triangles[4] = 2; //BTL
      triangles[3] = 3; //BTR
      triangles[5] = 1; //BBR
      
      // TOP TRIANGLES
      triangles[6] = 4; //TBL
      triangles[7] = 6; //TTL
      triangles[8] = 7; //TTR
      triangles[9] = 5; //TBR
      triangles[10] = 4; //TBL
      triangles[11] = 7; //TTR
  
      // BACK TRIANGLES
      triangles[12] = 5; //TBR
      triangles[13] = 0; //BBL
      triangles[14] = 4; //TBL
      triangles[15] = 1; //BBR   
      triangles[16] = 0; //BBL
      triangles[17] = 5; //TBR
  
      // FRONT TRIANGLES
      triangles[18] = 6; //TTL
      triangles[19] = 2; //BTL
      triangles[20] = 3; //BTR
      triangles[21] = 6; //TTL
      triangles[22] = 3; //BTR 
      triangles[23] = 7; //TTR
  
      // LEFT TRIANGLES
      triangles[24] = 6; //TTL
      triangles[25] = 4; //TBL 
      triangles[26] = 2; //BTL
      triangles[27] = 0; //BBL 
      triangles[28] = 2; //BTL 
      triangles[29] = 4; //TBL 
  
      // RIGHT TRIANGLES
      triangles[32] = 7; //TTR
      triangles[31] = 5; //TBR
      triangles[30] = 1; //BBR  
      triangles[35] = 1; //BBR  
      triangles[34] = 3; //BTR 
      triangles[33] = 7; //TTR
  
      Mesh cubeMesh = new Mesh(); 
  
      cubeObject.GetComponent&lt;MeshFilter&gt;().sharedMesh = cubeMesh;
  
      cubeMesh.Clear();
      cubeMesh.vertices = vertices;
      cubeMesh.triangles = triangles;
  
      cubeMesh.RecalculateNormals();
  }
  </code></pre>
  <p>The prefab is just a GameObject with an empty Mesh Filter and a Mesh Renderer with a material attached (Default-Material).</p>