是否可以使用自定义 mipmap 大小?
我目前正在研究某种虚拟纹理的实现。 mipmap 级别用作细节级别控制结构。 (虚拟纹理中的每个纹素都与“真实”纹理中的数据块相关。)
数据存在于多个细节级别中,这导致虚拟纹理中的块计数不同。
示例:
level size of data number of blocks
0 60 4
1 30 2
2 15 1
我的想法是为虚拟纹理中的每个细节级别调用 glTexImage 以创建不同的 mipmap 级别。
问题是,尽管创建或更新/加载时没有错误,但我无法从纹理中获取任何数据。仅创建基本级别并调用 glGenerateMipmap 工作正常,但会导致某些基本尺寸的尺寸错误。 (从技术上讲,它们是正确的,但在我的情况下不是)
我在某处读到 mipmap 级别大小必须除以二(或除以二和地板)。
问题:
- 是否可以加载“自定义”mipmap 级别?
- mipmap 级别大小是否有任何限制?
i am currently working on some kind of virtual texture implementation. The mipmap levels are used as a level of detail controlling structure. (Every texel in the virtual texture relates to a block of data in the 'real' texture.)
The data exists in several detail levels which result in different block counts in the virtual texture.
Example:
level size of data number of blocks
0 60 4
1 30 2
2 15 1
My idea was to call glTexImage for every detail level in the virtual texture to create the different mipmap levels.
The problem is that altough there are no errors when creating or updating/loading i can't get any data from the texture. Creating only the base level and calling glGenerateMipmap works fine but results in the wrong sizes for some base sizes. (technically they are correct, but not in my case)
I read somewhere that mipmap level sizes must be a division by two (or by two and floor).
The questions:
- Is it possible to load 'custom' mipmap levels?
- Are there any constrains mipmap level sizes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以加载自定义 mipmap 级别,但无法选择其大小。 OpenGL 指定了它期望的级别的 MipMap 大小,并且不允许偏离它。
以宽度为例,mipmap level
i
所需的宽度为max(1, Floor(w_b / 2^i))
,其中 w_b 是第一个 mip 的宽度水平(基础)。其他尺寸也是如此(GL 规范 2.1,第 3.8.8 节,mipmapping 段落)。You can load custom mipmap levels, but cannot choose their sizes. OpenGL specifies what MipMap sizes for levels it expects and does not allow deviation from it.
Taking width as example, the required width for mipmap level
i
ismax(1, floor(w_b / 2^i))
, where w_b is the width of the first mip level (the base). It is the same for the other dimensions (GL spec 2.1, section 3.8.8, paragraph mipmapping).确保您将 mipmap 级别一直加载到 1x1。请参阅此处。
Make sure you loaded mipmap levels all the way down to 1x1. See here.