Here I try to combine scratchapixel's articles to understand the operation of the camera-to-world matrix and ray direction vector. Here https://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-generating-camera-rays/generating-camera-rays.html if you scroll the last part is about generating a direction vector without converting pixel coordinates from raster space to NDC, then to screen. I decided to take that approach. But, after multiplying the direction vector with the camera-to-world matrix, there is no added translation vector to the direction vector's coordinates (that is the 4th vector of the matrix). Maybe the camera is placed at (0,0,0). Idk. Also, are LookAt and camera-to-world matrices the same thing?

  • $\begingroup$ Welcome to computer graphics stack exchange! the lookAt matrix transforms world coordinates to camera coordinates. The inverse of the lookAt matrix transforms camera coordinates to world coordinates. $\endgroup$
    – Thomas
    Jun 28 at 11:56
  • $\begingroup$ Adding to @Thomas answer: The lookAt matrix is A but not THE world-to-camera matrix. The same is true for the inverse. A "look at"-camera represents a camera model where the camera is focused on a point in space like in most strategy games. FPS use a different camera model, but the corresponding matrix that transforms between the camera and world coordinate system is also a camera-to-world matrix. $\endgroup$
    – wychmaster
    Jun 28 at 12:31
  • $\begingroup$ I got it. I am mainly interested in whether does row-majored LookAt matrix contains the camera's coordinates as its 4th row. I know that camera-to-world contains it. $\endgroup$ Jun 28 at 15:07


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.