23
\$\begingroup\$

The question is pretty much in the title. Are there notable 3D projections other than orthographic and perspective that could be used in a 3D system such as OpenGL?

In particular, are there any that have a particular use in game design?

\$\endgroup\$

3 Answers 3

23
\$\begingroup\$

Yes, To name a few:

The Pannini projection, for example, can capture wide fields of view in nice ways. (totally just my opinion)

I think implementation details would be beyond the scope of this specific question.


EDIT: Thanks for the comment, I did misspell Pannini. And to make this edit worthwhile here are a few more:

  • Paraboloid / Dual-Paraboloid (Useful for reflections, shadows, stained glass)
  • Equirectangular (Can produce a world map view of a sphere)
  • Spherical
  • Sinusoidal
\$\endgroup\$
5
  • 4
    \$\begingroup\$ +1 for Panini projection; I hadn't ever heard of that one before. BTW, as long as we're talking non-linear projections, dual-paraboloid is one that's sometimes used for environment maps and shadow maps. \$\endgroup\$ Jun 19, 2014 at 5:51
  • \$\begingroup\$ Being very picky, but it appears to be the "Pannini", not "Panini" projection. \$\endgroup\$
    – aardvarkk
    Jun 19, 2014 at 14:32
  • \$\begingroup\$ Very cool! I'm guessing these are all non-linear, like Nathan Reed says? \$\endgroup\$ Jun 19, 2014 at 16:23
  • \$\begingroup\$ I believe so, you most likely have to use hardware tessellation or image processing to achieve them in practice. I'm having trouble thinking of another projection which maps straight lines into straight lines but I will add it to this answer if I come up with something. \$\endgroup\$
    – MickLH
    Jun 19, 2014 at 17:23
  • \$\begingroup\$ It probably doesn't exist, this is exactly the kind of think I was thinking of! \$\endgroup\$ Jun 19, 2014 at 20:21
15
\$\begingroup\$

It depends on what you mean by "that could be used in a 3D system such as OpenGL". :)

Narrowly speaking, 3D graphics hardware and APIs like OpenGL only deal correctly with linear projections - projections that map straight lines in world space to straight lines on the image. They never distort something into a curved shape (unless it was curved to begin with). This is because GPUs depend on triangles having straight edges in order to rasterize them correctly on screen.

If we limit ourselves to linear projections, there aren't too many choices. In addition to the standard ortho and perspective, there are also "off-center" variations which are obtained by shearing the view frustum.

  • An off-center ortho projection is called oblique projection and is often used for engineering diagrams but doesn't show up much in games.
  • Off-center perspective projections are used in stereo 3D rendering, since it turns out that the left and right eye views fuse better in the brain if you shear the frustums instead of rotating them to focus on an object.

These projections can be represented with the usual 4×4 projection matrix and used in a 3D API without problems.

Then there are the nonlinear projections, which don't have the restriction of mapping straight lines to straight lines; they're allowed to distort things into curves. There are lots of these, including cylindrical, spherical, various types of fisheye, and others.

With nonlinear projections, you can't simply use a projection matrix; you have to somehow implement the projection yourself using shaders. One way is to write a custom vertex shader to do the projection per vertex. The GPU will still draw the triangle with straight lines between the vertices, so while small triangles will be pretty close to correct, larger triangles will be noticeably wrong. This can cause problems, and geometry may need to be subdivided very finely in order to render correctly.

A second approach to getting a nonlinear projection is to render the scene using a regular perspective projection first (maybe to a cubemap, which has a perspective projection for each cube face), then apply a post-process pixel shader to resample it to the desired nonlinear projection. This has the advantage of not requiring geometry modifications, but it can be more expensive due to the extra rendering work required, and the result can be blurry in some areas if the first-pass render doesn't have enough resolution. The post-process approach is used by Oculus Rift games, for example, to implement the nonlinear projection the Rift requires to work with its lenses.

\$\endgroup\$
0
\$\begingroup\$

I can't believe it but nobody has mentioned Isometric Projection which used to be quite common.

\$\endgroup\$
1
  • 11
    \$\begingroup\$ As far as I know, isometric projections are specific use cases of the other two projection types, orthographic and perspective. For example a ortho projection with a view in a certain angle gives you an isometric camera. \$\endgroup\$
    – Grimshaw
    Jun 19, 2014 at 11:56

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