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:
authorClément Foucault <foucault.clem@gmail.com>2017-07-22 21:36:34 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-07-22 21:36:34 +0300
commitf359db19771102c85eac8e7c8494f667bd6e1315 (patch)
tree846b73b303821d356dfa631959f1a726d6f223f6
parent647f9c2325ec6528fdef6012ab6aaf778c6fd9fa (diff)
Eevee: SSR: Fix Opengl Render.
Add a constant number of 4 drawing loop to accumulate 4 "bounce" of light in SSRs.
-rw-r--r--source/blender/draw/engines/eevee/eevee_effects.c12
-rw-r--r--source/blender/draw/engines/eevee/eevee_engine.c68
2 files changed, 48 insertions, 32 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c
index 1da582d413f..da8c569089f 100644
--- a/source/blender/draw/engines/eevee/eevee_effects.c
+++ b/source/blender/draw/engines/eevee/eevee_effects.c
@@ -610,6 +610,8 @@ void EEVEE_effects_init(EEVEE_SceneLayerData *sldata, EEVEE_Data *vedata)
DRW_TEXTURE_FREE_SAFE(txl->ssr_normal_input);
DRW_TEXTURE_FREE_SAFE(txl->ssr_specrough_input);
DRW_FRAMEBUFFER_FREE_SAFE(fbl->screen_tracing_fb);
+ stl->g_data->ssr_hit_output = NULL;
+ stl->g_data->ssr_pdf_output = NULL;
}
/* Setup double buffer so we can access last frame as it was before post processes */
@@ -1214,12 +1216,20 @@ void EEVEE_draw_effects(EEVEE_Data *vedata)
/* If no post processes is enabled, buffers are still not swapped, do it now. */
SWAP_DOUBLE_BUFFERS();
- if (!stl->g_data->valid_double_buffer && ((effects->enabled_effects & EFFECT_DOUBLE_BUFFER) != 0)) {
+ if (!stl->g_data->valid_double_buffer &&
+ ((effects->enabled_effects & EFFECT_DOUBLE_BUFFER) != 0) &&
+ (DRW_state_is_image_render() == false))
+ {
/* If history buffer is not valid request another frame.
* This fix black reflections on area resize. */
DRW_viewport_request_redraw();
}
+ /* Update double buffer status if render mode. */
+ if (DRW_state_is_image_render()) {
+ stl->g_data->valid_double_buffer = (txl->color_double_buffer != NULL);
+ DRW_viewport_matrix_get(stl->g_data->prev_persmat, DRW_MAT_PERS);
+ }
}
void EEVEE_effects_free(void)
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c
index 6a59c5a2ee1..07b084a95b9 100644
--- a/source/blender/draw/engines/eevee/eevee_engine.c
+++ b/source/blender/draw/engines/eevee/eevee_engine.c
@@ -134,48 +134,54 @@ static void EEVEE_draw_scene(void *vedata)
/* Default framebuffer and texture */
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
- /* Refresh shadows */
- EEVEE_draw_shadows(sldata, psl);
+ /* Number of iteration: needed for all temporal effect (SSR, TAA)
+ * when using opengl render. */
+ int loop_ct = DRW_state_is_image_render() ? 4 : 1;
- /* Refresh Probes */
- EEVEE_lightprobes_refresh(sldata, vedata);
+ while (loop_ct--) {
+ /* Refresh shadows */
+ EEVEE_draw_shadows(sldata, psl);
- /* Attach depth to the hdr buffer and bind it */
- DRW_framebuffer_texture_detach(dtxl->depth);
- DRW_framebuffer_texture_attach(fbl->main, dtxl->depth, 0, 0);
- DRW_framebuffer_bind(fbl->main);
- DRW_framebuffer_clear(false, true, false, NULL, 1.0f);
+ /* Refresh Probes */
+ EEVEE_lightprobes_refresh(sldata, vedata);
- /* TODO move background after depth pass to cut some overdraw */
- DRW_draw_pass(psl->background_pass);
+ /* Attach depth to the hdr buffer and bind it */
+ DRW_framebuffer_texture_detach(dtxl->depth);
+ DRW_framebuffer_texture_attach(fbl->main, dtxl->depth, 0, 0);
+ DRW_framebuffer_bind(fbl->main);
+ DRW_framebuffer_clear(false, true, false, NULL, 1.0f);
- /* Depth prepass */
- DRW_draw_pass(psl->depth_pass);
- DRW_draw_pass(psl->depth_pass_cull);
+ /* TODO move background after depth pass to cut some overdraw */
+ DRW_draw_pass(psl->background_pass);
- /* Create minmax texture */
- EEVEE_create_minmax_buffer(vedata, dtxl->depth);
+ /* Depth prepass */
+ DRW_draw_pass(psl->depth_pass);
+ DRW_draw_pass(psl->depth_pass_cull);
- /* Restore main FB */
- DRW_framebuffer_bind(fbl->main);
+ /* Create minmax texture */
+ EEVEE_create_minmax_buffer(vedata, dtxl->depth);
- /* Shading pass */
- DRW_draw_pass(psl->probe_display);
- EEVEE_draw_default_passes(psl);
- DRW_draw_pass(psl->material_pass);
+ /* Restore main FB */
+ DRW_framebuffer_bind(fbl->main);
- /* Screen Space Reflections */
- EEVEE_effects_do_ssr(sldata, vedata);
+ /* Shading pass */
+ DRW_draw_pass(psl->probe_display);
+ EEVEE_draw_default_passes(psl);
+ DRW_draw_pass(psl->material_pass);
- /* Volumetrics */
- EEVEE_effects_do_volumetrics(sldata, vedata);
+ /* Screen Space Reflections */
+ EEVEE_effects_do_ssr(sldata, vedata);
- /* Transparent */
- DRW_pass_sort_shgroup_z(psl->transparent_pass);
- DRW_draw_pass(psl->transparent_pass);
+ /* Volumetrics */
+ EEVEE_effects_do_volumetrics(sldata, vedata);
- /* Post Process */
- EEVEE_draw_effects(vedata);
+ /* Transparent */
+ DRW_pass_sort_shgroup_z(psl->transparent_pass);
+ DRW_draw_pass(psl->transparent_pass);
+
+ /* Post Process */
+ EEVEE_draw_effects(vedata);
+ }
}
static void EEVEE_engine_free(void)