**comp.graphics.algorithms**

## Subject: **Re: 3D camera question**

Thanks for your reply. The mathematical notation is a little confusing to

me, but let me see if I understand this correctly.

I should have a 4x4 matrix representing the location and rotation of the

camera. Do I plug the numbers representing the location and rotation

directly into positions in the matrix or should I use the standard

rotate/translate way of altering the matrix?

Once I have that matrix, I then invert it. Once inverted I multiply any

existing world matrixes of each object by the camera matrix and that should

be it?

Any code/psuedocode would be really helpful.

Thanks so much for your help.

> Let the camera be defined by a homogeneous matrix 4*4 C, such that the 3

> first vectors represent the x, y and z axes of the camera (with the

> homogeneous w = 0) and the last vector represents the position of the

> camera (point, thus with w = 1).

> Given any point, the matrix C represent a transformation from camera

> space to the world space. Now I must assume column vectors are used, but

> this should not be an issue. Thus:

>

> Cx = y

>

> where

> x is a point in camera space

> y is a point in world space

>

> If the camera axes x,y,z are linearly independent, then C is invertible

> and:

>

> x = (C^-1)y

>

> The result:

> To transform a point in world space to the camera space you need to

> transform it with the *inverse* of the camera matrix.

>

> If you are unfamiliar with homogeneous stuff:

> An affine transformation can be given in the form

> f(x) = Ax + b

>

> where

> A contains the camera axes

> b is the camera position

>

> The inverse of the transformation, if exists (A nonsingular), is:

> f^-1(x) = (A^-1)(x - b)

>

> Using the same reasoning as before then:

> x = f^-1(y) = (A^-1)(y - b)

Reply

View All Messages in

**comp.graphics.algorithms**

path:

3D camera question =>Re: 3D camera question =>

Replies:

Re: 3D camera question

Copyright © 2006 WatermarkFactory.com. All Rights Reserved.