glGenerateMipmap是否在sRGB纹理的线性空间中执行平均? [英] Does glGenerateMipmap perform its averaging in linear space for sRGB textures?

查看:128
本文介绍了glGenerateMipmap是否在sRGB纹理的线性空间中执行平均?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OpenGL 3.3规范似乎并没有要求在线性空间中完成mipmap的生成.我只能找到以下内容:

The OpenGL 3.3 specification does not seem to ask that the mipmap generation be done in linear space. All I can find is the following:

派生的mipmap数组的内部格式都与 levelbase数组,然后是派生数组的尺寸 3.8.14节中描述的要求.的内容 派生的数组是通过对 levelbase数组.对于一维和二维数组纹理,每个 层被独立过滤.没有特定的过滤器算法 是必需的,尽管建议使用盒式过滤器作为默认过滤器.

The internal formats of the derived mipmap arrays all match those of the levelbase array, and the dimensions of the derived arrays follow the requirements described in section 3.8.14. The contents of the derived arrays are computed by repeated, filtered reduction of the levelbase array. For one- and two-dimensional array textures, each layer is filtered independently. No particular filter algorithm is required, though a box filter is recommended as the default filter.

我知道,如果原始图像位于sRGB中,则调用glGenerateMipMap的结果位于sRGB中,对此我没有任何问题.但是两者之间会发生什么呢?当然,我们不想平均对数刻度上的颜色.那是特定于实现的吗?

I understand that the result of calling glGenerateMipMap is in sRGB if the original image is in sRGB and I have no problem with that. But what happens in-between? Surely we do not want to average colors that are on a log scale. Is that implementation-specific?

推荐答案

相关答案可以在OpenGL规范第3.8.17节中找到:

The relevant answer can be found in the OpenGL specification section 3.8.17:

3.8.17 sRGB纹理颜色转换

如果当前绑定的纹理的内部格式是SRGB,SRGB8,SRGB_ALPHA, SRGB8_ALPHA8,COMPRESSED_SRGB或COMPRESSED_SRGB_ALPHA, 将红色,绿色和蓝色分量从sRGB颜色空间转换为 线性色彩空间作为过滤的一部分,在 3.8.11 3.8.12 部分中进行了介绍.任何 alpha分量保持不变.理想情况下,实现应执行此操作 在过滤之前对每个样本进行颜色转换,但可以实现

3.8.17 sRGB Texture Color Conversion

If the currently bound texture’s internal format is one of SRGB,SRGB8,SRGB_ALPHA, SRGB8_ALPHA8, COMPRESSED_SRGB, or COMPRESSED_SRGB_ALPHA, the red, green, and blue components are converted from an sRGB color space to a linear color space as part of filtering described in sections 3.8.11 and 3.8.12. Any alpha component is left unchanged. Ideally, implementations should perform this color conversion on each sample prior to filtering but implementations are allowed

在3.8.11节中描述了Mipmap的生成,因此可以对颜色空间进行线性化处理.

Mipmap generation is described in section 3.8.11 and hence is subject to color space linearization.

这篇关于glGenerateMipmap是否在sRGB纹理的线性空间中执行平均?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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