diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-07-03 10:01:17 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-07-04 16:41:36 +0300 |
commit | e2bf240cbf5e806eddbc64987bb73adc4233e79e (patch) | |
tree | e4320a3af5045a6967ff5a57b0ab6e62eecdcb73 | |
parent | 2ee257e2c34fecbeca798cfcb22b60903e50fcd2 (diff) |
GreasePencil: Image render artifacts
When doing image rendering with grease pencil, it reused the view of
workbench or EEVEE. These views might be offsetted due to TAA.
This shifted the view a tiny bit. We will not reset the view in between
render engines.
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D5171
-rw-r--r-- | source/blender/draw/engines/gpencil/gpencil_render.c | 9 | ||||
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_effect_taa.c | 4 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 13 |
3 files changed, 15 insertions, 11 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_render.c b/source/blender/draw/engines/gpencil/gpencil_render.c index bdb6d51ca19..7ee86bcc392 100644 --- a/source/blender/draw/engines/gpencil/gpencil_render.c +++ b/source/blender/draw/engines/gpencil/gpencil_render.c @@ -103,12 +103,9 @@ void GPENCIL_render_init(GPENCIL_Data *ved, RenderEngine *engine, struct Depsgra invert_m4_m4(viewmat, viewinv); - /* Reuse the view created by EEVEE or Workbench */ - if (DRW_view_default_get() == NULL) { - DRWView *view = DRW_view_create(viewmat, winmat, NULL, NULL, NULL); - DRW_view_default_set(view); - DRW_view_set_active(view); - } + DRWView *view = DRW_view_create(viewmat, winmat, NULL, NULL, NULL); + DRW_view_default_set(view); + DRW_view_set_active(view); DRW_view_persmat_get(NULL, persmat, false); diff --git a/source/blender/draw/engines/workbench/workbench_effect_taa.c b/source/blender/draw/engines/workbench/workbench_effect_taa.c index 9fba28a3845..88f1f30941a 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_taa.c +++ b/source/blender/draw/engines/workbench/workbench_effect_taa.c @@ -284,7 +284,9 @@ void workbench_taa_draw_scene_end(WORKBENCH_Data *vedata) GPU_framebuffer_blit(dfbl->color_only_fb, 0, fbl->effect_taa_fb, 0, GPU_COLOR_BIT); - DRW_view_set_active(NULL); + if (!DRW_state_is_image_render()) { + DRW_view_set_active(NULL); + } if (effect_info->jitter_index != 0 && !DRW_state_is_image_render()) { DRW_viewport_request_redraw(); diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index f8672a2da37..46f02f04064 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1916,6 +1916,13 @@ void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph DST.buffer_finish_called = false; } +static void drw_view_reset() +{ + DST.view_default = NULL; + DST.view_active = NULL; + DST.view_previous = NULL; +} + void DRW_render_to_image(RenderEngine *engine, struct Depsgraph *depsgraph) { Scene *scene = DEG_get_evaluated_scene(depsgraph); @@ -1998,14 +2005,12 @@ void DRW_render_to_image(RenderEngine *engine, struct Depsgraph *depsgraph) for (RenderView *render_view = render_result->views.first; render_view != NULL; render_view = render_view->next) { RE_SetActiveRenderView(render, render_view->name); - /* Reset the view. */ - DST.view_default = NULL; - DST.view_active = NULL; - DST.view_previous = NULL; + drw_view_reset(); engine_type->draw_engine->render_to_image(data, engine, render_layer, &render_rect); /* grease pencil: render result is merged in the previous render result. */ if (DRW_render_check_grease_pencil(depsgraph)) { DRW_state_reset(); + drw_view_reset(); DRW_render_gpencil_to_image(engine, render_layer, &render_rect); } DST.buffer_finish_called = false; |