[Bf-blender-cvs] [be967c0b3c7] master: Fix T64578: Cycles clamps HDR colors for 16bit integer image with colorspace

Brecht Van Lommel noreply at git.blender.org
Tue May 14 11:23:54 CEST 2019


Commit: be967c0b3c7ed898a061519b86aec1df7aa2c088
Author: Brecht Van Lommel
Date:   Tue May 14 11:22:07 2019 +0200
Branches: master
https://developer.blender.org/rBbe967c0b3c7ed898a061519b86aec1df7aa2c088

Fix T64578: Cycles clamps HDR colors for 16bit integer image with colorspace

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

M	intern/cycles/render/image.cpp

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

diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index 9f2a5e57d42..cf1c5fbb446 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -186,6 +186,15 @@ void ImageManager::metadata_detect_colorspace(ImageMetaData &metadata, const cha
      * due to quantization in common cases. */
     metadata.compress_as_srgb = (metadata.type == IMAGE_DATA_TYPE_BYTE ||
                                  metadata.type == IMAGE_DATA_TYPE_BYTE4);
+
+    /* If colorspace conversion needed, use half instead of short so we can
+     * represent HDR values that might result from conversion. */
+    if (metadata.type == IMAGE_DATA_TYPE_USHORT) {
+      metadata.type = IMAGE_DATA_TYPE_HALF;
+    }
+    else if (metadata.type == IMAGE_DATA_TYPE_USHORT4) {
+      metadata.type = IMAGE_DATA_TYPE_HALF4;
+    }
   }
 }



More information about the Bf-blender-cvs mailing list