[Bf-blender-cvs] [603a534f09b] master: Fix T101850: Cycles DDS oversaturation when alpha is in use

Aras Pranckevicius noreply at git.blender.org
Mon Oct 17 20:05:12 CEST 2022


Commit: 603a534f09b0f94f599c607240a4934f7c1a2ef6
Author: Aras Pranckevicius
Date:   Mon Oct 17 21:03:17 2022 +0300
Branches: master
https://developer.blender.org/rB603a534f09b0f94f599c607240a4934f7c1a2ef6

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

===================================================================

M	intern/cycles/scene/image_oiio.cpp

===================================================================

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;
+      }
     }
   }



More information about the Bf-blender-cvs mailing list