Skip to content

Color information is lost on transparent pixels when using GenerateMipMaps #27

Description

@Llerd

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.

Activity

  1. walbourn commented on Jul 4, 2016

    @walbourn
    Collaborator

    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.

  2. Llerd commented on Jul 4, 2016

    @Llerd
    Author

    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!

  3. walbourn commented on Jul 5, 2016

    @walbourn
    Collaborator

    Makes sense. With TEX_FILTER_SEPARATE_ALPHA, it is still using WIC for the color channel blending.

    The non-WIC version of TEX_FILTER_BOX requires power of 2. I'll note that on the wiki.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions