如何在opengl和cg着色器中使用3d纹理? [英] How to use 3d texture in opengl and cg shaders?

查看:105
本文介绍了如何在opengl和cg着色器中使用3d纹理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个3D纹理映射的问题。如果我有几个2D纹理,并且我想用这些2D纹理构建3D纹理。我能做些什么来将所有这些数据放在一起?函数glTexImage3D以一个参数const GLvoid * texels结束,这会导致纹理的数据。但是现在我有32个2D纹理,并且想要获得3D纹理。如何做到这一点?



第二个问题是关于图像空间过滤方法。有没有人知道它是什么?我应该使用这种方法来确定纹理坐标。

解决方案

你真的需要3D纹理吗?也许更好的方法是有纹理数组?



这里是一个很好的信息: http://www.opengl.org/wiki/Array_Texture



这比使用我认为的3D纹理更简单。它们对于级联阴影映射中的实例非常有用,其中每个级联都会转到纹理数组中的不同元素。


I've got a problem with 3d texture mapping. If I have several 2d textures, and I want to build a 3d texture with these 2d textures. What can I do to put all these data together? The function glTexImage3D ends with a parameter const GLvoid *texels which leads to the data of the texture. But now I have 32 2D textures and want to get a 3D texture. How to do that?

The second question is about image space filtering method. Is there anyone who knows what it is? I should use this method to determine texture coordinate.

解决方案

Do you really need 3D textures? maybe the better way is to have texture Arrays?

here is a good info: http://www.opengl.org/wiki/Array_Texture

it is a bit simpler than 3D textures to use I think. They are very useful for instance in cascaded shadow mapping where each cascade goes to different element in the array of textures.

这篇关于如何在opengl和cg着色器中使用3d纹理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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