Archived

This topic is now archived and is closed to further replies.

cody

projection matrix vs. modelview

Recommended Posts

can i include the camera position into the projection matrix? then the modelview matrix would correspond to the position of my 3d objects in world space, not in camera space(am i right here?) and that would be more usefull in my case. i could render a object in different views by just changing the projection matrix. i think in d3d there are different matrices for camera and other objects. in my opinion this is easier to use. would there be there problems when i dont use the matrices the standard way?

Share this post


Link to post
Share on other sites
While it is theoretically possible to put the camera transform into the projection matrix, it should never be done. If you do, you'll get several problems. The 3D pipeline simply doesn't expect the camera transform in the projection matrix. By definition, once the modelview matrix is applied to your coordinates, they are expected to be in eye-space. Several functions such as lighting, fog, texgen, etc. rely on this fact. They will seriously screw up, if you don't follow the standard way.

A short 'projection matrix abuse' FAQ can be found here.

BTW: all this doesn't really apply anymore, if you use vertex shaders. In that case you are in full control over how the different matrices are used. But when using the fixed function pipeline, the standard way must be respected to avoid problems.

/ Yann

[edited by - Yann L on August 18, 2002 12:39:03 PM]

Share this post


Link to post
Share on other sites