Workbench: Support Odd Number Of AA Samples
Workbench render engine did not work when an odd number of AA samples were used. A user could enter these values by disabling AA or set the number of AA samples in the Render/Film panel to an odd number. This commit will not perform TAA passes when AA is disabled. For supporting the setting of 5 or 11 samples the bitmask was replaced by an if statement as this was making the odd number not render correctly. As extra introduce the jitter samples of 5 and 11 so the images will be more clean. a jitter sample of 11 used to read outside the allocated space of the jitter samples. Fix T60820 Reviewed By: fclem Maniphest Tasks: T60820 Differential Revision: https://developer.blender.org/D4546
This commit is contained in:
parent
109cbdf2e1
commit
84fe4cdcb3
Notes:
blender-bot
2023-02-14 11:28:43 +01:00
Referenced by issue #60820, Render artifacts; NoAA or 5, 11 Samples viewport render
|
@ -26,7 +26,9 @@
|
|||
|
||||
static struct {
|
||||
struct GPUShader *effect_taa_sh;
|
||||
float jitter_5[5][2];
|
||||
float jitter_8[8][2];
|
||||
float jitter_11[11][2];
|
||||
float jitter_16[16][2];
|
||||
float jitter_32[32][2];
|
||||
} e_data = {NULL};
|
||||
|
@ -79,7 +81,9 @@ static void workbench_taa_jitter_init_order(float (*table)[2], int num)
|
|||
|
||||
static void workbench_taa_jitter_init(void)
|
||||
{
|
||||
workbench_taa_jitter_init_order(e_data.jitter_5, 5);
|
||||
workbench_taa_jitter_init_order(e_data.jitter_8, 8);
|
||||
workbench_taa_jitter_init_order(e_data.jitter_11, 11);
|
||||
workbench_taa_jitter_init_order(e_data.jitter_16, 16);
|
||||
workbench_taa_jitter_init_order(e_data.jitter_32, 32);
|
||||
}
|
||||
|
@ -212,9 +216,15 @@ void workbench_taa_draw_scene_start(WORKBENCH_Data *vedata)
|
|||
num_samples = workbench_taa_calculate_num_iterations(vedata);
|
||||
switch (num_samples) {
|
||||
default:
|
||||
case 5:
|
||||
samples = e_data.jitter_5;
|
||||
break;
|
||||
case 8:
|
||||
samples = e_data.jitter_8;
|
||||
break;
|
||||
case 11:
|
||||
samples = e_data.jitter_11;
|
||||
break;
|
||||
case 16:
|
||||
samples = e_data.jitter_16;
|
||||
break;
|
||||
|
@ -225,10 +235,9 @@ void workbench_taa_draw_scene_start(WORKBENCH_Data *vedata)
|
|||
|
||||
mix_factor = 1.0f / (effect_info->jitter_index + 1);
|
||||
|
||||
const int bitmask = num_samples - 1;
|
||||
const int jitter_index = effect_info->jitter_index;
|
||||
const float *transform_offset = samples[jitter_index];
|
||||
effect_info->jitter_index = (jitter_index + 1) & bitmask;
|
||||
effect_info->jitter_index = (jitter_index + 1) % num_samples;
|
||||
|
||||
/* construct new matrices from transform delta */
|
||||
float viewmat[4][4];
|
||||
|
|
|
@ -62,7 +62,8 @@
|
|||
#define FXAA_ENABLED(wpd) ((!DRW_state_is_opengl_render()) && \
|
||||
(IN_RANGE(wpd->preferences->gpu_viewport_quality, GPU_VIEWPORT_QUALITY_FXAA, GPU_VIEWPORT_QUALITY_TAA8) || \
|
||||
((IS_NAVIGATING(wpd) || wpd->is_playback) && (wpd->preferences->gpu_viewport_quality >= GPU_VIEWPORT_QUALITY_TAA8))))
|
||||
#define TAA_ENABLED(wpd) (DRW_state_is_image_render() || (wpd->preferences->gpu_viewport_quality >= GPU_VIEWPORT_QUALITY_TAA8 && !IS_NAVIGATING(wpd) && !wpd->is_playback))
|
||||
#define TAA_ENABLED(wpd) ((DRW_state_is_image_render() && DRW_context_state_get()->scene->r.mode & R_OSA) || \
|
||||
(DRW_state_is_opengl_render() && wpd->preferences->gpu_viewport_quality >= GPU_VIEWPORT_QUALITY_TAA8 && !IS_NAVIGATING(wpd) && !wpd->is_playback))
|
||||
#define SPECULAR_HIGHLIGHT_ENABLED(wpd) (STUDIOLIGHT_ENABLED(wpd) && (wpd->shading.flag & V3D_SHADING_SPECULAR_HIGHLIGHT) && (!STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd)))
|
||||
#define OBJECT_OUTLINE_ENABLED(wpd) (wpd->shading.flag & V3D_SHADING_OBJECT_OUTLINE)
|
||||
#define OBJECT_ID_PASS_ENABLED(wpd) (OBJECT_OUTLINE_ENABLED(wpd) || CURVATURE_ENABLED(wpd))
|
||||
|
|
Loading…
Reference in New Issue