# Calculating LookAt position from rotation and translation matrix

I was wondering if it was possible to calculate a lookat position from the translation and rotation matrices (aka the building blocks of my view matrix). I need the lookAt position to implement a special type of frustum culling, but my program does not use the lookat position, so I was looking for a simple solution to calculate it.

• Any point along the camera's forward axis can be used as a look-at position. What have you tried so far? Jan 26, 2023 at 21:41
• Okay, thanks so much for the tip
– oli2
Jan 26, 2023 at 22:12
• Actually, how would I go about calculating the forward vector of the camera?
– oli2
Jan 26, 2023 at 23:06
• Depends on your framework/tech stack. Sometimes it's the camera's local +z, sometimes -z, though more exotic choices are conceivable. What can you tell us about how you've coded this camera? Jan 27, 2023 at 0:27
• I made my own framework using metal (Apple Graphics API) I have access to the camera position, worldup, view matrix, rotation (in both degrees and radians) and the translation data
– oli2
Jan 27, 2023 at 1:41

Add some multiple d of the third row of your view matrix to your camera position to get a point d units in front of your camera along its forward axis.
(This is equivalent to multiplying the vector (0, 0, d, 1) by the camera's transformation matrix, or the inverse of the view matrix, just skipping redundant ops for the zero terms)
Some APIs treat negative d values as "in front" of the camera, while others say that's behind and positive is in front, so flip the sign on d if you initially get the wrong answer.