From 68b15fc3ad4f74be192150d3a2fb35e7ef2d4edd Mon Sep 17 00:00:00 2001 From: Lukas Stockner Date: Thu, 2 May 2019 15:45:31 +0200 Subject: Cycles: support loading images from arbitrary OpenColorIO color space These are the internal changes to Cycles, for Blender integration there are no functional changes in this commit. Images are converted to scene linear color space on file load, and on reading from the OpenImageIO texture cache. 8-bit images are compressed with the sRGB transfer function to avoid precision loss while keeping memory usages low. This also means that for common cases of 8-bit sRGB images no conversion happens at all on image loading. Initial patch by Lukas, completed by Brecht. Differential Revision: https://developer.blender.org/D3491 --- intern/cycles/blender/blender_session.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'intern/cycles/blender/blender_session.cpp') diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 3a7e5f02b1d..c50dbb6ba55 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -16,12 +16,13 @@ #include +#include "device/device.h" #include "render/background.h" #include "render/buffers.h" #include "render/camera.h" -#include "device/device.h" -#include "render/integrator.h" +#include "render/colorspace.h" #include "render/film.h" +#include "render/integrator.h" #include "render/light.h" #include "render/mesh.h" #include "render/object.h" @@ -1158,6 +1159,12 @@ void BlenderSession::builtin_image_info(const string &builtin_name, metadata.height = b_image.size()[1]; metadata.depth = 1; metadata.channels = b_image.channels(); + + if (metadata.is_float) { + /* Float images are already converted on the Blender side, + * no need to do anything in Cycles. */ + metadata.colorspace = u_colorspace_raw; + } } else if (b_id.is_a(&RNA_Object)) { /* smoke volume data */ -- cgit v1.2.3