title: Calculating a LookAt matrix
body: <p>I'm in the midst of writing a 3d engine and I've come across the LookAt algorithm described in the DirectX documentation:</p>
  <pre><code>zaxis = normal(At - Eye)
  xaxis = normal(cross(Up, zaxis))
  yaxis = cross(zaxis, xaxis)
  
   xaxis.x           yaxis.x           zaxis.x          0
   xaxis.y           yaxis.y           zaxis.y          0
   xaxis.z           yaxis.z           zaxis.z          0
  -dot(xaxis, eye)  -dot(yaxis, eye)  -dot(zaxis, eye)  1
  </code></pre>
  <p>Now I get how it works on the rotation side, but what I don't quite get is why it puts the translation component of the matrix to be those dot products. Examining it a bit it seems that it's adjusting the camera position by a small amount based on a projection of the new basis vectors onto the position of the eye/camera.</p>
  <p>The question is why does it need to do this? What does it accomplish?</p>