Rendering a scene with a very wide FOV

From what I understand the lens of ordinary OpenGL camera cannot go above 179 degrees.

What I need is to render the scene at 195 degrees, and make it mappable to a custom projection mesh, similar to what VR devices need.
Also, the center of the camera has to be set differently than center of screen.

Is this is in any way possible with Panda?

Even if two renders have to be made and somehow stitched together that will also work.

Yeah, this is possible. Panda3D does have a system built-in for this, the NonlinearImager, check this post for a code example:

However, it is fairly complex to set up, and the documentation is relatively sparse, so it may be easier to set up a render-to-texture setup with a cube map texture, and create your own geometry or shader to transform this into your desired configuration.

IRC dump with extra useful info:

[17:19] From what I understand the lens of ordinary OpenGL camera cannot go above 179 degrees. What I need is to render the scene at 195 degrees, and make it mappable to a custom projection mesh, similar to what VR devices need. Also, the center of the camera has to be set differently than center of screen. Is this is in any way possible with Panda? Even if two renders have to be made and somehow stitched together that will also work.
[17:22] Yes, it’s possible
[17:23] regnavoimi: either you could look up the documentation for NonlinearImager in Panda3D (there are some code samples in the forums) or you could use cube map rendering and then use a shader or piece of geometry to distort that into whwatever way you wish
[17:24] regnavoimi: CylindricalLens
[17:26] Thank you. Is there a way to change camera’s center? And is there much difference of using a 3d modelled meshe’s UV map for distortion rather than a shader? Many people use shaders for this but from what I understand both should be fast enough
[17:26] I had meant to reply to your post sooner, now I did. :stuck_out_tongue:
[17:26] What do you mean by a camera’s centre?
[17:27] I think people may find a shader easier, and with a shader you can precisely define the relationship as a mathematical formula so you are not dependent on the mesh being sufficiently tessellated
[17:27] Well, the FOV distortion is applied from center to the edges of the FOV right now, I want the center and the resulting distortion to be offsetted in X axis
[17:28] With a UV map you need the mesh to be tessellated enough for it to work, but it is potentially more efficient / may work better on older hardware
[17:28] I think you can change this in the lens
[17:28] You should poke into the API reference for the Lens class
[17:29] I think setFilmOffset can be used to create an off-axis rendering
[17:30] setFilmOffset
[17:30] you bet me to it
[17:30] If all else fails you can always specify your own projection mat with a MatrixLens
[17:31] thanks

Now that I think about this some more a fisheye lens will add a barrel distortion to the view, while the regular high FOV OpenGL camera adds a pincushion distortion.

These are quite different effects.
Can a non-fisheye lens be used for achieving wide FOV (>=180 degrees)?

The regular high FOV camera does not have any kind of distortion (let alone pincushion distortion), because straight lines are rendered as straight lines. You cannot go above 180° degrees with a regular perspective projection without adding some sort of distortion.

A fisheye projection can be used to create a >=180° FOV image, but there will be extreme distortion along the edges, more so than with eg. a cylindrical projection.

Perhaps you could explain what you are trying to achieve?

In the above image the distortion created by a Fisheye lens is the rightmost one (barrel distortion). I would need the one in the middle instead (pincushion distortion).

With barrel distortion objects in the middle appear bigger. With pincushion the opposite.
While fixed function OpenGL camera doesnt add curvature to FOV it looks more like pincushion (objects on the FOVs edges appear bigger/closer than the other way round)

from panda3d.core import *
import direct.directbase.DirectStart

mdl = loader.loadModel('environment')
mdl.reparentTo(render)

base.camLens.setFov(170)

run()