[Bf-blender-cvs] [15b2b53b87a] blender-v3.3-release: Fix T92416: First render with unknown image colorspace looks different

Lukas Stockner noreply at git.blender.org
Thu Nov 17 16:45:16 CET 2022


Commit: 15b2b53b87ab088e4869dfb0af991c9eb2be2d68
Author: Lukas Stockner
Date:   Tue Nov 8 22:05:20 2022 +0100
Branches: blender-v3.3-release
https://developer.blender.org/rB15b2b53b87ab088e4869dfb0af991c9eb2be2d68

Fix T92416: First render with unknown image colorspace looks different

The issue here was that the Barbershop benchmark scene was saved with a
custom OCIO config, which leads to some textures having a unknown
colorspace when loading with a default installation.

This is automatically fixed by Blender during image loading, but since
Cycles queried the colorspace before actually loading the image, it
didn't get the updated value in the first render.

To fix this, just re-query the colorspace after the image is loaded.

Note that non-packed images still get treated as raw data if the
colorspace is unknown, but this is at least consistent and doesn't
magically change when you press F12 a second time.

Differential Revision: https://developer.blender.org/D16427

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

M	intern/cycles/blender/image.cpp

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

diff --git a/intern/cycles/blender/image.cpp b/intern/cycles/blender/image.cpp
index aea79ad60ad..ecea06fb1cd 100644
--- a/intern/cycles/blender/image.cpp
+++ b/intern/cycles/blender/image.cpp
@@ -72,6 +72,11 @@ bool BlenderImageLoader::load_metadata(const ImageDeviceFeatures &, ImageMetaDat
     metadata.colorspace = u_colorspace_raw;
   }
   else {
+    /* In some cases (e.g. T94135), the colorspace setting in Blender gets updated as part of the
+     * metadata queries in this function, so update the colorspace setting here. */
+    PointerRNA colorspace_ptr = b_image.colorspace_settings().ptr;
+    metadata.colorspace = get_enum_identifier(colorspace_ptr, "name");
+
     if (metadata.channels == 1) {
       metadata.type = IMAGE_DATA_TYPE_BYTE;
     }



More information about the Bf-blender-cvs mailing list