I'm wondering if it is possible to generate a dynamic spherical environment map using a single frame render using a pincushion curvilinear perspective projection matrix (phew, that's a mouthful)?

I've been researching this for a few days now and the closest thing I can find is a curvilinear perspective but it isn't a commonly used projection matrix so there isn't any help I was easily able to find and I still don't know if it supports a full circle FOV.


The standard perspective matrix but it begins to look very strange and distorted above 180 degrees vertical FOV and completely fails to render when approaching 360 degrees. So instead most games render the scene six times using 90 degree FOV facing the faces of a cube.

Rendering the scene 6 times seems like a waste if it might be possible to simply imagine a camera that has a 360 degree view across both axis and then render that to a spherical environment map.

  • 3
    \$\begingroup\$ It depends a bit on your geometry complexity. Your whole scene needs to be made of very small triangles, since that is what the graphics card will operate on. Your projection matrix will only transform vertices, which means that lines will be preserved as lines, not as curves. You might be able to do this using a geometry shader or similar. Or render to cubemap as possible with GL4/DX11, where you can render your scene in one drawcall. \$\endgroup\$
    – void
    Jun 13, 2011 at 7:48
  • \$\begingroup\$ Correction, not one drawcall. But you don't have to render each face separately. \$\endgroup\$
    – void
    Jun 13, 2011 at 9:39
  • \$\begingroup\$ @void Luckily my scene is entirely made of triangles. Thank you. Would you mind providing any references you know of? I found wiki.gamedev.net/index.php/… but it seems like the site is down and no cache is available. Beyond that result I'm having a hard time even when searching the term 'single pass environment map' \$\endgroup\$
    – NtscCobalt
    Jun 13, 2011 at 14:43
  • 1
    \$\begingroup\$ Well, of course it is triangles. The question is how big they are and if they will look sane in a curvelinear mapping. your triangles will have to be something like 3-5 px big in the rendered reflection map to not look distorted. On single pass environment map: Microsoft has a sample in the DirectX SDK on how to do it with D3D10/11. For GL you can use multilayered framebuffer attachments and then set gl_Layer in your geometry program to output geometry to different cube sides. \$\endgroup\$
    – void
    Jun 13, 2011 at 14:53

2 Answers 2


In practice, even when a scene is built to minimise problems, a 360-degree-FOV camera tends to introduce so much distortion in some directions that its results are useless for most purposes.

If you want to avoid the expense of rendering a full texture cube, you can get a similar effect by using dual paraboloid environment maps, in which you render two parabolic views of the scene, and then use those two resulting images as your environment map, instead of using a texture cube's six maps.


The short answer is: yes, it is possible, but since the projection you desire is nonlinear, you must do one of two things:

  • Subdivide the geometry finely and implement the projection math in the vertex shader (or domain shader if using hardware tessellation), or
  • Render a standard environment map (e.g. cubemap) first and then resample it to the desired projection using a post-processing pass.

For more details you can see my answer to this related question, where I've talked about this at greater length.

The takeaway, though, is that rendering with a nonlinear projection generally requires you to do some sort of extra work and isn't terribly likely to be an optimization over simply rendering a cubemap, despite the fact that you then have to draw the scene six times (or, perhaps better, use a geometry shader to replicate primitives to all cube faces).


You must log in to answer this question.

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