Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-03-09 17:38:17 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-03-23 17:21:58 +0300
commit7aab508e3273ae1762ae815bbecc8842938f0926 (patch)
tree94a0199e9eba3aea9da93cec1a4e053c2b61ffda /source/blender/imbuf
parent51727fe86fdeb1f01552afdac5a5d7b7ad4453b5 (diff)
Color Management: support different settings for render and compositing output
The Output Properties > Output panel now has a Color Management subpanel to override scene settings. When set to Override instead of Follow Scene, there are settings to: * For OpenEXR, choose a (linear) colorspace for RGBA passes * For other file formats, use different display/view/look/exposure/gamma These settings affect animation render output, image save of renders and the compositor file output node. Additionally, the image save operator and compositor file output nodes also support overriding color management. Includes some layout changes to the relevant panels to accomdate the new settings and to improve consistency. Ideally subpanels would be used to better organize these settings, however nodes and operators don't currently support creating subpanels. Differential Revision: https://developer.blender.org/D14402
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/IMB_colormanagement.h1
-rw-r--r--source/blender/imbuf/intern/colormanagement.c38
2 files changed, 36 insertions, 3 deletions
diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h
index a336cc1770a..7cf2c02e657 100644
--- a/source/blender/imbuf/IMB_colormanagement.h
+++ b/source/blender/imbuf/IMB_colormanagement.h
@@ -53,6 +53,7 @@ bool IMB_colormanagement_space_is_data(struct ColorSpace *colorspace);
bool IMB_colormanagement_space_is_scene_linear(struct ColorSpace *colorspace);
bool IMB_colormanagement_space_is_srgb(struct ColorSpace *colorspace);
bool IMB_colormanagement_space_name_is_data(const char *name);
+bool IMB_colormanagement_space_name_is_scene_linear(const char *name);
/**
* Convert a float RGB triplet to the correct luminance weighted average.
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 8624a7866b6..15a586ea762 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -1394,6 +1394,12 @@ bool IMB_colormanagement_space_name_is_data(const char *name)
return (colorspace && colorspace->is_data);
}
+bool IMB_colormanagement_space_name_is_scene_linear(const char *name)
+{
+ ColorSpace *colorspace = colormanage_colorspace_get_named(name);
+ return (colorspace && IMB_colormanagement_space_is_scene_linear(colorspace));
+}
+
const float *IMB_colormanagement_get_xyz_to_rgb()
{
return &imbuf_xyz_to_rgb[0][0];
@@ -2444,9 +2450,13 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf,
ibuf->userflags &= ~(IB_RECT_INVALID | IB_DISPLAY_BUFFER_INVALID);
}
- const bool do_colormanagement = save_as_render && (is_movie || !requires_linear_float);
+ const bool do_colormanagement_display = save_as_render && (is_movie || !requires_linear_float);
+ const bool do_colormanagement_linear = save_as_render && requires_linear_float &&
+ imf->linear_colorspace_settings.name[0] &&
+ !IMB_colormanagement_space_name_is_scene_linear(
+ imf->linear_colorspace_settings.name);
- if (do_colormanagement || do_alpha_under) {
+ if (do_colormanagement_display || do_colormanagement_linear || do_alpha_under) {
if (allocate_result) {
colormanaged_ibuf = IMB_dupImBuf(ibuf);
}
@@ -2499,7 +2509,8 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf,
}
}
- if (do_colormanagement) {
+ if (do_colormanagement_display) {
+ /* Color management with display and view transform. */
bool make_byte = false;
/* for proper check whether byte buffer is required by a format or not
@@ -2532,6 +2543,27 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf,
&imf->view_settings, &imf->display_settings);
}
}
+ else if (do_colormanagement_linear) {
+ /* Color management transform to another linear color space. */
+ if (!colormanaged_ibuf->rect_float) {
+ IMB_float_from_rect(colormanaged_ibuf);
+ imb_freerectImBuf(colormanaged_ibuf);
+ }
+
+ if (colormanaged_ibuf->rect_float) {
+ const char *from_colorspace = (ibuf->float_colorspace) ? ibuf->float_colorspace->name :
+ global_role_scene_linear;
+ const char *to_colorspace = imf->linear_colorspace_settings.name;
+
+ IMB_colormanagement_transform(colormanaged_ibuf->rect_float,
+ colormanaged_ibuf->x,
+ colormanaged_ibuf->y,
+ colormanaged_ibuf->channels,
+ from_colorspace,
+ to_colorspace,
+ false);
+ }
+ }
if (colormanaged_ibuf != ibuf) {
IMB_metadata_copy(colormanaged_ibuf, ibuf);