简体   繁体   English

OpenGL - 如何将对象渲染为3D纹理作为体积广告牌

[英]OpenGL - how to render object to 3D texture as a volumetric billboard

I'm trying to implement volumetric billboards in OpenGL 3.3+ as described here and video here . 我想实现在OpenGL立体广告牌3.3+描述这里和视频在这里 The problem I'm facing now (quite basic) is: how do I render a 3D object to a 3D texture (as described in the paper) efficiently ? 我现在面临的(很基本的)问题是:我怎么渲染3D对象的3D纹理有效 (如本文所述)? Assuming the object could be stored in a 256x256x128 tex creating 256*256*128*2 framebuffers (because it's said that it should be rendered twice at each axis: +X,-X,+Y,-Y,+Z,-Z ) would be insane and there are too few texture units to process that many textures as far as I know (not to mention the amount of time needed). 假设对象可以存储在256x256x128 tex中,创建256*256*128*2帧缓冲区(因为据说它应该在每个轴上渲染两次: +X,-X,+Y,-Y,+Z,-Z )就像我所知,纹理单元太少而无法处理那么多纹理(更不用说所需的时间)了。

Does anyone have any idea how to deal with something like that? 有没有人知道如何处理这样的事情?

A slice of 3D texture can be directly attached to the current framebuffer. 一片3D纹理可以直接附加到当前帧缓冲区。 So, create a frame buffer, a 3D texture and then do rendering like: 因此,创建一个帧缓冲区,一个3D纹理,然后执行渲染,如:

glFramebufferTexture3D( GL_FRAMEBUFFER, Attachment, GL_TEXTURE_3D,
                        TextureID, 0, ZSlice );
...render to the slice of 3D texture...

So, you need only 1 framebuffer that will be iterated by the number of Z-slices in your target 3D texture. 因此,您只需要1个帧缓冲区,它将通过目标3D纹理中的Z切片数量进行迭代。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM