Fix T99565: Cycles reading TGA files with alpha different than Blender
Thanks to Lukas for tracking down the cause in OIIO.
This commit is contained in:
parent
5916e73b28
commit
94ec66c2f2
Notes:
blender-bot
2023-02-14 00:06:52 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3 Referenced by issue #99565, Discrepancy in Cycles rendering result appears when "Pack Resources" on tga file
|
@ -193,8 +193,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:
|
||||
|
|
Loading…
Reference in New Issue