Tuesday, 13 November 2018

OpenGL - Render scene as Mercator/Cylindrical

I have a scene built out of some triangles. In order to render it to an equirectangular image I just rendered it 6 times to 6 cubes, copied them to memory and using some cube2sphere code transformed it to an equirectangular image.

Is there a way to do that directly in the shader and save the time it takes to do this calculation on the CPU?

I found all kind of examples like some here but it seems to require a precalculated cubemap. And in my case I don't have it in advance, but want to generate it as part of the rendering.

Note: I also need to keep the depth map. So far I just converted it as well using the same sphere2cube (and a little factoring dependent on the angle) and it was fine.

Note2: I actually want Cylindrical/Mercator projection, and not equirectangular. But it's not very important.



from OpenGL - Render scene as Mercator/Cylindrical

No comments:

Post a Comment