如何在opengl中制作360度视频输出 [英] How to make 360 video output in opengl

查看:60
本文介绍了如何在opengl中制作360度视频输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要使用球形投影的 OpenGL 输出来制作 360 度全景视频.

i want to have OpenGL output with spherical projection for make 360 video.

现在我有立方体贴图面,它们是用 6 个透视相机生成的.

now i have cube map faces and they are generated with 6 perspective cameras.

我需要这样的东西:

我怎样才能得到这个输出?

how can i have this output?

有什么想法吗?

推荐答案

这取决于您希望使用的确切投影.对于简单的球形投影,您可以使用以下片段着色器将四边形渲染到目标纹理中:

It depends on the exact projection you are expected to use. For a simple spherical projection you render a quad into your destination texture with the following fragment shader:

uniform samplerCube tex;
in vec2 texcoord;
out vec4 OUT;

void main() {
    vec3 d = vec3(
        cos(texcoord[0])*cos(texcoord[1]),
        sin(texcoord[0])*cos(texcoord[1]),
        sin(texcoord[1])
    );
    OUT = texture(tex, d);
}

texcoord 应在左下角的 (-tau/2,-tau/4)(tau/2, tau/4) 在右上角.

texcoord shall vary between (-tau/2,-tau/4) in bottom left corner and (tau/2, tau/4) in top right corner.

这篇关于如何在opengl中制作360度视频输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆