# Recap on how a camera works in 3d Space?

This may be marked as a duplicate, but I have been trouble thinking about a camera.

I understand that there is a "camera transform," or view matrix. However, this is multiplied with every vertex in the scene when the camera is looking towards the negative Z axis at the origin. Do I move the camera around and then find a translation, rotation matrix to transform the camera to the origin, looking at the negative Z axis and multiply each point by this matrix (in addition to the camera transform later)? Or do I simply always keep the camera at the origin looking towards the negative Z axis, and "move" the world around it? If this is the case, how do I move the world around it? I am looking for the most efficient one.

NOTE: NOT USING OPENGL OR DIRECTX OR ANY OTHER API OUT THERE

• I always consider the true camera to be static. In XNA, one thing you see in all 3d shader is that each vertex is multiplied by its world transforms, the view matrix and projection matrix. Projection determines the shape of the camera frtustum, while view determines position and rotation. Posting as comment because I'm not sure if this is a definitive answer. Jan 20 '16 at 5:03
• Closely related: gamedev.stackexchange.com/questions/40741 Jan 20 '16 at 8:42

Both options are basically the same.

In the end you do have a bunch of vertices that you multiply by mModel * mView * mProjection.

If you move the camera within the world, that transformations go into mView. If you move the world around - into mModel.

mModel is actually constructed of many matrices guiding how objects and sub-objects are positioned within the world. So what you get is:

mSubSubModel * mSubModel * mModel * mIdentityWorld * mCamera * mProjection
// mIdentityWorld being identity matrix (can be skipped)


Now see how it is equivalent to:

mSubSubModel * mSubModel * mModel * mWorld * mIdentityCamera * mProjection
// mIdentityCamera being identity matrix (can be skipped)