Color information is lost on transparent pixels when using GenerateMipMaps
Llerd opened this issue · 3 comments
When using ::GenerateMipMaps to generate mipmaps on a texture with color-information stored in pixels that has a zero alpha-value, the color-information seems to be cleared. Is this intended behavior? I expected it to retain the color-information.
WIC uses premultiplied-alpha by default, which means 0 alpha will result in 0 R,G,B.
One option is to use TEX_FILTER_SEPARATE_ALPHA
which resizes the alpha independently from the color, which is typically used if the alpha channel is not actually alpha data and the pm alpha would destroy it.
Another option is to use TEX_FILTER_FORCE_NON_WIC
which avoids using WIC entirely for the filtering even in cases that can in theory work with it. These paths do not force the use of pm alpha.
Using TEX_FILTER_SEPARATE_ALPHA didn't help, and the color-data was still cleared.
TEX_FILTER_FORCE_NON_WIC worked as long as I didn't use the BOX filter (which did not work for non pow2 textures).
Thanks for the info!