[Bf-blender-cvs] [427b0a0ab2c] blender-v3.3-release: Fix T101850: Cycles DDS oversaturation when alpha is in use

Aras Pranckevicius noreply at git.blender.org
Thu Jan 12 22:26:57 CET 2023


Commit: 427b0a0ab2c6fdbba5fd7285b907e59ac946b4f7
Author: Aras Pranckevicius
Date:   Mon Oct 17 21:03:17 2022 +0300
Branches: blender-v3.3-release
https://developer.blender.org/rB427b0a0ab2c6fdbba5fd7285b907e59ac946b4f7

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 ea11e4da628..032b787bfba 100644
--- a/intern/cycles/scene/image_oiio.cpp
+++ b/intern/cycles/scene/image_oiio.cpp
@@ -197,11 +197,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