Results 1 to 4 of 4

Thread: If I have the view matrix, can I find the camera's target point?

  1. #1
    Member Contributor
    Join Date
    May 2010
    Posts
    66

    If I have the view matrix, can I find the camera's target point?

    How do you find the point that camera is aiming at, if I have the view matrix? I have the eye position and the camera orientation but I need to know the 'lookat' point, if there is one?

  2. #2
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,674
    The camera doesn't look at a point. The camera looks along a direction; there are infinitely many points along that direction that the camera could be looking at.

    Look-at-style functions will generate the same matrix for any of the points in that direction. They only take a point because some people find that it's easier to orient a camera to look at a position.

  3. #3
    Member Contributor
    Join Date
    May 2010
    Posts
    66
    Okay, thanks - I was afraid that was the answer.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,103
    Quote Originally Posted by bsabiston View Post
    How do you find the point that camera is aiming at, if I have the view matrix? I have the eye position and the camera orientation but I need to know the 'lookat' point, if there is one?
    Invert the view matrix. Transform the points (0,0,0,1) and (0,0,-1,1) by the inverse of the view matrix. The first point gives you the eye position, the second gives you a point directly in front of the camera. The line through those two points is the centre line of the view.

Similar Threads

  1. Camera view matrix inverted?
    By fiodis in forum OpenGL: General
    Replies: 1
    Last Post: 11-18-2015, 04:07 AM
  2. View matrix for point light calculation should be inverse?
    By sasmaster in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 07-12-2012, 06:23 AM
  3. Camera view matrix
    By sasmaster in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 04-18-2012, 12:11 AM
  4. Glut/GL Camera or view point please help
    By Slong in forum OpenGL: Basic Coding
    Replies: 15
    Last Post: 11-09-2009, 08:59 PM
  5. Convert camera with target to 4x4 matrix
    By project6 in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 05-28-2008, 07:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean