From be967c0b3c7ed898a061519b86aec1df7aa2c088 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 14 May 2019 11:22:07 +0200 Subject: Fix T64578: Cycles clamps HDR colors for 16bit integer image with colorspace --- intern/cycles/render/image.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'intern') 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; + } } } -- cgit v1.2.3