Creating a 360° image

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating a 360° image

elect
Hi,

I need to generate a 360° image.

Looking over internet they suggest to do something similar to the cubemap, where you take a 90x90 degree "picture" of your scene in 6 directions.

What do you think?

Moreover, this is something that should be done in background, I mean the image deliver will be just a file so should I take in account the idea to generate it in the back buffer without the swapping, in another separate buffer or something else?
Reply | Threaded
Open this post in threaded view
|

Re: Creating a 360° image

Demoscene Passivist
Administrator
Sure, a cubemap is the easiest way to do it. I would suggest rendering to an/multiple FBOs. Most games use this technique to generate realtime reflections.
Reply | Threaded
Open this post in threaded view
|

Re: Creating a 360° image

elect
Demoscene Passivist wrote
Sure, a cubemap is the easiest way to do it. I would suggest rendering to
an/multiple FBOs. Most games use this technique to generate realtime
reflections.
Quoted from:
http://forum.jogamp.org/Creating-a-360-image-tp4028359p4028373.html

Ok, then I create a single FBO, I render in it the first image of 4 (because I dont need up and down), then I save it. Rhen the second and so on..

Just a question, if I use perspective view do you think I will obtain a good result? I mean, should I take 4 90x90° images, or better, lets say, 36 10x90° images?
Reply | Threaded
Open this post in threaded view
|

Re: Creating a 360° image

Demoscene Passivist
Administrator
Generally it would be better to render fewer pictures to avoid projection errors, so I would go for the FOV 90° view with 6 images. But if you use an external program to stitch the images together I guess using more images with smaller angles could help to get a better match.
Reply | Threaded
Open this post in threaded view
|

Re: Creating a 360° image

elect
If I just want to render my scene as I would do in the normal back buffer, do I need any attachments? Color/depth?

I am doing something like this at the init()

private void initPanoramicFBO(GL2 gl2) {
        //  Generate the FBO
        gl2.glGenFramebuffers(1, panoramicFBO, 0);
        //  Generate the rendering buffer
        gl2.glGenRenderbuffers(1, panoramicRenderBuffer, 0);
        //  Bind the render buffer
        gl2.glBindRenderbuffer(GL2.GL_RENDERBUFFER, panoramicRenderBuffer[0]);
        //  Allocate it
        gl2.glRenderbufferStorage(GL2.GL_RENDERBUFFER, GL2.GL_RGBA, 512, 512);
        //  Bind the FBO
        gl2.glBindFramebuffer(GL2.GL_DRAW_FRAMEBUFFER, panoramicFBO[0]);
        //  Attach the render buffer to the FBO
        gl2.glFramebufferRenderbuffer(GL2.GL_DRAW_FRAMEBUFFER, GL2.GL_COLOR_ATTACHMENT0,
                GL2.GL_RENDERBUFFER, panoramicRenderBuffer[0]);
}


Now I should save the content of the FBO to a file, but how? glReadPixels?
Reply | Threaded
Open this post in threaded view
|

Re: Creating a 360° image

Demoscene Passivist
Administrator
Sure, glReadPixels is fine (as performance is not that important in your case). Another very simple solution would be to render to the front buffer and then use the JOGL utility screenshot class to directly dump to an image.
Reply | Threaded
Open this post in threaded view
|

Re: Creating a 360° image

gouessej
Administrator
Why not using com.jogamp.opengl.util.GLReadBufferUtil?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Creating a 360° image

elect
In reply to this post by Demoscene Passivist
I solved with the Screenshot class. Thanks you both :)