Color Management: Remove "High Dynamic Range" setting
This was a temporary solution until we had proper HDR displays. * Auto detect from the display + view transform if they are HDR, and enable it automatically. This is based on encoding hdr-video in the config. * If a HDR transform is selected and there is no HDR display support, an info message will be shown in the color management panel. * It is now possible to view HDR images in the image editor, without needing to use "View as Render". * There is no versioning to switch to a HDR display, because that also affects image saving. So users will have to manually select the "Rec.2100 PQ" display to see HDR colors again. Ref #144911 Pull Request: https://projects.blender.org/blender/blender/pulls/144565
This commit is contained in:
@@ -76,6 +76,13 @@ class RENDER_PT_color_management(RenderButtonsPanel, Panel):
|
||||
col.prop(view, "view_transform")
|
||||
col.prop(view, "look")
|
||||
|
||||
if view.is_hdr:
|
||||
import gpu
|
||||
if not gpu.capabilities.hdr_support_get():
|
||||
row = col.split(factor=0.4)
|
||||
row.label()
|
||||
row.label(text="HDR display not supported", icon="INFO")
|
||||
|
||||
col = flow.column()
|
||||
col.prop(view, "exposure")
|
||||
col.prop(view, "gamma")
|
||||
@@ -85,37 +92,6 @@ class RENDER_PT_color_management(RenderButtonsPanel, Panel):
|
||||
col.prop(scene.sequencer_colorspace_settings, "name", text="Sequencer")
|
||||
|
||||
|
||||
class RENDER_PT_color_management_display_settings(RenderButtonsPanel, Panel):
|
||||
bl_label = "Display"
|
||||
bl_parent_id = "RENDER_PT_color_management"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
COMPAT_ENGINES = {
|
||||
'BLENDER_RENDER',
|
||||
'BLENDER_EEVEE',
|
||||
'BLENDER_WORKBENCH',
|
||||
}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False # No animation.
|
||||
|
||||
scene = context.scene
|
||||
view = scene.view_settings
|
||||
|
||||
# Only enable display sub-section if HDR support is available.
|
||||
import gpu
|
||||
layout.enabled = gpu.capabilities.hdr_support_get()
|
||||
|
||||
# Only display HDR toggle for non-Filmic display transforms.
|
||||
col = layout.column(align=True)
|
||||
sub = col.row()
|
||||
sub.active = (not view.view_transform.startswith("Filmic") and not view.view_transform.startswith("AgX") and not
|
||||
view.view_transform.startswith("False Color") and not
|
||||
view.view_transform.startswith("Khronos PBR Neutral"))
|
||||
sub.prop(view, "use_hdr_view")
|
||||
|
||||
|
||||
class RENDER_PT_color_management_curves(RenderButtonsPanel, Panel):
|
||||
bl_label = "Curves"
|
||||
bl_parent_id = "RENDER_PT_color_management"
|
||||
@@ -1138,7 +1114,6 @@ classes = (
|
||||
RENDER_PT_opengl_film,
|
||||
RENDER_PT_hydra_debug,
|
||||
RENDER_PT_color_management,
|
||||
RENDER_PT_color_management_display_settings,
|
||||
RENDER_PT_color_management_curves,
|
||||
RENDER_PT_color_management_white_balance_presets,
|
||||
RENDER_PT_color_management_white_balance,
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "BKE_colortools.hh"
|
||||
|
||||
#include "DNA_color_types.h"
|
||||
#include "IMB_colormanagement.hh"
|
||||
|
||||
#include "DNA_vec_types.h"
|
||||
@@ -289,7 +290,8 @@ void GPU_viewport_colorspace_set(GPUViewport *viewport,
|
||||
viewport->dither = dither;
|
||||
viewport->do_color_management = true;
|
||||
viewport->use_hdr = GPU_hdr_support() &&
|
||||
((viewport->view_settings.flag & COLORMANAGE_VIEW_USE_HDR) != 0);
|
||||
IMB_colormanagement_display_is_hdr(&viewport->display_settings,
|
||||
viewport->view_settings.view_transform);
|
||||
}
|
||||
|
||||
void GPU_viewport_force_hdr(GPUViewport *viewport)
|
||||
|
||||
@@ -3638,7 +3638,8 @@ bool IMB_colormanagement_setup_glsl_draw_from_space(
|
||||
display_parameters.use_predivide = predivide;
|
||||
display_parameters.do_overlay_merge = do_overlay_merge;
|
||||
display_parameters.use_hdr = GPU_hdr_support() &&
|
||||
(applied_view_settings->flag & COLORMANAGE_VIEW_USE_HDR) != 0;
|
||||
IMB_colormanagement_display_is_hdr(display_settings,
|
||||
display_parameters.view.c_str());
|
||||
display_parameters.use_display_emulation = true;
|
||||
|
||||
/* Bind shader. Internally GPU shaders are created and cached on demand. */
|
||||
|
||||
@@ -220,6 +220,6 @@ typedef struct ColorManagedColorspaceSettings {
|
||||
/** #ColorManagedViewSettings.flag */
|
||||
enum {
|
||||
COLORMANAGE_VIEW_USE_CURVES = (1 << 0),
|
||||
COLORMANAGE_VIEW_USE_HDR = (1 << 1),
|
||||
COLORMANAGE_VIEW_USE_DEPRECATED = (1 << 1),
|
||||
COLORMANAGE_VIEW_USE_WHITE_BALANCE = (1 << 2),
|
||||
};
|
||||
|
||||
@@ -638,6 +638,20 @@ static void rna_ColorManagedViewSettings_whitepoint_set(PointerRNA *ptr, const f
|
||||
IMB_colormanagement_set_whitepoint(value, view_settings->temperature, view_settings->tint);
|
||||
}
|
||||
|
||||
static bool rna_ColorManagedViewSettings_is_hdr_get(PointerRNA *ptr)
|
||||
{
|
||||
ColorManagedViewSettings *view_settings = (ColorManagedViewSettings *)ptr->data;
|
||||
if (GS(ptr->owner_id->name) != ID_SCE) {
|
||||
return false;
|
||||
}
|
||||
const Scene *scene = reinterpret_cast<const Scene *>(ptr->owner_id);
|
||||
if (&scene->view_settings != view_settings) {
|
||||
return false;
|
||||
}
|
||||
return IMB_colormanagement_display_is_hdr(&scene->display_settings,
|
||||
view_settings->view_transform);
|
||||
}
|
||||
|
||||
static bool rna_ColorManagedColorspaceSettings_is_data_get(PointerRNA *ptr)
|
||||
{
|
||||
ColorManagedColorspaceSettings *colorspace = (ColorManagedColorspaceSettings *)ptr->data;
|
||||
@@ -1430,15 +1444,11 @@ static void rna_def_colormanage(BlenderRNA *brna)
|
||||
"(automatically converted to/from temperature and tint)");
|
||||
RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_hdr_view", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", COLORMANAGE_VIEW_USE_HDR);
|
||||
prop = RNA_def_property(srna, "is_hdr", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"High Dynamic Range",
|
||||
"Enable high dynamic range display in rendered viewport, uncapping display brightness. This "
|
||||
"requires a monitor with HDR support and a view transform designed for HDR. "
|
||||
"'Filmic' and 'AgX' do not generate HDR colors.");
|
||||
RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update");
|
||||
prop, "Is HDR", "The display and view transform supports high dynamic range colors");
|
||||
RNA_def_property_boolean_funcs(prop, "rna_ColorManagedViewSettings_is_hdr_get", nullptr);
|
||||
|
||||
/* ** Color-space ** */
|
||||
srna = RNA_def_struct(brna, "ColorManagedInputColorspaceSettings", nullptr);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <cstring>
|
||||
|
||||
#include "DNA_camera_types.h"
|
||||
#include "DNA_color_types.h"
|
||||
#include "DNA_listBase.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
@@ -698,13 +699,18 @@ static void wm_draw_offscreen_texture_parameters(GPUOffScreen *offscreen)
|
||||
|
||||
static blender::gpu::TextureFormat get_hdr_framebuffer_format(const Scene *scene)
|
||||
{
|
||||
bool use_hdr = false;
|
||||
if (scene && ((scene->view_settings.flag & COLORMANAGE_VIEW_USE_HDR) != 0)) {
|
||||
use_hdr = GPU_hdr_support();
|
||||
bool use_float = false;
|
||||
|
||||
if (scene && ((IMB_colormanagement_display_is_hdr(&scene->display_settings,
|
||||
scene->view_settings.view_transform)) ||
|
||||
IMB_colormanagement_display_is_wide_gamut(&scene->display_settings,
|
||||
scene->view_settings.view_transform)))
|
||||
{
|
||||
use_float = GPU_hdr_support();
|
||||
}
|
||||
blender::gpu::TextureFormat desired_format =
|
||||
(use_hdr) ? blender::gpu::TextureFormat::SFLOAT_16_16_16_16 :
|
||||
blender::gpu::TextureFormat::UNORM_8_8_8_8;
|
||||
(use_float) ? blender::gpu::TextureFormat::SFLOAT_16_16_16_16 :
|
||||
blender::gpu::TextureFormat::UNORM_8_8_8_8;
|
||||
return desired_format;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user