[SOLVED] Generate seamless 360° panorama image

Hi guys!

Previously I was working with JOGL and I was able to generate seamless 360° panoramas just by taking screenshot, rotating to 45°, taking screenshot again … and then concatenating all the screenshots together.

Now I’m trying to get the same result with JME offscreen rendering. According to wiki.jmonkeyengine.org/doku.php/jme3:advanced:camera frame of view angle of the camera is 45°, so I tried to apply the same approach (sorry as a new user I can’t put images in posts directly):

It’s obvious that screenshots overlap, so 45° is not enough rotation. 60° is a bit better but still not perfect:

I wonder what is the right angle to rotate to make ideal seamless panoramas? Or is there anything wrong with my approach?

If some code could help, I’ve done the rotation by putting


to public void simpleRender(RenderManager rm) method of the Application where turns is:

private static Quaternion[] turns = new Quaternion[8];
    turns[0] = new Quaternion();turns[0].fromAngleAxis(FastMath.PI * 0 / 180, new Vector3f(0, 1, 0));
    turns[1] = new Quaternion();turns[1].fromAngleAxis(FastMath.PI * 45 / 180, new Vector3f(0, 1, 0));
    turns[2] = new Quaternion();turns[2].fromAngleAxis(FastMath.PI * 90 / 180, new Vector3f(0, 1, 0));
    turns[3] = new Quaternion();turns[3].fromAngleAxis(FastMath.PI * 135 / 180, new Vector3f(0, 1, 0));
    turns[4] = new Quaternion();turns[4].fromAngleAxis(FastMath.PI * 180 / 180, new Vector3f(0, 1, 0));
    turns[5] = new Quaternion();turns[5].fromAngleAxis(FastMath.PI * 225 / 180, new Vector3f(0, 1, 0));
    turns[6] = new Quaternion();turns[6].fromAngleAxis(FastMath.PI * 270 / 180, new Vector3f(0, 1, 0));
    turns[7] = new Quaternion();turns[7].fromAngleAxis(FastMath.PI * 315 / 180, new Vector3f(0, 1, 0));

Thanks a lot!

Note: this is vertical FoV… so if your view is not square then you will need to account for the aspect ratio.

Really, you probably want to set the frustum planes directly for something like this to avoid those sorts of issues. I think the shadow mapping for point lights already does this to make six seamless cameras pointing in all directions.

Yes, the EnvironmentCamera does this too in the PBRisComing branch on github.
Though it doesn’t really make a panorama, it makes a cube map, but you can adapt the code to your need.

@nehon @pspeed Thank you guys! Works like a charm now.

cam.setFrustumPerspective(45f, 1f, 1, 1000);

does the job