diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-11-13 16:00:03 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-11-27 17:40:07 +0300 |
commit | 17b63db4e2721f5cf8389c3354460771d8348c50 (patch) | |
tree | eefd549551c03663d3a9d7dc83b023d2df53fdd9 /source/blender/draw/engines/eevee/eevee_subsurface.c | |
parent | f1c994c555da7c3e27984cc26b7f226badbe670d (diff) |
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
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_subsurface.c')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_subsurface.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_subsurface.c b/source/blender/draw/engines/eevee/eevee_subsurface.c index 8376b8c67b8..a7c28347c15 100644 --- a/source/blender/draw/engines/eevee/eevee_subsurface.c +++ b/source/blender/draw/engines/eevee/eevee_subsurface.c @@ -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; |