diff options
author | Aras Pranckevicius <aras@nesnausk.org> | 2022-10-17 21:03:17 +0300 |
---|---|---|
committer | Aras Pranckevicius <aras@nesnausk.org> | 2022-10-17 21:03:37 +0300 |
commit | 603a534f09b0f94f599c607240a4934f7c1a2ef6 (patch) | |
tree | e9f1dfa622e8d7a1588f763a2f73b47fbfb7e2ba /intern/cycles | |
parent | 728451f01ad5eec6abdc4f54364fe82490b151c5 (diff) |
Fix T101850: Cycles DDS oversaturation when alpha is in use
DDS files coming through OIIO needed a similar treatment as TGA in
T99565; just for DDS OIIO just never set the "unassociated alpha"
attribute. Fixes T101850.
Reviewed By: Brecht Van Lommel
Differential Revision: https://developer.blender.org/D16270
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/scene/image_oiio.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/intern/cycles/scene/image_oiio.cpp b/intern/cycles/scene/image_oiio.cpp index d59359970c6..7bcf1ccb073 100644 --- a/intern/cycles/scene/image_oiio.cpp +++ b/intern/cycles/scene/image_oiio.cpp @@ -196,11 +196,16 @@ bool OIIOImageLoader::load_pixels(const ImageMetaData &metadata, if (associate_alpha) { do_associate_alpha = spec.get_int_attribute("oiio:UnassociatedAlpha", 0); - /* Workaround OIIO not detecting TGA file alpha the same as Blender (since #3019). - * We want anything not marked as premultiplied alpha to get associated. */ - if (!do_associate_alpha && spec.alpha_channel != -1 && - strcmp(in->format_name(), "targa") == 0) { - do_associate_alpha = spec.get_int_attribute("targa:alpha_type", -1) != 4; + if (!do_associate_alpha && spec.alpha_channel != -1) { + /* Workaround OIIO not detecting TGA file alpha the same as Blender (since #3019). + * We want anything not marked as premultiplied alpha to get associated. */ + if (strcmp(in->format_name(), "targa") == 0) { + do_associate_alpha = spec.get_int_attribute("targa:alpha_type", -1) != 4; + } + /* OIIO DDS reader never sets UnassociatedAlpha attribute. */ + if (strcmp(in->format_name(), "dds") == 0) { + do_associate_alpha = true; + } } } |