Sign in to follow this  
aznium

Camera - Matrix

Recommended Posts

aznium    122
Hi guys, So basically what i am trying to do is to project some points in 3d space to a 2d monitor from a variety of camera locations and camera directions (basically first person) After some help from u guys, i've gone to use matrices Right now i have my Camera Translation Matrix (CT) Rotation Matrices (x,y,z) (CX, CY, CZ) now im stuck can someone please clarify what to do once i have these matrices http://en.wikipedia.org/wiki/3D_projection http://www.gamedev.net/reference/articles/article417.asp the sites seem to have conflicting ideas To get the 2D point am i suppose to do this double[] 3dpoint = new double[4]; 3dpoint[0] = xpoint; 3dpoint[1] = ypoint; 3dpoint[2] = zpoint; 3dpoint[3] = 1; double[] 2dmatrix = CT * CX * CY * CZ * 3dpoint; is the above line correct? if not, what should it be? THANKS

Share this post


Link to post
Share on other sites
jyk    2094
Quote:
Original post by aznium
double[] 2dmatrix = CT * CX * CY * CZ * 3dpoint;
This doesn't have anything to do with projecting a point to screen space; it actually transforms the point from camera local space into world space, which you'd only be doing if, say, you were rendering a model that represented the camera. By the way, is this C++?

The following:
inv(CZ)*inv(CY)*inv(CX)*inv(CT)*3dpoint
Is the first step towards getting a point to screen space. The above can be expressed in other ways as well, such as concatenating the matrices first and then inverting. Also, the inversions here are more or less trivial; they're not general inversions.

After that comes transformation into clip space via the projection matrix, and then perspective division.

Share this post


Link to post
Share on other sites
aznium    122
thanks jyk

i think i got my first 3d engine running

no, im not using C++, im using java (applet...i never liked how win32 drew stuff and i want to stay away from OpenGL and DirectX for now)

Quote:

After that comes transformation into clip space via the projection matrix, and then perspective division.


i read something about perspective division and im about to implement it, but i never saw anything about perojection matrix, can u elaborate?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this