title: OpenGL - How to calculate normals in a terrain height grid?
body: <p>My approach is to calculate two tangent vectors parallel to axis X and Y respectively. Then calculate the cross product to find the normal vector.</p>
  
  <p>The tangent vector is given by the line that crosses the middle point on the two nearest segments as is shown in the following picture.</p>
  
  <p><img src="https://i.stack.imgur.com/Z39Ke.png" alt="enter image description here"></p>
  
  <p>I was wondering whether there is a more direct calculation, or less expensive in terms of CPU cycles.</p>