Does glGenerateMipmap perform its averaging in linear space for sRGB textures?

跟風遠走 提交于 2019-12-12 11:01:20

问题


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:

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.

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?


回答1:


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

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

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



来源:https://stackoverflow.com/questions/22348045/does-glgeneratemipmap-perform-its-averaging-in-linear-space-for-srgb-textures

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!