Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/scene/image_oiio.cpp')
-rw-r--r--intern/cycles/scene/image_oiio.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/intern/cycles/scene/image_oiio.cpp b/intern/cycles/scene/image_oiio.cpp
index 8792393e5a1..7bcf1ccb073 100644
--- a/intern/cycles/scene/image_oiio.cpp
+++ b/intern/cycles/scene/image_oiio.cpp
@@ -192,8 +192,22 @@ bool OIIOImageLoader::load_pixels(const ImageMetaData &metadata,
return false;
}
- const bool do_associate_alpha = associate_alpha &&
- spec.get_int_attribute("oiio:UnassociatedAlpha", 0);
+ bool do_associate_alpha = false;
+ if (associate_alpha) {
+ do_associate_alpha = spec.get_int_attribute("oiio:UnassociatedAlpha", 0);
+
+ 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;
+ }
+ }
+ }
switch (metadata.type) {
case IMAGE_DATA_TYPE_BYTE: