EEVEE: Renderlayer artifacts
When rendering the Subsurface scattering lighting render layer with high sample count render artifacts can appear. This patch will remove these render artifacts by using a more precise texture format when samples will be larger than 128. As with the new eevee-shadows it is more common to use higher number of samples. The reason why it was visible in the subsurface scattering is that every sample could change the color. Adding different values will reduce precision over the number of samples. The subsurface color render layer also has this issue, but it is not noticeable as the colors tend to be close to each other so the colors would most of the time just shift the precision and hold up better. Reviewed By: fclem Differential Revision: https://developer.blender.org/D6245
This commit is contained in:
parent
f1c994c555
commit
17b63db4e2
|
@ -131,7 +131,7 @@ int EEVEE_occlusion_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void EEVEE_occlusion_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
||||
void EEVEE_occlusion_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, uint tot_samples)
|
||||
{
|
||||
EEVEE_FramebufferList *fbl = vedata->fbl;
|
||||
EEVEE_TextureList *txl = vedata->txl;
|
||||
|
@ -143,11 +143,13 @@ void EEVEE_occlusion_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata
|
|||
const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
|
||||
|
||||
if (scene_eval->eevee.flag & SCE_EEVEE_GTAO_ENABLED) {
|
||||
const eGPUTextureFormat texture_format = (tot_samples > 128) ? GPU_R32F : GPU_R16F;
|
||||
|
||||
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
|
||||
float clear[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
|
||||
/* Should be enough precision for many samples. */
|
||||
DRW_texture_ensure_fullscreen_2d(&txl->ao_accum, GPU_R32F, 0);
|
||||
DRW_texture_ensure_fullscreen_2d(&txl->ao_accum, texture_format, 0);
|
||||
|
||||
GPU_framebuffer_ensure_config(&fbl->ao_accum_fb,
|
||||
{GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->ao_accum)});
|
||||
|
|
|
@ -988,7 +988,9 @@ void EEVEE_bloom_free(void);
|
|||
|
||||
/* eevee_occlusion.c */
|
||||
int EEVEE_occlusion_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
||||
void EEVEE_occlusion_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
||||
void EEVEE_occlusion_output_init(EEVEE_ViewLayerData *sldata,
|
||||
EEVEE_Data *vedata,
|
||||
uint tot_samples);
|
||||
void EEVEE_occlusion_output_accumulate(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
||||
void EEVEE_occlusion_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
||||
void EEVEE_occlusion_compute(EEVEE_ViewLayerData *sldata,
|
||||
|
@ -1009,7 +1011,9 @@ void EEVEE_screen_raytrace_free(void);
|
|||
void EEVEE_subsurface_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
||||
void EEVEE_subsurface_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
||||
void EEVEE_subsurface_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
||||
void EEVEE_subsurface_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata);
|
||||
void EEVEE_subsurface_output_init(EEVEE_ViewLayerData *sldata,
|
||||
EEVEE_Data *vedata,
|
||||
uint tot_samples);
|
||||
void EEVEE_subsurface_add_pass(EEVEE_ViewLayerData *sldata,
|
||||
EEVEE_Data *vedata,
|
||||
uint sss_id,
|
||||
|
|
|
@ -517,9 +517,17 @@ void EEVEE_render_draw(EEVEE_Data *vedata, RenderEngine *engine, RenderLayer *rl
|
|||
GPU_framebuffer_bind(fbl->main_fb);
|
||||
DRW_hair_update();
|
||||
|
||||
uint tot_sample = scene_eval->eevee.taa_render_samples;
|
||||
uint render_samples = 0;
|
||||
|
||||
/* SSR needs one iteration to start properly. */
|
||||
if (stl->effects->enabled_effects & EFFECT_SSR) {
|
||||
tot_sample += 1;
|
||||
}
|
||||
|
||||
if ((view_layer->passflag & (SCE_PASS_SUBSURFACE_COLOR | SCE_PASS_SUBSURFACE_DIRECT |
|
||||
SCE_PASS_SUBSURFACE_INDIRECT)) != 0) {
|
||||
EEVEE_subsurface_output_init(sldata, vedata);
|
||||
EEVEE_subsurface_output_init(sldata, vedata, tot_sample);
|
||||
}
|
||||
|
||||
if ((view_layer->passflag & SCE_PASS_MIST) != 0) {
|
||||
|
@ -527,21 +535,13 @@ void EEVEE_render_draw(EEVEE_Data *vedata, RenderEngine *engine, RenderLayer *rl
|
|||
}
|
||||
|
||||
if ((view_layer->passflag & SCE_PASS_AO) != 0) {
|
||||
EEVEE_occlusion_output_init(sldata, vedata);
|
||||
EEVEE_occlusion_output_init(sldata, vedata, tot_sample);
|
||||
}
|
||||
|
||||
uint tot_sample = scene_eval->eevee.taa_render_samples;
|
||||
uint render_samples = 0;
|
||||
|
||||
if (RE_engine_test_break(engine)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* SSR needs one iteration to start properly. */
|
||||
if (stl->effects->enabled_effects & EFFECT_SSR) {
|
||||
tot_sample += 1;
|
||||
}
|
||||
|
||||
while (render_samples < tot_sample && !RE_engine_test_break(engine)) {
|
||||
float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
float clear_depth = 1.0f;
|
||||
|
|
|
@ -156,7 +156,9 @@ static void set_shgrp_stencil(void *UNUSED(userData), DRWShadingGroup *shgrp)
|
|||
DRW_shgroup_stencil_mask(shgrp, 255);
|
||||
}
|
||||
|
||||
void EEVEE_subsurface_output_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
|
||||
void EEVEE_subsurface_output_init(EEVEE_ViewLayerData *UNUSED(sldata),
|
||||
EEVEE_Data *vedata,
|
||||
uint tot_samples)
|
||||
{
|
||||
EEVEE_FramebufferList *fbl = vedata->fbl;
|
||||
EEVEE_TextureList *txl = vedata->txl;
|
||||
|
@ -164,8 +166,10 @@ void EEVEE_subsurface_output_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Dat
|
|||
EEVEE_EffectsInfo *effects = stl->effects;
|
||||
|
||||
if (effects->enabled_effects & EFFECT_SSS) {
|
||||
DRW_texture_ensure_fullscreen_2d(&txl->sss_dir_accum, GPU_RGBA16F, 0);
|
||||
DRW_texture_ensure_fullscreen_2d(&txl->sss_col_accum, GPU_RGBA16F, 0);
|
||||
const eGPUTextureFormat texture_format_light = (tot_samples > 128) ? GPU_RGBA32F : GPU_RGBA16F;
|
||||
const eGPUTextureFormat texture_format_color = (tot_samples > 512) ? GPU_RGBA32F : GPU_RGBA16F;
|
||||
DRW_texture_ensure_fullscreen_2d(&txl->sss_dir_accum, texture_format_light, 0);
|
||||
DRW_texture_ensure_fullscreen_2d(&txl->sss_col_accum, texture_format_color, 0);
|
||||
|
||||
GPUTexture *stencil_tex = effects->sss_stencil;
|
||||
|
||||
|
|
Loading…
Reference in New Issue