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
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-10-17 15:20:42 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-10-17 15:34:25 +0300
commit0a35afbf86c86963ebb638f0804a706d17df5b50 (patch)
tree9241470ac572f64beff874a8551f83573f30a1ff /intern
parent3eaf2b7fc69668cacd4ddb221faf90e60736015e (diff)
Fix T99565: Cycles reading TGA files with alpha different than Blender
Thanks to Lukas for tracking down the cause in OIIO.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/scene/image_oiio.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/intern/cycles/scene/image_oiio.cpp b/intern/cycles/scene/image_oiio.cpp
index 8792393e5a1..d59359970c6 100644
--- a/intern/cycles/scene/image_oiio.cpp
+++ b/intern/cycles/scene/image_oiio.cpp
@@ -192,8 +192,17 @@ 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);
+
+ /* 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;
+ }
+ }
switch (metadata.type) {
case IMAGE_DATA_TYPE_BYTE: