Many games do just fine with two projections, that can be represented by a matrix (orthographic and linear perspective). But what about projections that can't be represented by a matrix? Can you please provide some examples of such projections and why they might be used in a game application?

  • 1
    \$\begingroup\$ So you're saying tell me everything that isn't X? Pretty broad question. I find that I only need two projection matrix types. One based on having a camera with a variable FOV, and another that is orthographic. \$\endgroup\$
    – badweasel
    Jun 21 '14 at 20:25
  • \$\begingroup\$ @badweasel Yeah, me likewise, but there are probably infinitely many such projections and I just want some examples, the more notable ones. \$\endgroup\$ Jun 21 '14 at 20:31
  • \$\begingroup\$ Please do not use moderator flags to request a question be re-opened. Editing a question already puts it back into the re-open queue for the community to vote on. \$\endgroup\$
    – user1430
    Jun 22 '14 at 20:08
  • 1
    \$\begingroup\$ @JoshPetrie This is what moderator flags are for. First the flag, then the meta-site. \$\endgroup\$ Jun 22 '14 at 20:13
  • 1
    \$\begingroup\$ @JoshPetrie here's something for your reading pleasure. Obviously you were wrong, but you're more concerned about me raising the flag again. \$\endgroup\$ Jun 22 '14 at 20:23

Cameras used in graphics applications are most of the time orthographic or mimic a pinhole camera. Both can be represent by a 4*4 matrix. A special variant would be a camera used for 3D rendering where the optical axis is not in the middle of the resulting image (e.g. parallel shift 3D) - but even they can be represented as a 4*4 matrix.

Real camera lenses however can work differently (fisheye lenses) or even tho they are designed to mimic a pinhole, they introduce (unintentionally) a pincushion or barrel distortion. These more exact models are used in computer vision (see for example bundler: http://www.cs.cornell.edu/~snavely/bundler/bundler-v0.3-manual.html ).

If a game wants to mimic real lenses and those effects, it should do so as a post-processing pass in a fragment shader as straight lines should get "bended" and only projecting the vertices correctly (and not the fragments that get generated as rasterization later) will introduce artefacts.

The only example I'm aware of where such a distortion is used in games is the pre-distortion in Oculus Rift games to counter the real-world lens distortion of the HMD. But here it can be handled by the SDK and also is not a property of the games camera so it should not be a property of the camera class.

tl;dr: Unless you plan a photography oriented game with perfectly realistic (fisheye) lenses, you can stick with a 4*4 matrix.


Not the answer you're looking for? Browse other questions tagged .