diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-07-30 16:44:25 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-07-30 19:51:15 +0300 |
commit | c86b5fa820d181c2beabdf4147ac17cb6ff8149b (patch) | |
tree | 4fc26cc4ff4e0cf024a9c15a72b123a67157a8c2 /source/blender/draw/engines | |
parent | 2e2e7aff7cb28337684534d2207816946407788b (diff) |
Viewport: use Filmic without scene exposure/gamma/curves for workbench.
This ignores the scene color managment view settings for solid mode and
lookdev when not using scene lights and world. The scene settings are
intended for tweaking renders and should not affect studio lighting and
matcaps.
There may be cases where a simple sRGB transform is better than Filmic
and we could add configuration for this. Not sure if it really matters
and it may be better if we just assume matcaps and studiolights are all
created for one view transform.
Differential Revision: https://developer.blender.org/D3569
Diffstat (limited to 'source/blender/draw/engines')
5 files changed, 28 insertions, 16 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index adbe165354a..8c66ba057b5 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -66,6 +66,7 @@ static void eevee_engine_init(void *ved) /* Alloc transient pointers */ stl->g_data = MEM_callocN(sizeof(*stl->g_data), __func__); } + stl->g_data->use_color_view_settings = USE_SCENE_LIGHT(v3d) || !LOOK_DEV_STUDIO_LIGHT_ENABLED(v3d); stl->g_data->background_alpha = DRW_state_draw_background() ? 1.0f : 0.0f; stl->g_data->valid_double_buffer = (txl->color_double_buffer != NULL); @@ -316,37 +317,39 @@ static void eevee_draw_background(void *vedata) /* Tonemapping and transfer result to default framebuffer. */ + bool use_view_settings = stl->g_data->use_color_view_settings; + GPU_framebuffer_bind(dfbl->default_fb); - DRW_transform_to_display(stl->effects->final_tx); + DRW_transform_to_display(stl->effects->final_tx, use_view_settings); /* Debug : Ouput buffer to view. */ switch (G.debug_value) { case 1: - if (txl->maxzbuffer) DRW_transform_to_display(txl->maxzbuffer); + if (txl->maxzbuffer) DRW_transform_to_display(txl->maxzbuffer, use_view_settings); break; case 2: - if (effects->ssr_pdf_output) DRW_transform_to_display(effects->ssr_pdf_output); + if (effects->ssr_pdf_output) DRW_transform_to_display(effects->ssr_pdf_output, use_view_settings); break; case 3: - if (effects->ssr_normal_input) DRW_transform_to_display(effects->ssr_normal_input); + if (effects->ssr_normal_input) DRW_transform_to_display(effects->ssr_normal_input, use_view_settings); break; case 4: - if (effects->ssr_specrough_input) DRW_transform_to_display(effects->ssr_specrough_input); + if (effects->ssr_specrough_input) DRW_transform_to_display(effects->ssr_specrough_input, use_view_settings); break; case 5: - if (txl->color_double_buffer) DRW_transform_to_display(txl->color_double_buffer); + if (txl->color_double_buffer) DRW_transform_to_display(txl->color_double_buffer, use_view_settings); break; case 6: - if (effects->gtao_horizons_debug) DRW_transform_to_display(effects->gtao_horizons_debug); + if (effects->gtao_horizons_debug) DRW_transform_to_display(effects->gtao_horizons_debug, use_view_settings); break; case 7: - if (effects->gtao_horizons) DRW_transform_to_display(effects->gtao_horizons); + if (effects->gtao_horizons) DRW_transform_to_display(effects->gtao_horizons, use_view_settings); break; case 8: - if (effects->sss_data) DRW_transform_to_display(effects->sss_data); + if (effects->sss_data) DRW_transform_to_display(effects->sss_data, use_view_settings); break; case 9: - if (effects->velocity_tx) DRW_transform_to_display(effects->velocity_tx); + if (effects->velocity_tx) DRW_transform_to_display(effects->velocity_tx, use_view_settings); break; default: break; diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index 349a27a1765..bd1323dab3b 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -774,6 +774,9 @@ typedef struct EEVEE_PrivateData { /* Mist Settings */ float mist_start, mist_inv_dist, mist_falloff; + + /* Color Management */ + bool use_color_view_settings; } EEVEE_PrivateData; /* Transient data */ /* eevee_data.c */ diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c index 24eb0f38a46..2b716b8ffe3 100644 --- a/source/blender/draw/engines/workbench/workbench_data.c +++ b/source/blender/draw/engines/workbench/workbench_data.c @@ -21,14 +21,17 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd) View3D *v3d = draw_ctx->v3d; if (!v3d) { wpd->shading = scene->display.shading; + wpd->use_color_view_settings = true; } else if (v3d->shading.type == OB_RENDER && BKE_scene_uses_blender_opengl(scene)) { wpd->shading = scene->display.shading; + wpd->use_color_view_settings = true; } else { wpd->shading = v3d->shading; + wpd->use_color_view_settings = false; } if (wpd->shading.light == V3D_LIGHTING_MATCAP) { diff --git a/source/blender/draw/engines/workbench/workbench_effect_aa.c b/source/blender/draw/engines/workbench/workbench_effect_aa.c index 6269496f568..deb9a517f96 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_aa.c +++ b/source/blender/draw/engines/workbench/workbench_effect_aa.c @@ -56,7 +56,7 @@ void workbench_aa_create_pass(WORKBENCH_Data *vedata, GPUTexture **tx) } } -static void workspace_aa_draw_transform(GPUTexture *tx) +static void workspace_aa_draw_transform(GPUTexture *tx, WORKBENCH_PrivateData *wpd) { if (DRW_state_is_image_render()) { /* Linear result for render. */ @@ -64,7 +64,7 @@ static void workspace_aa_draw_transform(GPUTexture *tx) } else { /* Display space result for viewport. */ - DRW_transform_to_display(tx); + DRW_transform_to_display(tx, wpd->use_color_view_settings); } } @@ -79,7 +79,7 @@ void workbench_aa_draw_pass(WORKBENCH_Data *vedata, GPUTexture *tx) DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get(); if (FXAA_ENABLED(wpd)) { GPU_framebuffer_bind(fbl->effect_fb); - workspace_aa_draw_transform(tx); + workspace_aa_draw_transform(tx, wpd); GPU_framebuffer_bind(dfbl->color_only_fb); DRW_draw_pass(psl->effect_aa_pass); } @@ -92,11 +92,11 @@ void workbench_aa_draw_pass(WORKBENCH_Data *vedata, GPUTexture *tx) */ if (effect_info->jitter_index == 1) { GPU_framebuffer_bind(dfbl->color_only_fb); - workspace_aa_draw_transform(tx); + workspace_aa_draw_transform(tx, wpd); } else { GPU_framebuffer_bind(fbl->effect_fb); - workspace_aa_draw_transform(tx); + workspace_aa_draw_transform(tx, wpd); GPU_framebuffer_bind(dfbl->color_only_fb); DRW_draw_pass(psl->effect_aa_pass); } @@ -104,6 +104,6 @@ void workbench_aa_draw_pass(WORKBENCH_Data *vedata, GPUTexture *tx) } else { GPU_framebuffer_bind(dfbl->color_only_fb); - workspace_aa_draw_transform(tx); + workspace_aa_draw_transform(tx, wpd); } } diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h index dc2894f0207..10ea0152b90 100644 --- a/source/blender/draw/engines/workbench/workbench_private.h +++ b/source/blender/draw/engines/workbench/workbench_private.h @@ -187,6 +187,9 @@ typedef struct WORKBENCH_PrivateData { float viewvecs[3][4]; float ssao_params[4]; float ssao_settings[4]; + + /* Color Management */ + bool use_color_view_settings; } WORKBENCH_PrivateData; /* Transient data */ typedef struct WORKBENCH_EffectInfo { |