From 7353e0563ee2aa0c6393112139ea38debdd18b54 Mon Sep 17 00:00:00 2001 From: Adam Nydahl Date: Mon, 27 May 2019 17:07:17 +0200 Subject: Eevee: Fix Aliasing in Light Probes Differential Revision: https://developer.blender.org/D4869 --- source/blender/blenkernel/intern/scene.c | 2 +- source/blender/blenloader/intern/versioning_defaults.c | 3 +++ source/blender/draw/engines/eevee/eevee_lightprobes.c | 13 +++++++++---- source/blender/makesrna/intern/rna_scene.c | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 872f99ff813..971e878ccbc 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -916,7 +916,7 @@ void BKE_scene_init(Scene *sce) sce->eevee.gi_cubemap_draw_size = 0.3f; sce->eevee.gi_irradiance_draw_size = 0.1f; sce->eevee.gi_irradiance_smoothing = 0.1f; - sce->eevee.gi_filter_quality = 1.0f; + sce->eevee.gi_filter_quality = 3.0f; sce->eevee.taa_samples = 16; sce->eevee.taa_render_samples = 64; diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index 65dc38bd4b9..d22620f9224 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -458,6 +458,9 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template) copy_v3_v3(scene->display.light_direction, (float[3]){M_SQRT1_3, M_SQRT1_3, M_SQRT1_3}); copy_v2_fl2(scene->safe_areas.title, 0.1f, 0.05f); copy_v2_fl2(scene->safe_areas.action, 0.035f, 0.035f); + + /* Change default cubemap quality. */ + scene->eevee.gi_filter_quality = 3.0f; } if (app_template == NULL) { diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 388a8b5e73d..78565f9c465 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -1053,7 +1053,7 @@ void EEVEE_lightbake_filter_glossy(EEVEE_ViewLayerData *sldata, /* 3 - Render to probe array to the specified layer, do prefiltering. */ int mipsize = GPU_texture_width(light_cache->cube_tx.tex); for (int i = 0; i < maxlevel + 1; i++) { - float bias = (i == 0) ? -1.0f : 1.0f; + float bias = 0.0f; pinfo->texel_size = 1.0f / (float)mipsize; pinfo->padding_size = (i == maxlevel) ? 0 : (float)(1 << (maxlevel - i - 1)); pinfo->padding_size *= pinfo->texel_size; @@ -1063,22 +1063,27 @@ void EEVEE_lightbake_filter_glossy(EEVEE_ViewLayerData *sldata, pinfo->roughness *= pinfo->roughness; /* Distribute Roughness accros lod more evenly */ CLAMP(pinfo->roughness, 1e-8f, 0.99999f); /* Avoid artifacts */ -#if 1 /* Variable Sample count (fast) */ +#if 1 /* Variable Sample count and bias (fast) */ switch (i) { case 0: pinfo->samples_len = 1.0f; + bias = -1.0f; break; case 1: - pinfo->samples_len = 16.0f; + pinfo->samples_len = 32.0f; + bias = 1.0f; break; case 2: - pinfo->samples_len = 32.0f; + pinfo->samples_len = 40.0f; + bias = 2.0f; break; case 3: pinfo->samples_len = 64.0f; + bias = 2.0f; break; default: pinfo->samples_len = 128.0f; + bias = 2.0f; break; } #else /* Constant Sample count (slow) */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 894f9bfbe3e..a4b305d36ae 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -6584,7 +6584,7 @@ static void rna_def_scene_eevee(BlenderRNA *brna) RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC); prop = RNA_def_property(srna, "gi_filter_quality", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_default(prop, 1.0f); + RNA_def_property_float_default(prop, 3.0f); RNA_def_property_ui_text( prop, "Filter Quality", "Take more samples during cubemap filtering to remove artifacts"); RNA_def_property_range(prop, 1.0f, 8.0f); -- cgit v1.2.3