diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-05-02 16:18:53 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-05-02 17:19:12 +0300 |
commit | b52a0c78aff3afd49c0712ee35ba01f6b48662f7 (patch) | |
tree | 3dadc3f008de4c77962299777357a6075732ce41 /source | |
parent | 76193106d2e3d1d211af33f39a3714e22944cb18 (diff) |
Workbench,EEVEE: Viewport Render Samples
- Add `render_aa` and `viewport_aa` sampling setting for workbench. 0
samples means no AA, 1 sample uses FXAA and more samples will use
TAA.
The viewport `gpu_viewport_quality` can still limit viewport anti-aliasing
method.
- Use TAA when rendering images. (this used to be CPU based FSAA)
- Removed `R_OSA` related settings.
Reviewers: fclem, brecht
Maniphest Tasks: T60847
Differential Revision: https://developer.blender.org/D4773
Diffstat (limited to 'source')
16 files changed, 164 insertions, 98 deletions
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 017c15ebe41..170ab657388 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -100,8 +100,8 @@ typedef struct SeqRenderData { /* special case for OpenGL render */ struct GPUOffScreen *gpu_offscreen; - int gpu_samples; - bool gpu_full_samples; + // int gpu_samples; + // bool gpu_full_samples; } SeqRenderData; void BKE_sequencer_new_render_data(struct Main *bmain, diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 58b36aed24f..714261ce4ab 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -566,7 +566,7 @@ void BKE_scene_init(Scene *sce) sce->cursor.rotation_quaternion[0] = 1.0f; sce->cursor.rotation_axis[1] = 1.0f; - sce->r.mode = R_OSA; + sce->r.mode = 0; sce->r.cfra = 1; sce->r.sfra = 1; sce->r.efra = 250; @@ -767,7 +767,6 @@ void BKE_scene_init(Scene *sce) BLI_strncpy(sce->r.pic, U.renderdir, sizeof(sce->r.pic)); BLI_rctf_init(&sce->r.safety, 0.1f, 0.9f, 0.1f, 0.9f); - sce->r.osa = 8; /* Note; in header_info.c the scene copy happens..., * if you add more to renderdata it has to be checked there. */ @@ -905,6 +904,9 @@ void BKE_scene_init(Scene *sce) sce->display.matcap_ssao_attenuation = 1.0f; sce->display.matcap_ssao_samples = 16; + sce->display.render_aa = SCE_DISPLAY_AA_SAMPLES_8; + sce->display.viewport_aa = SCE_DISPLAY_AA_FXAA; + /* OpenGL Render. */ BKE_screen_view3d_shading_init(&sce->display.shading); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index b1a32552878..9035c7ff1ac 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -635,8 +635,6 @@ void BKE_sequencer_new_render_data(Main *bmain, r_context->is_proxy_render = false; r_context->view_id = 0; r_context->gpu_offscreen = NULL; - r_context->gpu_samples = (scene->r.mode & R_OSA) ? scene->r.osa : 0; - r_context->gpu_full_samples = (r_context->gpu_samples) && (scene->r.scemode & R_FULL_SAMPLE); } /* ************************* iterator ************************** */ @@ -2792,7 +2790,7 @@ static ImBuf *input_preprocess(const SeqRenderData *context, } if (ibuf->x != context->rectx || ibuf->y != context->recty) { - if (scene->r.mode & R_OSA) { + if (scene->display.render_aa > SCE_DISPLAY_AA_FXAA) { IMB_scaleImBuf(ibuf, (short)context->rectx, (short)context->recty); } else { @@ -3523,7 +3521,6 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, unsigned int draw_flags = V3D_OFSDRAW_NONE; draw_flags |= (use_gpencil) ? V3D_OFSDRAW_SHOW_ANNOTATION : 0; - draw_flags |= (context->gpu_full_samples) ? V3D_OFSDRAW_USE_FULL_SAMPLE : 0; draw_flags |= (context->scene->r.seq_flag & R_SEQ_OVERRIDE_SCENE_SETTINGS) ? V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS : 0; @@ -3549,7 +3546,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, IB_rect, draw_flags, scene->r.alphamode, - context->gpu_samples, + 0, /* no aa samples */ viewname, context->gpu_offscreen, err_out); diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index f9f87731197..d8d100db022 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -3287,6 +3287,12 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + if (!DNA_struct_elem_find(fd->filesdna, "SceneDisplay", "char", "render_aa")) { + LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) { + scene->display.render_aa = SCE_DISPLAY_AA_SAMPLES_8; + scene->display.viewport_aa = SCE_DISPLAY_AA_FXAA; + } + } /* Split bbone_scalein/bbone_scaleout into x and y fields. */ if (!DNA_struct_elem_find(fd->filesdna, "bPoseChannel", "float", "scale_out_y")) { diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index 962bc8e5efb..26f33f4db31 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -180,12 +180,13 @@ static void eevee_draw_background(void *vedata) /* Sort transparents before the loop. */ DRW_pass_sort_shgroup_z(psl->transparent_pass); - /* Number of iteration: needed for all temporal effect (SSR, volumetrics) - * when using opengl render. */ - int loop_len = (DRW_state_is_image_render() && - (stl->effects->enabled_effects & (EFFECT_VOLUMETRIC | EFFECT_SSR)) != 0) ? - 4 : - 1; + /* Number of iteration: Use viewport taa_samples when using viewport rendering */ + int loop_len = 1; + if (DRW_state_is_image_render()) { + const DRWContextState *draw_ctx = DRW_context_state_get(); + const Scene *scene = draw_ctx->scene; + loop_len = MAX2(1, scene->eevee.taa_samples); + } while (loop_len--) { float clear_col[4] = {0.0f, 0.0f, 0.0f, 0.0f}; diff --git a/source/blender/draw/engines/workbench/solid_mode.c b/source/blender/draw/engines/workbench/solid_mode.c index a01b14f17fb..e1050751830 100644 --- a/source/blender/draw/engines/workbench/solid_mode.c +++ b/source/blender/draw/engines/workbench/solid_mode.c @@ -61,8 +61,12 @@ static void workbench_solid_cache_finish(void *vedata) static void workbench_solid_draw_background(void *vedata) { WORKBENCH_Data *data = vedata; - workbench_deferred_draw_background(data); - workbench_deferred_draw_scene(data); + const int num_samples = workbench_num_viewport_rendering_iterations(data); + + for (int sample = 0; sample < num_samples; sample++) { + workbench_deferred_draw_background(data); + workbench_deferred_draw_scene(data); + } workbench_deferred_draw_finish(data); } diff --git a/source/blender/draw/engines/workbench/transparent_mode.c b/source/blender/draw/engines/workbench/transparent_mode.c index 0f4150ff986..bd2fb24dd85 100644 --- a/source/blender/draw/engines/workbench/transparent_mode.c +++ b/source/blender/draw/engines/workbench/transparent_mode.c @@ -59,8 +59,12 @@ static void workbench_transparent_cache_finish(void *vedata) static void workbench_transparent_draw_background(void *vedata) { WORKBENCH_Data *data = vedata; - workbench_forward_draw_background(data); - workbench_forward_draw_scene(data); + const int num_samples = workbench_num_viewport_rendering_iterations(data); + + for (int sample = 0; sample < num_samples; sample++) { + workbench_forward_draw_background(data); + workbench_forward_draw_scene(data); + } workbench_forward_draw_finish(data); } diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index 5d7bdc72546..a4c09efb28b 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -1156,7 +1156,7 @@ void workbench_deferred_draw_scene(WORKBENCH_Data *vedata) WORKBENCH_PrivateData *wpd = stl->g_data; DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get(); - if (TAA_ENABLED(wpd)) { + if (workbench_is_taa_enabled(wpd)) { workbench_taa_draw_scene_start(vedata); } diff --git a/source/blender/draw/engines/workbench/workbench_effect_aa.c b/source/blender/draw/engines/workbench/workbench_effect_aa.c index a80f6ce338b..b4cdcfcfc99 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_aa.c +++ b/source/blender/draw/engines/workbench/workbench_effect_aa.c @@ -40,10 +40,10 @@ void workbench_aa_create_pass(WORKBENCH_Data *vedata, GPUTexture **tx) wpd->is_playback = false; } - if (TAA_ENABLED(wpd)) { + if (workbench_is_taa_enabled(wpd)) { psl->effect_aa_pass = workbench_taa_create_pass(vedata, tx); } - else if (FXAA_ENABLED(wpd)) { + else if (workbench_is_fxaa_enabled(wpd)) { psl->effect_aa_pass = workbench_fxaa_create_pass(tx); effect_info->jitter_index = 0; } @@ -73,13 +73,13 @@ void workbench_aa_draw_pass(WORKBENCH_Data *vedata, GPUTexture *tx) WORKBENCH_EffectInfo *effect_info = stl->effects; DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get(); - if (FXAA_ENABLED(wpd)) { + if (workbench_is_fxaa_enabled(wpd)) { GPU_framebuffer_bind(fbl->effect_fb); workspace_aa_draw_transform(tx, wpd); GPU_framebuffer_bind(dfbl->color_only_fb); DRW_draw_pass(psl->effect_aa_pass); } - else if (TAA_ENABLED(wpd)) { + else if (workbench_is_taa_enabled(wpd)) { /* * when drawing the first TAA frame, we transform directly to the * color_only_fb as the TAA shader is just performing a direct copy. diff --git a/source/blender/draw/engines/workbench/workbench_effect_taa.c b/source/blender/draw/engines/workbench/workbench_effect_taa.c index 0435a804fab..7c411135634 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_taa.c +++ b/source/blender/draw/engines/workbench/workbench_effect_taa.c @@ -90,26 +90,40 @@ int workbench_taa_calculate_num_iterations(WORKBENCH_Data *vedata) { WORKBENCH_StorageList *stl = vedata->stl; WORKBENCH_PrivateData *wpd = stl->g_data; - int result = 1; - if (TAA_ENABLED(wpd)) { + const Scene *scene = DRW_context_state_get()->scene; + int result = scene->display.viewport_aa; + if (workbench_is_taa_enabled(wpd)) { if (DRW_state_is_image_render()) { - const Scene *scene = DRW_context_state_get()->scene; - result = (scene->r.mode & R_OSA) ? scene->r.osa : 1; + result = scene->display.render_aa; } else if (IN_RANGE_INCL(wpd->preferences->gpu_viewport_quality, GPU_VIEWPORT_QUALITY_TAA8, GPU_VIEWPORT_QUALITY_TAA16)) { - result = 8; + result = MIN2(result, 8); } else if (IN_RANGE_INCL(wpd->preferences->gpu_viewport_quality, GPU_VIEWPORT_QUALITY_TAA16, GPU_VIEWPORT_QUALITY_TAA32)) { - result = 16; + result = MIN2(result, 16); } else { - result = 32; + result = MIN2(result, 32); } } + else { + /* when no TAA is disabled return 1 to render a single sample + * see `workbench_render.c` */ + result = 1; + } + return result; +} + +int workbench_num_viewport_rendering_iterations(WORKBENCH_Data *UNUSED(vedata)) +{ + const DRWContextState *draw_ctx = DRW_context_state_get(); + const Scene *scene = draw_ctx->scene; + int result = DRW_state_is_image_render() ? scene->display.viewport_aa : 1; + result = MAX2(result, 1); return result; } diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c index 00590940ac3..7766fe918ca 100644 --- a/source/blender/draw/engines/workbench/workbench_forward.c +++ b/source/blender/draw/engines/workbench/workbench_forward.c @@ -682,7 +682,7 @@ void workbench_forward_draw_scene(WORKBENCH_Data *vedata) WORKBENCH_PrivateData *wpd = stl->g_data; DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get(); - if (TAA_ENABLED(wpd)) { + if (workbench_is_taa_enabled(wpd)) { workbench_taa_draw_scene_start(vedata); } diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h index 3cfb1283416..e25503aef6e 100644 --- a/source/blender/draw/engines/workbench/workbench_private.h +++ b/source/blender/draw/engines/workbench/workbench_private.h @@ -75,18 +75,7 @@ #define IS_NAVIGATING(wpd) \ ((DRW_context_state_get()->rv3d) && (DRW_context_state_get()->rv3d->rflag & RV3D_NAVIGATING)) -#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() && DRW_context_state_get()->scene->r.mode & R_OSA) || \ - (!DRW_state_is_image_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))) @@ -326,6 +315,35 @@ typedef struct WORKBENCH_ObjectData { int object_id; } WORKBENCH_ObjectData; +/* inline helper functions */ +BLI_INLINE bool workbench_is_taa_enabled(WORKBENCH_PrivateData *wpd) +{ + if (DRW_state_is_image_render()) { + return DRW_context_state_get()->scene->display.render_aa > SCE_DISPLAY_AA_FXAA; + } + else { + return DRW_context_state_get()->scene->display.viewport_aa > SCE_DISPLAY_AA_FXAA && + wpd->preferences->gpu_viewport_quality >= GPU_VIEWPORT_QUALITY_TAA8 && + !wpd->is_playback; + } +} + +BLI_INLINE bool workbench_is_fxaa_enabled(WORKBENCH_PrivateData *wpd) +{ + if (DRW_state_is_image_render()) { + return DRW_context_state_get()->scene->display.render_aa == SCE_DISPLAY_AA_FXAA; + } + else { + if (wpd->preferences->gpu_viewport_quality >= GPU_VIEWPORT_QUALITY_FXAA && + DRW_context_state_get()->scene->display.viewport_aa == SCE_DISPLAY_AA_FXAA) { + return true; + } + + /* when navigating or animation playback use FXAA. */ + return (IS_NAVIGATING(wpd) || wpd->is_playback) && workbench_is_taa_enabled(wpd); + } +} + /* workbench_deferred.c */ void workbench_deferred_engine_init(WORKBENCH_Data *vedata); void workbench_deferred_engine_free(void); @@ -375,6 +393,7 @@ void workbench_taa_draw_scene_start(WORKBENCH_Data *vedata); void workbench_taa_draw_scene_end(WORKBENCH_Data *vedata); void workbench_taa_view_updated(WORKBENCH_Data *vedata); int workbench_taa_calculate_num_iterations(WORKBENCH_Data *vedata); +int workbench_num_viewport_rendering_iterations(WORKBENCH_Data *vedata); /* workbench_effect_dof.c */ void workbench_dof_engine_init(WORKBENCH_Data *vedata, Object *camera); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 28cfce00e6e..342c6269419 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -489,8 +489,6 @@ static void screen_opengl_render_apply(const bContext *C, OGLRender *oglrender) for (view_id = 0; view_id < oglrender->views_len; view_id++) { context.view_id = view_id; context.gpu_offscreen = oglrender->ofs; - context.gpu_full_samples = oglrender->ofs_full_samples; - oglrender->seq_data.ibufs_arr[view_id] = BKE_sequencer_give_ibuf(&context, CFRA, chanshown); } } @@ -517,24 +515,6 @@ static void screen_opengl_render_apply(const bContext *C, OGLRender *oglrender) } } -static bool screen_opengl_fullsample_enabled(Scene *scene) -{ - if (scene->r.scemode & R_FULL_SAMPLE) { - return true; - } - else { - /* XXX TODO: - * Technically if the hardware supports MSAA we could keep using Blender 2.7x approach. - * However anti-aliasing without full_sample is not playing well even in 2.7x. - * - * For example, if you enable depth of field, there is aliasing, even if the viewport is fine. - * For 2.8x this is more complicated because so many things rely on shader. - * So until we fix the gpu_framebuffer anti-aliasing suupport we need to force full sample. - */ - return true; - } -} - static bool screen_opengl_render_init(bContext *C, wmOperator *op) { /* new render clears all callbacks */ @@ -548,8 +528,6 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) GPUOffScreen *ofs; OGLRender *oglrender; int sizex, sizey; - const int samples = (scene->r.mode & R_OSA) ? scene->r.osa : 0; - const bool full_samples = (samples != 0) && screen_opengl_fullsample_enabled(scene); bool is_view_context = RNA_boolean_get(op->ptr, "view_context"); const bool is_animation = RNA_boolean_get(op->ptr, "animation"); const bool is_sequencer = RNA_boolean_get(op->ptr, "sequencer"); @@ -598,7 +576,7 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) /* corrects render size with actual size, not every card supports non-power-of-two dimensions */ DRW_opengl_context_enable(); /* Offscreen creation needs to be done in DRW context. */ - ofs = GPU_offscreen_create(sizex, sizey, full_samples ? 0 : samples, true, true, err_out); + ofs = GPU_offscreen_create(sizex, sizey, 0, true, true, err_out); DRW_opengl_context_disable(); if (!ofs) { @@ -611,8 +589,6 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) op->customdata = oglrender; oglrender->ofs = ofs; - oglrender->ofs_samples = samples; - oglrender->ofs_full_samples = full_samples; oglrender->sizex = sizex; oglrender->sizey = sizey; oglrender->bmain = CTX_data_main(C); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index bf6d658f927..64f20a4a348 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -449,7 +449,7 @@ static Scene *preview_prepare_scene( } } else { - sce->r.mode &= ~(R_OSA); + sce->display.render_aa = SCE_DISPLAY_AA_OFF; } for (Base *base = view_layer->object_bases.first; base; base = base->next) { @@ -861,7 +861,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs if (sp->pr_method == PR_ICON_RENDER) { sce->r.scemode |= R_NO_IMAGE_LOAD; - sce->r.mode |= R_OSA; + sce->display.render_aa = SCE_DISPLAY_AA_SAMPLES_8; } else if (sp->pr_method == PR_NODE_RENDER) { if (idtype == ID_MA) { @@ -870,10 +870,10 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs else if (idtype == ID_TE) { sce->r.scemode |= R_TEXNODE_PREVIEW; } - sce->r.mode &= ~R_OSA; + sce->display.render_aa = SCE_DISPLAY_AA_OFF; } else { /* PR_BUTS_RENDER */ - sce->r.mode |= R_OSA; + sce->display.render_aa = SCE_DISPLAY_AA_SAMPLES_8; } /* callbacs are cleared on GetRender() */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index baa9b3ed5c3..902208a1629 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -670,7 +670,7 @@ typedef struct RenderData { /** * The number of samples to use per pixel. */ - short osa; + short osa DNA_DEPRECATED; short frs_sec; char _pad[6]; @@ -1566,6 +1566,11 @@ typedef struct SceneDisplay { float matcap_ssao_attenuation; int matcap_ssao_samples; + /** Method of AA for viewport rendering and image rendering */ + char viewport_aa; + char render_aa; + char _pad[6]; + /** OpenGL render engine settings. */ View3DShading shading; } SceneDisplay; @@ -1772,7 +1777,7 @@ typedef struct Scene { #define SCER_SHOW_SUBFRAME (1 << 3) /* RenderData.mode */ -#define R_OSA (1 << 0) +#define R_MODE_UNUSED_0 (1 << 0) /* cleared */ #define R_MODE_UNUSED_1 (1 << 1) /* cleared */ #define R_MODE_UNUSED_2 (1 << 2) /* cleared */ #define R_MODE_UNUSED_3 (1 << 3) /* cleared */ @@ -2397,6 +2402,17 @@ enum { SHADOW_METHOD_MAX = 3, }; +/* SceneDisplay->render_aa, SceneDisplay->viewport_aa */ +enum { + SCE_DISPLAY_AA_OFF = 0, + SCE_DISPLAY_AA_FXAA = 1, + SCE_DISPLAY_AA_SAMPLES_5 = 5, + SCE_DISPLAY_AA_SAMPLES_8 = 8, + SCE_DISPLAY_AA_SAMPLES_11 = 11, + SCE_DISPLAY_AA_SAMPLES_16 = 16, + SCE_DISPLAY_AA_SAMPLES_32 = 32, +}; + #ifdef __cplusplus } #endif diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 6f6699fa81b..3970cbdd439 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -192,6 +192,45 @@ static const EnumPropertyItem snap_uv_element_items[] = { {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"}, {0, NULL, 0, NULL, NULL}, }; + +const EnumPropertyItem rna_enum_scene_display_aa_methods[] = { + {SCE_DISPLAY_AA_OFF, + "OFF", + 0, + "No Anti-Aliasing", + "Scene will be rendering without any anti-aliasing"}, + {SCE_DISPLAY_AA_FXAA, + "FXAA", + 0, + "Single Pass Anti-Aliasing", + "Scene will be rendered using a single pass anti-aliasing method (FXAA)"}, + {SCE_DISPLAY_AA_SAMPLES_5, + "5", + 0, + "5 Samples", + "Scene will be rendered using 5 anti-aliasing samples"}, + {SCE_DISPLAY_AA_SAMPLES_8, + "8", + 0, + "8 Samples", + "Scene will be rendered using 8 anti-aliasing samples"}, + {SCE_DISPLAY_AA_SAMPLES_11, + "11", + 0, + "11 Samples", + "Scene will be rendered using 11 anti-aliasing samples"}, + {SCE_DISPLAY_AA_SAMPLES_16, + "16", + 0, + "16 Samples", + "Scene will be rendered using 16 anti-aliasing samples"}, + {SCE_DISPLAY_AA_SAMPLES_32, + "32", + 0, + "32 Samples", + "Scene will be rendered using 32 anti-aliasing samples"}, + {0, NULL, 0, NULL, NULL}, +}; #endif const EnumPropertyItem rna_enum_curve_fit_method_items[] = { @@ -5477,14 +5516,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; - static const EnumPropertyItem fixed_oversample_items[] = { - {5, "5", 0, "5", ""}, - {8, "8", 0, "8", ""}, - {11, "11", 0, "11", ""}, - {16, "16", 0, "16", ""}, - {0, NULL, 0, NULL, NULL}, - }; - static const EnumPropertyItem threads_mode_items[] = { {0, "AUTO", @@ -5686,21 +5717,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop, "Alpha Mode", "Representation of alpha information in the RGBA pixels"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); - prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "mode", R_OSA); - RNA_def_property_ui_text( - prop, - "Anti-Aliasing", - "Render and combine multiple samples per pixel to prevent jagged edges"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - - prop = RNA_def_property(srna, "antialiasing_samples", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "osa"); - RNA_def_property_enum_items(prop, fixed_oversample_items); - RNA_def_property_ui_text( - prop, "Anti-Aliasing Samples", "Amount of anti-aliasing samples per pixel"); - RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_EDGE_FRS); @@ -6573,6 +6589,17 @@ static void rna_def_scene_display(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Samples", "Number of samples"); RNA_def_property_range(prop, 1, 500); + prop = RNA_def_property(srna, "render_aa", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_enum_scene_display_aa_methods); + RNA_def_property_ui_text(prop, "Render Anti-Aliasing", "Method of anti-aliasing when rendering"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + + prop = RNA_def_property(srna, "viewport_aa", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rna_enum_scene_display_aa_methods); + RNA_def_property_ui_text( + prop, "Viewport Anti-Aliasing", "Method of anti-aliasing in 3d viewport"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + /* OpenGL render engine settings. */ prop = RNA_def_property(srna, "shading", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Shading Settings", "Shading settings for OpenGL render engine"); |